diff --git a/src/main/agent/model-runtime.test.ts b/src/main/agent/model-runtime.test.ts index 2eb36d2c..15a07678 100644 --- a/src/main/agent/model-runtime.test.ts +++ b/src/main/agent/model-runtime.test.ts @@ -5548,7 +5548,7 @@ describe('ModelAgentRuntime', () => { expect(form.get('prompt')).toBe('把背景改成白色') expect(form.get('n')).toBe('1') expect(form.get('quality')).toBe('medium') - expect(form.get('response_format')).toBe('b64_json') + expect(form.get('response_format')).toBeNull() expect(form.get('background')).toBe('transparent') const uploaded = form.get('image') expect(uploaded).toBeInstanceOf(Blob) diff --git a/src/main/agent/model-runtime.ts b/src/main/agent/model-runtime.ts index c3be5225..6379e249 100644 --- a/src/main/agent/model-runtime.ts +++ b/src/main/agent/model-runtime.ts @@ -1793,7 +1793,12 @@ export class ModelAgentRuntime implements AgentRuntime { images: NonNullable ): FormData { const form = new FormData() - const fields = this.createImageGenerationRequest(prompt) + const fields = this.createRequestBody({ + model: this.options.model, + prompt: prompt.slice(0, 100_000), + n: 1, + quality: this.options.imageGenerationQuality ?? 'auto' + }) for (const [name, value] of Object.entries(fields)) { form.append( name,