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

推荐订阅源

L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
量子位
V
V2EX
S
SegmentFault 最新的问题
月光博客
月光博客
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
博客园_首页
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
Y
Y Combinator Blog
The Cloudflare Blog
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
腾讯CDC
B
Blog
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed

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: strip opencode image reasoning none · openclaw/openc...
steipete · 2026-04-25 · via Recent Commits to openclaw:main

@@ -95,6 +95,38 @@ function isImageModelNoTextError(err: unknown): boolean {

9595

return err instanceof Error && /^Image model returned no text\b/.test(err.message);

9696

}

979798+

function isPromiseLike(value: unknown): value is PromiseLike<unknown> {

99+

return Boolean(value) && typeof (value as { then?: unknown }).then === "function";

100+

}

101+102+

function composeImageDescriptionPayloadHandlers(

103+

first: ProviderStreamOptions["onPayload"] | undefined,

104+

second: ProviderStreamOptions["onPayload"] | undefined,

105+

): ProviderStreamOptions["onPayload"] | undefined {

106+

if (!first) {

107+

return second;

108+

}

109+

if (!second) {

110+

return first;

111+

}

112+

return (payload, payloadModel) => {

113+

const runSecond = (firstResult: unknown) => {

114+

const nextPayload = firstResult === undefined ? payload : firstResult;

115+

const secondResult = second(nextPayload, payloadModel);

116+

const coerceResult = (resolvedSecond: unknown) =>

117+

resolvedSecond === undefined ? firstResult : resolvedSecond;

118+

return isPromiseLike(secondResult)

119+

? Promise.resolve(secondResult).then(coerceResult)

120+

: coerceResult(secondResult);

121+

};

122+

const firstResult = first(payload, payloadModel);

123+

if (isPromiseLike(firstResult)) {

124+

return Promise.resolve(firstResult).then(runSecond);

125+

}

126+

return runSecond(firstResult);

127+

};

128+

}

129+98130

async function resolveImageRuntime(params: {

99131

cfg: ImageDescriptionRequest["cfg"];

100132

agentDir: string;

@@ -231,8 +263,9 @@ async function resolveMinimaxVlmFallbackRuntime(params: {

231263

};

232264

}

233265234-

export async function describeImagesWithModel(

266+

async function describeImagesWithModelInternal(

235267

params: ImagesDescriptionRequest,

268+

options: { onPayload?: ProviderStreamOptions["onPayload"] } = {},

236269

): Promise<ImagesDescriptionResult> {

237270

const prompt = params.prompt ?? "Describe the image.";

238271

let apiKey: string;

@@ -284,13 +317,15 @@ export async function describeImagesWithModel(

284317

: undefined;

285318286319

const maxTokens = resolveImageToolMaxTokens(model.maxTokens, params.maxTokens ?? 512);

287-

const completeImage = async (onPayload?: ProviderStreamOptions["onPayload"]) =>

288-

await complete(model, context, {

320+

const completeImage = async (onPayload?: ProviderStreamOptions["onPayload"]) => {

321+

const payloadHandler = composeImageDescriptionPayloadHandlers(onPayload, options.onPayload);

322+

return await complete(model, context, {

289323

apiKey,

290324

maxTokens,

291325

signal: controller.signal,

292-

...(onPayload ? { onPayload } : {}),

326+

...(payloadHandler ? { onPayload: payloadHandler } : {}),

293327

});

328+

};

294329295330

try {

296331

const message = await completeImage();

@@ -319,6 +354,19 @@ export async function describeImagesWithModel(

319354

}

320355

}

321356357+

export async function describeImagesWithModel(

358+

params: ImagesDescriptionRequest,

359+

): Promise<ImagesDescriptionResult> {

360+

return await describeImagesWithModelInternal(params);

361+

}

362+363+

export async function describeImagesWithModelPayloadTransform(

364+

params: ImagesDescriptionRequest,

365+

onPayload: ProviderStreamOptions["onPayload"],

366+

): Promise<ImagesDescriptionResult> {

367+

return await describeImagesWithModelInternal(params, { onPayload });

368+

}

369+322370

export async function describeImageWithModel(

323371

params: ImageDescriptionRequest,

324372

): Promise<ImageDescriptionResult> {

@@ -342,3 +390,31 @@ export async function describeImageWithModel(

342390

cfg: params.cfg,

343391

});

344392

}

393+394+

export async function describeImageWithModelPayloadTransform(

395+

params: ImageDescriptionRequest,

396+

onPayload: ProviderStreamOptions["onPayload"],

397+

): Promise<ImageDescriptionResult> {

398+

return await describeImagesWithModelPayloadTransform(

399+

{

400+

images: [

401+

{

402+

buffer: params.buffer,

403+

fileName: params.fileName,

404+

mime: params.mime,

405+

},

406+

],

407+

model: params.model,

408+

provider: params.provider,

409+

prompt: params.prompt,

410+

maxTokens: params.maxTokens,

411+

timeoutMs: params.timeoutMs,

412+

profile: params.profile,

413+

preferredProfile: params.preferredProfile,

414+

authStore: params.authStore,

415+

agentDir: params.agentDir,

416+

cfg: params.cfg,

417+

},

418+

onPayload,

419+

);

420+

}