惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
小众软件
小众软件
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
A
About on SuperTechFans
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
B
Blog RSS Feed
G
Google Developers Blog
量子位
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
feat(openai): pass image output options (#70503) · opencl...
ottodeng · 2026-04-24 · via Recent Commits to openclaw:main

@@ -198,6 +198,10 @@ describe("openai image generation provider", () => {

198198

expect(provider.capabilities.geometry?.sizes).toEqual(

199199

expect.arrayContaining(["2048x2048", "3840x2160", "2160x3840"]),

200200

);

201+

expect(provider.capabilities.output).toEqual({

202+

formats: ["png", "jpeg", "webp"],

203+

qualities: ["low", "medium", "high", "auto"],

204+

});

201205

});

202206203207

it("reports configured when either OpenAI API key auth or Codex OAuth auth is available", () => {

@@ -339,6 +343,50 @@ describe("openai image generation provider", () => {

339343

expect(result.images).toHaveLength(1);

340344

});

341345346+

it("forwards output and OpenAI-only options on direct generations", async () => {

347+

mockGeneratedPngResponse();

348+349+

const provider = buildOpenAIImageGenerationProvider();

350+

const result = await provider.generateImage({

351+

provider: "openai",

352+

model: "gpt-image-2",

353+

prompt: "Cheap JPEG preview",

354+

cfg: {},

355+

quality: "low",

356+

outputFormat: "jpeg",

357+

providerOptions: {

358+

openai: {

359+

background: "opaque",

360+

moderation: "low",

361+

outputCompression: 60,

362+

user: "end-user-42",

363+

},

364+

},

365+

});

366+367+

expect(postJsonRequestMock).toHaveBeenCalledWith(

368+

expect.objectContaining({

369+

url: "https://api.openai.com/v1/images/generations",

370+

body: {

371+

model: "gpt-image-2",

372+

prompt: "Cheap JPEG preview",

373+

n: 1,

374+

size: "1024x1024",

375+

quality: "low",

376+

output_format: "jpeg",

377+

background: "opaque",

378+

moderation: "low",

379+

output_compression: 60,

380+

user: "end-user-42",

381+

},

382+

}),

383+

);

384+

expect(result.images[0]).toMatchObject({

385+

mimeType: "image/jpeg",

386+

fileName: "image-1.jpg",

387+

});

388+

});

389+342390

it("allows loopback image requests for the synthetic mock-openai provider", async () => {

343391

mockGeneratedPngResponse();

344392

@@ -463,6 +511,44 @@ describe("openai image generation provider", () => {

463511

expect(result.images).toHaveLength(1);

464512

});

465513514+

it("forwards output and OpenAI-only options on multipart edits", async () => {

515+

mockGeneratedPngResponse();

516+517+

const provider = buildOpenAIImageGenerationProvider();

518+

const result = await provider.generateImage({

519+

provider: "openai",

520+

model: "gpt-image-2",

521+

prompt: "Edit as WebP",

522+

cfg: {},

523+

inputImages: [{ buffer: Buffer.from("png-bytes"), mimeType: "image/png" }],

524+

quality: "high",

525+

outputFormat: "webp",

526+

providerOptions: {

527+

openai: {

528+

background: "transparent",

529+

moderation: "auto",

530+

outputCompression: 75,

531+

user: "end-user-99",

532+

},

533+

},

534+

});

535+536+

const editCallArgs = postMultipartRequestMock.mock.calls[0]?.[0] as {

537+

body: FormData;

538+

};

539+

const form = editCallArgs.body;

540+

expect(form.get("quality")).toBe("high");

541+

expect(form.get("output_format")).toBe("webp");

542+

expect(form.get("background")).toBe("transparent");

543+

expect(form.get("moderation")).toBe("auto");

544+

expect(form.get("output_compression")).toBe("75");

545+

expect(form.get("user")).toBe("end-user-99");

546+

expect(result.images[0]).toMatchObject({

547+

mimeType: "image/webp",

548+

fileName: "image-1.webp",

549+

});

550+

});

551+466552

it("falls back to Codex OAuth image generation through Responses streaming", async () => {

467553

mockCodexAuthOnly();

468554

mockCodexImageStream({ imageData: "codex-image", revisedPrompt: "revised codex prompt" });

@@ -477,6 +563,14 @@ describe("openai image generation provider", () => {

477563

authStore,

478564

count: 1,

479565

size: "1024x1536",

566+

quality: "low",

567+

outputFormat: "jpeg",

568+

providerOptions: {

569+

openai: {

570+

background: "opaque",

571+

outputCompression: 55,

572+

},

573+

},

480574

});

481575482576

expect(resolveApiKeyForProviderMock).toHaveBeenCalledWith(

@@ -517,6 +611,10 @@ describe("openai image generation provider", () => {

517611

type: "image_generation",

518612

model: "gpt-image-2",

519613

size: "1024x1536",

614+

quality: "low",

615+

output_format: "jpeg",

616+

background: "opaque",

617+

output_compression: 55,

520618

},

521619

],

522620

tool_choice: { type: "image_generation" },

@@ -530,8 +628,8 @@ describe("openai image generation provider", () => {

530628

expect(result.images).toEqual([

531629

{

532630

buffer: Buffer.from("codex-image"),

533-

mimeType: "image/png",

534-

fileName: "image-1.png",

631+

mimeType: "image/jpeg",

632+

fileName: "image-1.jpg",

535633

revisedPrompt: "revised codex prompt",

536634

},

537635

]);