From 87530438c0a40e99faa9beff2ebeabf54f29e762 Mon Sep 17 00:00:00 2001 From: Kalo Chin Date: Sat, 5 Jul 2025 22:09:43 +0900 Subject: [PATCH] Update agent_node.py --- api/core/workflow/nodes/agent/agent_node.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/api/core/workflow/nodes/agent/agent_node.py b/api/core/workflow/nodes/agent/agent_node.py index 5ab17661b7..ee1b1e1dd2 100644 --- a/api/core/workflow/nodes/agent/agent_node.py +++ b/api/core/workflow/nodes/agent/agent_node.py @@ -299,22 +299,7 @@ class AgentNode(ToolNode): ) if uses_sys_files_for_node: - - 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 already stripped once above; ensure it's stripped (idempotent call) history_prompt_messages = _strip_files_from_history(history_prompt_messages) if model_schema: