From 8989030db5dacc232fca69af603a43c0cf3aa323 Mon Sep 17 00:00:00 2001 From: Yunado <36465036+Yunado@users.noreply.github.com> Date: Tue, 29 Sep 2026 02:41:30 -0400 Subject: [PATCH] serve: keep image parts in tool/assistant messages Agent clients put screenshots in tool results; flattening non-user messages to text made the model blind to them. The template and images_of already handle them; only the conversion was too strict. --- serve/frontend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serve/frontend.py b/serve/frontend.py index afe01408..d50ccbfc 100644 --- a/serve/frontend.py +++ b/serve/frontend.py @@ -144,7 +144,7 @@ def openai_to_messages(req: dict) -> tuple[list[dict], list[dict] | None, dict]: role = m.get("role") if role == "developer": role = "system" - out = {"role": role, "content": _parts_of(m.get("content")) if role == "user" else _text_of(m.get("content"))} + out = {"role": role, "content": _parts_of(m.get("content")) if role in ("user", "tool", "assistant") else _text_of(m.get("content"))} if m.get("reasoning_content"): out["reasoning_content"] = m["reasoning_content"] if m.get("tool_calls"):