Skip to content

Commit

Permalink
处理dalle3图片读取
Browse files Browse the repository at this point in the history
  • Loading branch information
Scorpion1221 committed Aug 6, 2024
1 parent 5220c4b commit 878ace8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/core/tools/utils/message_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def transform_tool_invoke_messages(cls, messages: list[ToolInvokeMessage],
file_var: FileVar = message.meta.get('file_var')
if file_var:
if file_var.transfer_method == FileTransferMethod.TOOL_FILE:
url = file_var.url if file_var.url is not None else cls.get_tool_file_url(file_var.related_id, file_var.extension)
# url = cls.get_tool_file_url(file_var.related_id, file_var.extension)
url = cls.get_tool_file_url(file_var.related_id, file_var.extension)
if file_var.type == FileType.IMAGE:
result.append(ToolInvokeMessage(
type=ToolInvokeMessage.MessageType.IMAGE_LINK,
Expand All @@ -107,4 +106,6 @@ def transform_tool_invoke_messages(cls, messages: list[ToolInvokeMessage],

@classmethod
def get_tool_file_url(cls, tool_file_id: str, extension: str) -> str:
return f'/files/tools/{tool_file_id}{extension or ".bin"}'
sign_url = ToolFileManager.sign_file(tool_file_id=tool_file_id, extension=extension)
return sign_url
# return f'/files/tools/{tool_file_id}{extension or ".bin"}'

0 comments on commit 878ace8

Please sign in to comment.