Skip to content

armgit / dify

Public Imported from GitHub
0

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.

Revert "Fix: Correct file variable handling for custom tools in workflow (#24061)

kurokoboc69634085deb
diff --git a/api/core/workflow/nodes/tool/tool_node.py b/api/core/workflow/nodes/tool/tool_node.py
index df89b2476df..4c8e13de708 100644
--- a/api/core/workflow/nodes/tool/tool_node.py
+++ b/api/core/workflow/nodes/tool/tool_node.py
@@ -318,33 +318,6 @@ 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_text
yield RunStreamChunkEvent(chunk_content=stream_text, from_variable_selector=[node_id, "text"])