fix(models): 模型目录 - 识别公共视频能力并按声明发送分辨率

This commit is contained in:
Codex committed 2026-08-16 22:35:20 +08:00
1 parent 6cdece9e04
commit f8cbcd1b6f
19 files changed
+792 -51

No files matched your search

@@ -169,6 +169,43 @@ func normalizeVideoResolution(value string) string {
return value + "p"
}
func videoResolutionNameRequest(profile *VideoCapabilityConfig, value string) string {
requested := strings.ToLower(strings.TrimSpace(value))
if requested == "" || requested == "auto" || requested == "default" || requested == "medium" || requested == "high" {
return ""
}
if profile == nil {
return ""
}
if len(profile.Resolutions) == 0 {
return ""
}
candidates := []string{requested, strings.ToLower(normalizeVideoResolution(requested))}
if requested == "4k" {
candidates = append(candidates, "2160p")
}
if requested == "2160" || requested == "2160p" {
candidates = append(candidates, "4k")
}
for _, supported := range profile.Resolutions {
for _, candidate := range candidates {
if strings.EqualFold(strings.TrimSpace(supported), candidate) {
return strings.TrimSpace(supported)
}
}
}
return ""
}
func isAutomaticVideoResolution(value string) bool {
switch strings.ToLower(strings.TrimSpace(value)) {
case "", "auto", "default", "medium", "high":
return true
default:
return false
}
}
func normalizeXAIVideoDuration(value string) int {
duration, err := strconv.Atoi(strings.TrimSpace(value))
if err != nil || duration <= 0 {