Merge branch 'feat/enhance-multi-modal-support' into release/0.10.0-beta
Some checks failed
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled

This commit is contained in:
-LAN- 2024-10-16 19:28:34 +08:00
commit b777aec53a
2 changed files with 7 additions and 2 deletions

View File

@ -37,14 +37,19 @@ class ToolFilePreviewApi(Resource):
except Exception:
raise UnsupportedFileTypeError()
return Response(
response = Response(
stream,
mimetype=tool_file.mimetype,
direct_passthrough=True,
headers={
"Content-Length": str(tool_file.size),
"Content-Disposition": f"attachment; filename={tool_file.name}",
},
)
if tool_file.mimetype.startswith("image"):
response.headers["Content-Disposition"] = f"inline; filename={tool_file.name}"
return response
api.add_resource(ToolFilePreviewApi, "/files/tools/<uuid:file_id>.<string:extension>")

View File

@ -174,7 +174,7 @@ class ToolNode(BaseNode[ToolNodeData]):
if response.type in {ToolInvokeMessage.MessageType.IMAGE_LINK, ToolInvokeMessage.MessageType.IMAGE}:
url = str(response.message) if response.message else None
ext = path.splitext(url)[1] if url else ".bin"
tool_file_id = response.save_as or str(url).split("/")[-1].split(".")[0]
tool_file_id = str(url).split("/")[-1].split(".")[0]
transfer_method = response.meta.get("transfer_method", FileTransferMethod.TOOL_FILE)
with Session(db.engine) as session: