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.
This commit is contained in:
1 parent
6e1a7be257
commit
8989030db5
1 file changed
+1
-1
+1
-1
@@ -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"):
|
||||
|
||||
Reference in new issue
Block a user