Commit b5233d0
fix: Image Agent 模式下图片不回显、不调用生成工具的问题
三个连锁 Bug 的根因修复:
1. route.ts — 图片 base64 数据保留
- 之前:文件存盘后一律清空 base64 data(包括图片)
- 现在:只对非图片文件清空 data,图片始终保留 base64
- 确保 SDK 收到有效的 image content block 用于 vision
2. types/index.ts — ClaudeStreamOptions 增加 imageAgentMode 标记
- 新增 imageAgentMode?: boolean 字段
- 由 route.ts 根据 systemPromptAppend 是否存在来设置
3. claude-client.ts — buildFinalPrompt 在 imageAgentMode 下跳过文件路径引用
- imageAgentMode=true 时不添加 [User attached image: /path] 文本
- 防止 Claude 看到路径后调用 analyze_image 等内置工具
- Claude 仅通过 vision(base64 content blocks)看到图片
- 遵循 IMAGE_AGENT_SYSTEM_PROMPT 输出 image-gen-request 块
- 普通模式行为不变,仍保留路径引用供 skill/工具使用
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent d13a039 commit b5233d0
3 files changed
+19
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
| |||
612 | 613 | | |
613 | 614 | | |
614 | 615 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
623 | 631 | | |
624 | 632 | | |
625 | 633 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| 647 | + | |
647 | 648 | | |
648 | 649 | | |
649 | 650 | | |
| |||
0 commit comments