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

推荐订阅源

C
Check Point Blog
美团技术团队
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
月光博客
月光博客
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
J
Java Code Geeks
博客园_首页
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
Vercel News
Vercel News
博客园 - 聂微东

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(media-understanding): normalize HEIC before image des...
luoyanglang · 2026-05-25 · via Recent Commits to openclaw:main

@@ -27,13 +27,15 @@ const hasAvailableAuthForProviderMock = vi.hoisted(() =>

2727

);

2828

const readRemoteMediaBufferMock = vi.hoisted(() => vi.fn());

2929

const runFfmpegMock = vi.hoisted(() => vi.fn());

30+

const convertHeicToJpegMock = vi.hoisted(() => vi.fn());

3031

const runExecMock = vi.hoisted(() => vi.fn());

31323233

let applyMediaUnderstanding: typeof import("./apply.js").applyMediaUnderstanding;

3334

let clearMediaUnderstandingBinaryCacheForTests: typeof import("./runner.js").clearMediaUnderstandingBinaryCacheForTests;

3435

const mockedResolveApiKey = resolveApiKeyForProviderMock;

3536

const mockedReadRemoteMediaBuffer = readRemoteMediaBufferMock;

3637

const mockedRunFfmpeg = runFfmpegMock;

38+

const mockedConvertHeicToJpeg = convertHeicToJpegMock;

3739

const mockedRunExec = runExecMock;

38403941

const TEMP_MEDIA_PREFIX = "openclaw-media-";

@@ -284,6 +286,7 @@ describe("applyMediaUnderstanding", () => {

284286

}));

285287

vi.doMock("../media/media-services.js", () => ({

286288

runFfmpeg: runFfmpegMock,

289+

convertHeicToJpeg: convertHeicToJpegMock,

287290

}));

288291

vi.doMock("../process/exec.js", () => ({

289292

runExec: runExecMock,

@@ -336,6 +339,8 @@ describe("applyMediaUnderstanding", () => {

336339

hasAvailableAuthForProviderMock.mockClear();

337340

mockedReadRemoteMediaBuffer.mockClear();

338341

mockedRunFfmpeg.mockReset();

342+

mockedConvertHeicToJpeg.mockReset();

343+

mockedConvertHeicToJpeg.mockResolvedValue(Buffer.from("jpeg-normalized"));

339344

mockedRunExec.mockReset();

340345

mockedReadRemoteMediaBuffer.mockResolvedValue({

341346

buffer: createSafeAudioFixtureBuffer(2048),

@@ -1160,6 +1165,53 @@ describe("applyMediaUnderstanding", () => {

11601165

);

11611166

});

116211671168+

it("normalizes HEIC images before tools.media.image provider execution", async () => {

1169+

const imagePath = await createTempMediaFile({

1170+

fileName: "photo.heic",

1171+

content: "heic-source",

1172+

});

1173+

const describeImage = vi.fn(async () => ({ text: "normalized image" }));

1174+

const ctx: MsgContext = {

1175+

Body: "<media:image>",

1176+

MediaPath: imagePath,

1177+

MediaType: "image/heic",

1178+

};

1179+

const cfg: OpenClawConfig = {

1180+

tools: {

1181+

media: {

1182+

image: {

1183+

enabled: true,

1184+

models: [{ provider: "openai", model: "gpt-5.4" }],

1185+

},

1186+

},

1187+

},

1188+

};

1189+1190+

const result = await applyMediaUnderstanding({

1191+

ctx,

1192+

cfg,

1193+

agentDir: "/tmp/openclaw-agent",

1194+

providers: {

1195+

openai: {

1196+

id: "openai",

1197+

capabilities: ["image"],

1198+

describeImage,

1199+

},

1200+

},

1201+

});

1202+1203+

expect(result.appliedImage).toBe(true);

1204+

expect(mockedConvertHeicToJpeg).toHaveBeenCalledWith(Buffer.from("heic-source"));

1205+

expect(describeImage).toHaveBeenCalledWith(

1206+

expect.objectContaining({

1207+

buffer: Buffer.from("jpeg-normalized"),

1208+

fileName: "photo.heic",

1209+

mime: "image/jpeg",

1210+

}),

1211+

);

1212+

expect(ctx.Body).toBe("[Image]\nDescription:\nnormalized image");

1213+

});

1214+11631215

it("uses active model when enabled and models are missing", async () => {

11641216

const audioPath = await createTempMediaFile({

11651217

fileName: "fallback.ogg",