claude-code-best/packages/@ant
IronRookieCoder b36e8e4ff2 fix(costrict): handle image input for model compatibility
## Bug 详情
CoStrict 在读取图片后会把图片放在 tool_result.content 中,OpenAI 兼容层只保留文本,导致模型没有收到真实图片内容。

非多模态模型收到图片请求时,后端会返回底层 400 错误,例如 not a multimodal model。

## 根因
OpenAI 消息转换逻辑没有处理 tool_result 中嵌套的 image block。

CoStrict 查询路径没有在发送请求前检查模型的图片输入能力,也没有归一化非多模态模型错误。

## 修复方案
将 tool_result 中的图片转换为后续 user 多模态消息,确保兼容层能传递 image_url。

在 CoStrict 模型元数据明确声明 supportsImages=false 时,提前返回英文错误提示;同时对后端非多模态错误做英文提示归一化。

## 变更要点
- Preserve image blocks nested in tool_result for OpenAI-compatible providers
- Add CoStrict image-capability gate based on supportsImages metadata
- Normalize non-multimodal backend errors to a clear English message
- Add regression tests for nested tool_result images and non-multimodal model handling

## 自测
- bun test src/costrict/provider/index.test.ts
- bun test packages/@ant/model-provider/src/shared/__tests__/openaiConvertMessages.test.ts
2026-05-19 11:38:16 +08:00
..
claude-for-chrome-mcp style: 添加 biome-ignore 消除 noUnusedPrivateClassMembers 警告 2026-05-01 22:01:54 +08:00
computer-use-input style: 格式化 packages/@ant/ 下所有文件以通过 biome ci 2026-05-01 21:55:51 +08:00
computer-use-mcp chore: 合并社区 upstream/main 代码至 v2.4.2 2026-05-12 11:55:04 +08:00
computer-use-swift style: 格式化 packages/@ant/ 下所有文件以通过 biome ci 2026-05-01 21:55:51 +08:00
ink fix(ink): restore Git Bash raw input handling 2026-05-18 17:13:17 +08:00
model-provider fix(costrict): handle image input for model compatibility 2026-05-19 11:38:16 +08:00