Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Fix: Correct file variable handling for custom tools in workflow (#18427)
liujin-patsnapbc18d4d1b9a3
diff --git a/api/core/workflow/nodes/tool/tool_node.py b/api/core/workflow/nodes/tool/tool_node.pyindex 4c8e13de708..df89b2476df 100644--- a/api/core/workflow/nodes/tool/tool_node.py+++ b/api/core/workflow/nodes/tool/tool_node.py@@ -318,6 +318,33 @@ class ToolNode(BaseNode):json.append(message.message.json_object)elif message.type == ToolInvokeMessage.MessageType.LINK:assert isinstance(message.message, ToolInvokeMessage.TextMessage)++ if message.meta:+ transfer_method = message.meta.get("transfer_method", FileTransferMethod.TOOL_FILE)+ else:+ transfer_method = FileTransferMethod.TOOL_FILE++ tool_file_id = message.message.text.split("/")[-1].split(".")[0]++ with Session(db.engine) as session:+ stmt = select(ToolFile).where(ToolFile.id == tool_file_id)+ tool_file = session.scalar(stmt)+ if tool_file is None:+ raise ToolFileError(f"Tool file {tool_file_id} does not exist")++ mapping = {+ "tool_file_id": tool_file_id,+ "type": file_factory.get_file_type_by_mime_type(tool_file.mimetype),+ "transfer_method": transfer_method,+ "url": message.message.text,+ }++ file = file_factory.build_from_mapping(+ mapping=mapping,+ tenant_id=self.tenant_id,+ )+ files.append(file)+stream_text = f"Link: {message.message.text}\n"text += stream_textyield RunStreamChunkEvent(chunk_content=stream_text, from_variable_selector=[node_id, "text"])