fix: preserve image paths in fallback and session history

This commit is contained in:
Xubin Ren
2026-03-17 14:33:19 +00:00
committed by Xubin Ren
parent 7086f57d05
commit 8cf11a0291
5 changed files with 82 additions and 62 deletions

View File

@@ -480,7 +480,9 @@ class AgentLoop:
continue # Strip runtime context from multimodal messages
if (c.get("type") == "image_url"
and c.get("image_url", {}).get("url", "").startswith("data:image/")):
filtered.append({"type": "text", "text": "[image]"})
path = (c.get("_meta") or {}).get("path", "")
placeholder = f"[image: {path}]" if path else "[image]"
filtered.append({"type": "text", "text": placeholder})
else:
filtered.append(c)
if not filtered: