Skip to content

Commit

Permalink
fix(api): handle missing upload_file_id for tool_file messages (#9756)
Browse files Browse the repository at this point in the history
  • Loading branch information
laipz8200 authored Oct 24, 2024
1 parent 95dc90e commit 2c26f77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,9 @@ def message_files(self):
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,
Expand All @@ -1001,6 +1004,7 @@ def message_files(self):
for (file, message_file) in zip(files, message_files)
]

db.session.commit()
return result

@property
Expand Down

0 comments on commit 2c26f77

Please sign in to comment.