fix(canvas): Grok 图片生成 - 移除冲突的 size 参数并锁定请求体格式

Co-authored-by: yepwait <1239738103@qq.com>
Original-PR: https://github.com/ddcat-ai/open-ai-canvas/pull/209
This commit is contained in:
yepandyepwait authored and GitHub committed 2026-08-14 09:59:18 +08:00
1 parent 1e4cf84c10
commit 477aebded5
3 files changed
+16 -5

No files matched your search

+3 -3
View File
@@ -751,9 +751,9 @@ func grokImageRequestBody(input canvasGenerationInput) (grokImageRequest, string
Prompt: withSystemPrompt(input.Config, input.Prompt),
N: 1,
ResponseFormat: "url",
Size: strings.TrimSpace(input.Config.Size),
AspectRatio: normalizeGrokImageAspectRatio(input.Config.Size),
Resolution: normalizeGrokImageResolution(input.Config.Quality),
// Grok 图片协议用 aspect_ratio 表达画布比例;同时发送 size 会被上游按 OpenAI 枚举校验并拒绝。
AspectRatio: normalizeGrokImageAspectRatio(input.Config.Size),
Resolution: normalizeGrokImageResolution(input.Config.Quality),
}
if len(input.ReferenceImages) == 0 {
return body, "/images/generations", nil