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

推荐订阅源

博客园 - Franky
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
大猫的无限游戏
大猫的无限游戏
博客园 - 司徒正美
D
Docker
T
The Blog of Author Tim Ferriss
罗磊的独立博客
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
J
Java Code Geeks
Jina AI
Jina AI
博客园 - 【当耐特】
C
Check Point Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
腾讯CDC
Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog

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
fix: expose OpenAI image quality and moderation CLI optio...
lastguru-net · 2026-06-18 · via Recent Commits to openclaw:main

@@ -49,7 +49,9 @@ import { ADMIN_SCOPE } from "../gateway/operator-scopes.js";

4949

import { generateImage, listRuntimeImageGenerationProviders } from "../image-generation/runtime.js";

5050

import type {

5151

ImageGenerationBackground,

52+

ImageGenerationOpenAIModeration,

5253

ImageGenerationOutputFormat,

54+

ImageGenerationQuality,

5355

} from "../image-generation/types.js";

5456

import {

5557

parseStrictFiniteNumber,

@@ -203,6 +205,12 @@ const CAPABILITY_METADATA: CapabilityMetadata[] = [

203205

"--size",

204206

"--aspect-ratio",

205207

"--resolution",

208+

"--output-format",

209+

"--background",

210+

"--openai-background",

211+

"--openai-moderation",

212+

"--quality",

213+

"--timeout-ms",

206214

"--output",

207215

"--json",

208216

],

@@ -222,6 +230,8 @@ const CAPABILITY_METADATA: CapabilityMetadata[] = [

222230

"--output-format",

223231

"--background",

224232

"--openai-background",

233+

"--openai-moderation",

234+

"--quality",

225235

"--timeout-ms",

226236

"--output",

227237

"--json",

@@ -979,6 +989,8 @@ async function runImageGenerate(params: {

979989

outputFormat?: ImageGenerationOutputFormat;

980990

background?: ImageGenerationBackground;

981991

openaiBackground?: ImageGenerationBackground;

992+

openaiModeration?: ImageGenerationOpenAIModeration;

993+

quality?: ImageGenerationQuality;

982994

file?: string[];

983995

output?: string;

984996

timeoutMs?: number;

@@ -1008,11 +1020,18 @@ async function runImageGenerate(params: {

10081020

size: params.size,

10091021

aspectRatio: params.aspectRatio,

10101022

resolution: params.resolution,

1023+

quality: params.quality,

10111024

outputFormat: params.outputFormat,

10121025

background: params.background,

1013-

providerOptions: params.openaiBackground

1014-

? { openai: { background: params.openaiBackground } }

1015-

: undefined,

1026+

providerOptions:

1027+

params.openaiBackground || params.openaiModeration

1028+

? {

1029+

openai: {

1030+

...(params.openaiBackground ? { background: params.openaiBackground } : {}),

1031+

...(params.openaiModeration ? { moderation: params.openaiModeration } : {}),

1032+

},

1033+

}

1034+

: undefined,

10161035

timeoutMs: params.timeoutMs,

10171036

inputImages,

10181037

});

@@ -1216,6 +1235,35 @@ function normalizeImageBackground(

12161235

throw new Error(`${label} must be one of transparent, opaque, or auto`);

12171236

}

121812371238+

function normalizeImageQuality(raw: string | undefined): ImageGenerationQuality | undefined {

1239+

const normalized = normalizeLowercaseStringOrEmpty(raw);

1240+

if (!normalized) {

1241+

return undefined;

1242+

}

1243+

if (

1244+

normalized === "low" ||

1245+

normalized === "medium" ||

1246+

normalized === "high" ||

1247+

normalized === "auto"

1248+

) {

1249+

return normalized;

1250+

}

1251+

throw new Error("--quality must be one of low, medium, high, or auto");

1252+

}

1253+1254+

function normalizeOpenAIModeration(

1255+

raw: string | undefined,

1256+

): ImageGenerationOpenAIModeration | undefined {

1257+

const normalized = normalizeLowercaseStringOrEmpty(raw);

1258+

if (!normalized) {

1259+

return undefined;

1260+

}

1261+

if (normalized === "low" || normalized === "auto") {

1262+

return normalized;

1263+

}

1264+

throw new Error("--openai-moderation must be one of low or auto");

1265+

}

1266+12191267

function normalizeVideoResolution(raw: string | undefined): VideoGenerationResolution | undefined {

12201268

const normalized = raw?.trim().toUpperCase();

12211269

if (!normalized) {

@@ -2229,6 +2277,8 @@ export function registerCapabilityCli(program: Command) {

22292277

.option("--output-format <format>", "Output format hint: png, jpeg, or webp")

22302278

.option("--background <value>", "Background hint: transparent, opaque, or auto")

22312279

.option("--openai-background <value>", "OpenAI background hint: transparent, opaque, or auto")

2280+

.option("--openai-moderation <value>", "OpenAI moderation hint: low or auto")

2281+

.option("--quality <value>", "Quality hint: low, medium, high, or auto")

22322282

.option("--timeout-ms <ms>", "Provider request timeout in milliseconds")

22332283

.option("--output <path>", "Output path")

22342284

.option("--json", "Output JSON", false)

@@ -2248,6 +2298,8 @@ export function registerCapabilityCli(program: Command) {

22482298

opts.openaiBackground as string | undefined,

22492299

"--openai-background",

22502300

),

2301+

openaiModeration: normalizeOpenAIModeration(opts.openaiModeration as string | undefined),

2302+

quality: normalizeImageQuality(opts.quality as string | undefined),

22512303

timeoutMs: parseOptionalTimeoutMs(opts.timeoutMs),

22522304

output: opts.output as string | undefined,

22532305

});

@@ -2267,6 +2319,8 @@ export function registerCapabilityCli(program: Command) {

22672319

.option("--output-format <format>", "Output format hint: png, jpeg, or webp")

22682320

.option("--background <value>", "Background hint: transparent, opaque, or auto")

22692321

.option("--openai-background <value>", "OpenAI background hint: transparent, opaque, or auto")

2322+

.option("--openai-moderation <value>", "OpenAI moderation hint: low or auto")

2323+

.option("--quality <value>", "Quality hint: low, medium, high, or auto")

22702324

.option("--timeout-ms <ms>", "Provider request timeout in milliseconds")

22712325

.option("--output <path>", "Output path")

22722326

.option("--json", "Output JSON", false)

@@ -2287,6 +2341,8 @@ export function registerCapabilityCli(program: Command) {

22872341

opts.openaiBackground as string | undefined,

22882342

"--openai-background",

22892343

),

2344+

openaiModeration: normalizeOpenAIModeration(opts.openaiModeration as string | undefined),

2345+

quality: normalizeImageQuality(opts.quality as string | undefined),

22902346

timeoutMs: parseOptionalTimeoutMs(opts.timeoutMs),

22912347

output: opts.output as string | undefined,

22922348

});