mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 03:46:52 +08:00
fix: DuckDuckGo image search tool error (#5606)
This commit is contained in:
@@ -19,7 +19,11 @@ class DuckDuckGoImageSearchTool(BuiltinTool):
|
||||
"max_results": tool_parameters.get('max_results'),
|
||||
}
|
||||
response = DDGS().images(**query_dict)
|
||||
results = []
|
||||
result = []
|
||||
for res in response:
|
||||
results.append(self.create_image_message(image=res.get("image")))
|
||||
return results
|
||||
msg = ToolInvokeMessage(type=ToolInvokeMessage.MessageType.IMAGE_LINK,
|
||||
message=res.get('image'),
|
||||
save_as='',
|
||||
meta=res)
|
||||
result.append(msg)
|
||||
return result
|
||||
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
from copy import deepcopy
|
||||
from datetime import datetime, timezone
|
||||
from mimetypes import guess_type
|
||||
from typing import Union
|
||||
from typing import Any, Union
|
||||
|
||||
from yarl import URL
|
||||
|
||||
@@ -250,7 +250,7 @@ class ToolEngine:
|
||||
agent_message: Message,
|
||||
invoke_from: InvokeFrom,
|
||||
user_id: str
|
||||
) -> list[tuple[MessageFile, bool]]:
|
||||
) -> list[tuple[Any, str]]:
|
||||
"""
|
||||
Create message file
|
||||
|
||||
@@ -291,7 +291,7 @@ class ToolEngine:
|
||||
db.session.refresh(message_file)
|
||||
|
||||
result.append((
|
||||
message_file,
|
||||
message_file.id,
|
||||
message.save_as
|
||||
))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user