Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: duckduckgo image search not work (#9821)

非法操作ac9f1e9de596
diff --git a/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_img.py b/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_img.py
index 3173fb9e13c..54bb38755a5 100644
--- a/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_img.py
+++ b/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_img.py
@@ -2,7 +2,6 @@ from typing import Any
from duckduckgo_search import DDGS
-from core.file.models import FileTransferMethod
from core.tools.entities.tool_entities import ToolInvokeMessage
from core.tools.tool.builtin_tool import BuiltinTool
@@ -20,11 +19,9 @@ class DuckDuckGoImageSearchTool(BuiltinTool):
"max_results": tool_parameters.get("max_results"),
}
response = DDGS().images(**query_dict)
- result = []
+ markdown_result = "\n\n"
+ json_result = []
for res in response:
- res["transfer_method"] = FileTransferMethod.REMOTE_URL
- msg = ToolInvokeMessage(
- type=ToolInvokeMessage.MessageType.IMAGE_LINK, message=res.get("image"), save_as="", meta=res
- )
- result.append(msg)
- return result
+ markdown_result += f"![{res.get('title') or ''}]({res.get('image') or ''})"
+ json_result.append(self.create_json_message(res))
+ return [self.create_text_message(markdown_result)] + json_result