修复模型引用与账单展示
This commit is contained in:
@@ -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" }
|
||||
|
||||
Reference in New Issue
Block a user