Repository navigation
Commit d9db2de
committed
fix(session): use image part type for images injected from tool results
When providers that don't support media in tool results receive an image
from a tool like Read, the image is extracted from the tool result and
re-injected as a separate user message. This injection used type: "file"
for all media, which is not understood by OpenAI-compatible providers that
expect type: "image" (mapping to image_url in the API).
This caused vision-capable OpenAI-compatible models (e.g., qwen3.5-plus
via @ai-sdk/openai-compatible) to receive file parts they couldn't handle,
even when the user correctly configured image modalities in opencode.json.
Fix: use type: "image" with the data URL for image/* MIME types in the
injected user message. Non-image media (e.g., PDF) continues to use
type: "file" as before.
Fixes anomalyco#157281 parent 98c75be commit d9db2de
1 file changed
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
713 | 720 | | |
714 | 721 | | |
715 | 722 | | |
| |||
0 commit comments