fix(canvas): 图像参数 - 移除透明背景误拦截并支持 21:9 尺寸
This commit is contained in:
@@ -327,9 +327,6 @@ func systemChannelIDFromBaseURL(baseURL string) string {
|
||||
}
|
||||
|
||||
func runImageTask(ctx context.Context, input canvasGenerationInput) (map[string]interface{}, error) {
|
||||
if input.Config.TransparentBackground == "true" && !supportsTransparentImageBackground(input.Config) {
|
||||
return nil, errors.New("当前模型不支持透明背景,请关闭透明背景或切换至 GPT Image 1 系列模型")
|
||||
}
|
||||
var payload imageResponse
|
||||
if len(input.ReferenceImages) > 0 || input.Mask != nil {
|
||||
body := &bytes.Buffer{}
|
||||
@@ -1781,12 +1778,6 @@ func isArkPlanVideoConfig(config providerConfig) bool {
|
||||
return strings.Contains(strings.ToLower(config.BaseURL), "/api/plan/v3")
|
||||
}
|
||||
|
||||
// 透明背景必须按模型能力显式开放,避免上游静默忽略参数后返回不透明图片。
|
||||
func supportsTransparentImageBackground(config providerConfig) bool {
|
||||
model := strings.ToLower(strings.TrimSpace(config.Model))
|
||||
return strings.EqualFold(strings.TrimSpace(config.APIFormat), "openai") && (model == "gpt-image-1" || strings.HasPrefix(model, "gpt-image-1-") || strings.HasPrefix(model, "gpt-image-1."))
|
||||
}
|
||||
|
||||
func normalizeImageQuality(value string) string {
|
||||
switch strings.ToLower(strings.TrimSpace(value)) {
|
||||
case "1k":
|
||||
|
||||
Reference in New Issue
Block a user