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.

fix(api): handle missing upload_file_id for tool_file messages (#9756)

-LAN-2c26f77a2552
diff --git a/api/models/model.py b/api/models/model.py
index e289423d161..3bd5886d75b 100644
--- a/api/models/model.py
+++ b/api/models/model.py
@@ -977,6 +977,9 @@ class Message(db.Model):
config=FileExtraConfig(),
)
elif message_file.transfer_method == "tool_file":
+ if message_file.upload_file_id is None:
+ assert message_file.url is not None
+ message_file.upload_file_id = message_file.url.split("/")[-1].split(".")[0]
mapping = {
"id": message_file.id,
"type": message_file.type,
@@ -1001,6 +1004,7 @@ class Message(db.Model):
for (file, message_file) in zip(files, message_files)
]
+ db.session.commit()
return result
@property