qwen3.6-plus vision model cannot receive image data when used through oc-go-cc
Problem
When switching to a vision-capable model like qwen3.6-plus via /model qwen3.6-plus in Claude Code, sending an image for analysis fails. The model never receives the image data.
Steps to reproduce
- Set
respect_requested_model: truein config /model qwen3.6-plus- Send an image in Claude Code and ask to analyze it
- Image analysis fails — model returns no visual understanding
oc-go-cc logs
streaming completed model=qwen3.6-plus latency=14.89s
No errors in proxy logs. Request completes successfully but image data is not passed through.
Environment
- oc-go-cc: latest binary
- Claude Code: latest
- OpenCode Go: qwen3.6-plus
问题定位
核心 bug 在 internal/transformer/request.go:377-379:
case "image": // Images not supported in text-only models, skip textParts = append(textParts, "[Image]")
当 Anthropic 请求中包含 type: "image" 的 content block 时(base64 图片数据),转换器直接把图片数据丢弃,替换成 "[Image]" 这个纯文本占位符。所以图片到了 Kimi K2.6 就变成了四个字符的 [Image]。
深层原因
问题不止这一处。ChatMessage.Content 在 pkg/types/openai.go:33 被定义为 string 类型:
type ChatMessage struct {
Role string json:"role"
Content string json:"content" // 只能是字符串!
...
}
但 OpenAI/Vision API 的 content 字段需要支持两种格式:
- 纯文本:"content": "hello" 但 OpenAI/Vision API 的 content 字段需要支持两种格式:
- 纯文本:"content": "hello"
- 多模态:"content": [{"type":"text","text":"描述"}, {"type":"image_url","image_url":{"url":"data:image/png;base64,..."}}]
因为 Content 被硬编码为 string,即使 transformUserMessage 尝试保留图片数据,也无法正确序列化成 OpenAI 需要的数组格式。
需要改的地方
- pkg/types/openai.go — 新增 ChatContentPart + ImageURL 类型,将 Content 改为支持双格式(类似已有的 anthropic.go 用 json.RawMessage 的模式)
- internal/transformer/request.go — transformUserMessage 中的 case "image" 把图片 base64 数据转成 OpenAI image_url 格式
- 多个读取 Content 的地方 — 改为使用新的访问器方法 仅供参考