fix(api): 模型计价 - 兼容图片分辨率字段拼写并校验能力

This commit is contained in:
ddcat666 committed 2026-10-11 22:36:48 +08:00
1 parent a8edb6f27f
commit 435bc487cf
2 files changed
+18 -1

No files matched your search

@@ -144,6 +144,10 @@ func normalizeChannelModelTierSelector(capability string, input ChannelModelPric
}
case "vquality":
value = normalizeChannelModelTierResolution(value)
case "resolution", "resoluton":
// 兼容图片价格档的标准字段,以及历史接口误拼写 resoluton。
key = "resolution"
value = strings.ToLower(strings.TrimSpace(value))
case "videoSeconds":
seconds, err := strconv.Atoi(value)
if err != nil || seconds < 0 {
@@ -200,6 +204,9 @@ func normalizeChannelModelTierSelector(capability string, input ChannelModelPric
if _, exists := selector["vquality"]; exists && capability != "video" {
return nil, "", 0, BadAuthRequest("只有视频模型可以按分辨率配置价格档")
}
if _, exists := selector["resolution"]; exists && capability != "image" {
return nil, "", 0, BadAuthRequest("只有图片模型可以按分辨率配置价格档")
}
if _, exists := selector["videoSeconds"]; exists && capability != "video" {
return nil, "", 0, BadAuthRequest("只有视频模型可以按时长配置价格档")
}