fix: summary and create_file_by_url

This commit is contained in:
Yeuoly 2024-12-02 16:51:37 +08:00
parent fb44cd87e7
commit b10d6051ba
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61
3 changed files with 9 additions and 11 deletions

View File

@ -242,11 +242,13 @@ class PluginInvokeSummaryApi(Resource):
def post(self, user_model: Account | EndUser, tenant_model: Tenant, payload: RequestInvokeSummary):
try:
return BaseBackwardsInvocationResponse(
data=PluginModelBackwardsInvocation.invoke_summary(
user_id=user_model.id,
tenant=tenant_model,
payload=payload,
)
data={
"summary": PluginModelBackwardsInvocation.invoke_summary(
user_id=user_model.id,
tenant=tenant_model,
payload=payload,
)
}
).model_dump()
except Exception as e:
return BaseBackwardsInvocationResponse(error=str(e)).model_dump()

View File

@ -8,9 +8,8 @@ from mimetypes import guess_extension, guess_type
from typing import Optional, Union
from uuid import uuid4
from httpx import get
from configs import dify_config
from core.helper import ssrf_proxy
from extensions.ext_database import db
from extensions.ext_storage import storage
from models.model import MessageFile
@ -94,7 +93,7 @@ class ToolFileManager:
) -> ToolFile:
# try to download image
try:
response = get(file_url)
response = ssrf_proxy.get(file_url)
response.raise_for_status()
blob = response.content
except Exception as e:

View File

@ -30,9 +30,6 @@ class ToolFileMessageTransformer:
):
# try to download image
try:
if not conversation_id:
raise
assert isinstance(message.message, ToolInvokeMessage.TextMessage)
file = ToolFileManager.create_file_by_url(