mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-20 12:39:14 +08:00
fix: summary and create_file_by_url
This commit is contained in:
parent
fb44cd87e7
commit
b10d6051ba
@ -242,11 +242,13 @@ class PluginInvokeSummaryApi(Resource):
|
|||||||
def post(self, user_model: Account | EndUser, tenant_model: Tenant, payload: RequestInvokeSummary):
|
def post(self, user_model: Account | EndUser, tenant_model: Tenant, payload: RequestInvokeSummary):
|
||||||
try:
|
try:
|
||||||
return BaseBackwardsInvocationResponse(
|
return BaseBackwardsInvocationResponse(
|
||||||
data=PluginModelBackwardsInvocation.invoke_summary(
|
data={
|
||||||
user_id=user_model.id,
|
"summary": PluginModelBackwardsInvocation.invoke_summary(
|
||||||
tenant=tenant_model,
|
user_id=user_model.id,
|
||||||
payload=payload,
|
tenant=tenant_model,
|
||||||
)
|
payload=payload,
|
||||||
|
)
|
||||||
|
}
|
||||||
).model_dump()
|
).model_dump()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return BaseBackwardsInvocationResponse(error=str(e)).model_dump()
|
return BaseBackwardsInvocationResponse(error=str(e)).model_dump()
|
||||||
|
@ -8,9 +8,8 @@ from mimetypes import guess_extension, guess_type
|
|||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from httpx import get
|
|
||||||
|
|
||||||
from configs import dify_config
|
from configs import dify_config
|
||||||
|
from core.helper import ssrf_proxy
|
||||||
from extensions.ext_database import db
|
from extensions.ext_database import db
|
||||||
from extensions.ext_storage import storage
|
from extensions.ext_storage import storage
|
||||||
from models.model import MessageFile
|
from models.model import MessageFile
|
||||||
@ -94,7 +93,7 @@ class ToolFileManager:
|
|||||||
) -> ToolFile:
|
) -> ToolFile:
|
||||||
# try to download image
|
# try to download image
|
||||||
try:
|
try:
|
||||||
response = get(file_url)
|
response = ssrf_proxy.get(file_url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
blob = response.content
|
blob = response.content
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -30,9 +30,6 @@ class ToolFileMessageTransformer:
|
|||||||
):
|
):
|
||||||
# try to download image
|
# try to download image
|
||||||
try:
|
try:
|
||||||
if not conversation_id:
|
|
||||||
raise
|
|
||||||
|
|
||||||
assert isinstance(message.message, ToolInvokeMessage.TextMessage)
|
assert isinstance(message.message, ToolInvokeMessage.TextMessage)
|
||||||
|
|
||||||
file = ToolFileManager.create_file_by_url(
|
file = ToolFileManager.create_file_by_url(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user