Update agent_node.py

pull/21938/head
Kalo Chin 11 months ago
parent 4f733af60f
commit 87530438c0

@ -299,22 +299,7 @@ class AgentNode(ToolNode):
) )
if uses_sys_files_for_node: if uses_sys_files_for_node:
# History already stripped once above; ensure it's stripped (idempotent call)
def _strip_files_from_history(messages: list[dict[str, Any]]) -> list[dict[str, Any]]:
stripped: list[dict[str, Any]] = []
for m in messages:
if m.get("role") == "user" and isinstance(m.get("content"), list):
contents = [
c
for c in m["content"]
if not (isinstance(c, dict) and c.get("type") and c.get("type") != "text")
]
if not contents:
contents = []
m = {**m, "content": contents}
stripped.append(m)
return stripped
history_prompt_messages = _strip_files_from_history(history_prompt_messages) history_prompt_messages = _strip_files_from_history(history_prompt_messages)
if model_schema: if model_schema:

Loading…
Cancel
Save