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

推荐订阅源

J
Java Code Geeks
G
Google Developers Blog
人人都是产品经理
人人都是产品经理
U
Unit 42
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
B
Blog RSS Feed
The Cloudflare Blog
D
Docker
A
About on SuperTechFans
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Y
Y Combinator Blog
月光博客
月光博客
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
博客园_首页
Stack Overflow Blog
Stack Overflow 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
pdf: add Codex instructions for extraction fallback (#513...
anyech · 2026-05-06 · via Recent Commits to openclaw:main

@@ -36,6 +36,7 @@ async function loadCreatePdfTool() {

36363737

const ANTHROPIC_PDF_MODEL = "anthropic/claude-opus-4-6";

3838

const OPENAI_PDF_MODEL = "openai/gpt-5.4-mini";

39+

const CODEX_PDF_MODEL = "openai-codex/gpt-5.4";

3940

const FAKE_PDF_MEDIA = {

4041

kind: "document",

4142

buffer: Buffer.from("%PDF-1.4 fake"),

@@ -85,6 +86,7 @@ async function stubPdfToolInfra(

8586

mockLoad?: boolean;

8687

provider?: string;

8788

input?: string[];

89+

api?: string;

8890

modelFound?: boolean;

8991

},

9092

) {

@@ -102,6 +104,13 @@ async function stubPdfToolInfra(

102104

: () =>

103105

({

104106

provider: params?.provider ?? "anthropic",

107+

api:

108+

params?.api ??

109+

(params?.provider === "openai-codex"

110+

? "openai-codex-responses"

111+

: params?.provider === "openai"

112+

? "openai-responses"

113+

: "anthropic-messages"),

105114

maxTokens: 8192,

106115

input: params?.input ?? ["text", "document"],

107116

}) as never;

@@ -469,6 +478,82 @@ describe("createPdfTool", () => {

469478

content: [{ type: "text", text: "fallback summary" }],

470479

details: { native: false, model: OPENAI_PDF_MODEL },

471480

});

481+

const [, context] = completeMock.mock.calls[0] ?? [];

482+

expect(context?.systemPrompt).toBeUndefined();

483+

});

484+

});

485+486+

it("adds Codex instructions for PDF extraction fallback requests", async () => {

487+

await withTempPdfAgentDir(async (agentDir) => {

488+

await stubPdfToolInfra(agentDir, {

489+

provider: "openai-codex",

490+

api: "openai-codex-responses",

491+

input: ["text", "image"],

492+

});

493+494+

vi.spyOn(pdfExtractModule, "extractPdfContent").mockResolvedValue({

495+

text: "Extracted content",

496+

images: [],

497+

});

498+499+

completeMock.mockResolvedValue({

500+

role: "assistant",

501+

stopReason: "stop",

502+

content: [{ type: "text", text: "codex summary" }],

503+

} as never);

504+505+

const cfg = withPdfModel(CODEX_PDF_MODEL);

506+

const tool = requirePdfTool((await loadCreatePdfTool())({ config: cfg, agentDir }));

507+508+

const result = await tool.execute("t1", {

509+

prompt: "summarize",

510+

pdf: "/tmp/doc.pdf",

511+

});

512+513+

expect(result).toMatchObject({

514+

content: [{ type: "text", text: "codex summary" }],

515+

details: { native: false, model: CODEX_PDF_MODEL },

516+

});

517+

expect(completeMock).toHaveBeenCalledTimes(1);

518+

const [, context] = completeMock.mock.calls[0] ?? [];

519+

expect(context?.systemPrompt).toContain("Analyze the provided PDF content");

520+

});

521+

});

522+523+

it("adds Codex instructions when extraction has images but the model only accepts text", async () => {

524+

await withTempPdfAgentDir(async (agentDir) => {

525+

await stubPdfToolInfra(agentDir, {

526+

provider: "openai-codex",

527+

api: "openai-codex-responses",

528+

input: ["text"],

529+

});

530+531+

vi.spyOn(pdfExtractModule, "extractPdfContent").mockResolvedValue({

532+

text: "Extracted content",

533+

images: [{ type: "image", data: "base64img", mimeType: "image/png" }],

534+

});

535+536+

completeMock.mockResolvedValue({

537+

role: "assistant",

538+

stopReason: "stop",

539+

content: [{ type: "text", text: "codex summary" }],

540+

} as never);

541+542+

const cfg = withPdfModel(CODEX_PDF_MODEL);

543+

const tool = requirePdfTool((await loadCreatePdfTool())({ config: cfg, agentDir }));

544+545+

const result = await tool.execute("t1", {

546+

prompt: "summarize",

547+

pdf: "/tmp/doc.pdf",

548+

});

549+550+

expect(result).toMatchObject({

551+

content: [{ type: "text", text: "codex summary" }],

552+

details: { native: false, model: CODEX_PDF_MODEL },

553+

});

554+

expect(completeMock).toHaveBeenCalledTimes(1);

555+

const [, context] = completeMock.mock.calls[0] ?? [];

556+

expect(context?.systemPrompt).toContain("Analyze the provided PDF content");

472557

});

473558

});

474559