From 6436e0d82a30c197846ecf29ce103400585ab14b Mon Sep 17 00:00:00 2001 From: Kalo Chin Date: Mon, 7 Jul 2025 23:29:36 +0900 Subject: [PATCH] Minor code cleanup in memory and agent node modules Refactored list comprehension in token_buffer_memory.py for conciseness and added minor formatting improvements in agent_node.py. No functional changes were made. --- api/core/memory/token_buffer_memory.py | 4 +--- api/core/workflow/nodes/agent/agent_node.py | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/core/memory/token_buffer_memory.py b/api/core/memory/token_buffer_memory.py index 5249e1520c..ea04b12ef4 100644 --- a/api/core/memory/token_buffer_memory.py +++ b/api/core/memory/token_buffer_memory.py @@ -109,9 +109,7 @@ class TokenBufferMemory: # If attachment filtering is enabled, filter MessageFile list first. if allowed_upload_ids is not None: - files = [ - f for f in files if f.upload_file_id and str(f.upload_file_id) in allowed_upload_ids - ] + files = [f for f in files if f.upload_file_id and str(f.upload_file_id) in allowed_upload_ids] if files: file_extra_config = None diff --git a/api/core/workflow/nodes/agent/agent_node.py b/api/core/workflow/nodes/agent/agent_node.py index 82130326ba..5f6db692f4 100644 --- a/api/core/workflow/nodes/agent/agent_node.py +++ b/api/core/workflow/nodes/agent/agent_node.py @@ -36,6 +36,7 @@ from extensions.ext_database import db from factories.agent_factory import get_plugin_agent_strategy from models.model import Conversation, NodeFileUsage + class AgentNode(ToolNode): """ Agent Node @@ -256,6 +257,7 @@ class AgentNode(ToolNode): value = cast(dict[str, Any], value) model_instance, model_schema = self._fetch_model(value) history_prompt_messages: list[dict[str, Any]] = [] + # Check if this agent node references sys.files def _input_uses_sys_files(_agent_input): if _agent_input.type == "variable":