修复模型引用与账单展示

This commit is contained in:
2026-06-15 00:17:20 +08:00
parent 10ec25d87b
commit 02ba5d3cdd
6 changed files with 146 additions and 47 deletions
@@ -126,7 +126,7 @@ func (aspectRatioProcessor) Process(params map[string]any, modelType string, con
return true
}
processed, ok := validateAndAdjustAspectRatio(aspectRatio, capability, allowed)
processed, ok := validateExplicitAspectRatio(aspectRatio, capability, allowed, modelType)
if !ok {
before := params["aspect_ratio"]
delete(params, "aspect_ratio")
@@ -172,6 +172,18 @@ func (aspectRatioProcessor) Process(params map[string]any, modelType string, con
return true
}
func validateExplicitAspectRatio(aspectRatio string, capability map[string]any, allowed []string, modelType string) (string, bool) {
if isVideoModelType(modelType) && len(allowed) > 0 && !containsString(allowed, aspectRatio) {
if aspectRatio == "adaptive" || aspectRatio == "keep_ratio" {
return "", false
}
if _, ok := numberPair(capability["aspect_ratio_range"]); !ok {
return allowed[0], true
}
}
return validateAndAdjustAspectRatio(aspectRatio, capability, allowed)
}
type imageSizeProcessor struct{}
func (imageSizeProcessor) Name() string { return "ImageSizeProcessor" }