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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Support Video Proxy and TED Embedding (#10819)
Tao Wang9f195df103ea
diff --git a/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_video.py b/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_video.pyindex 29f1d818d39..4b74b223c12 100644--- a/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_video.py+++ b/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_video.py@@ -1,4 +1,4 @@-from typing import Any+from typing import Any, ClassVarfrom duckduckgo_search import DDGS@@ -11,6 +11,17 @@ class DuckDuckGoVideoSearchTool(BuiltinTool):Tool for performing a video search using DuckDuckGo search engine."""+ IFRAME_TEMPLATE: ClassVar[str] = """+<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; \+max-width: 100%; border-radius: 8px;">+ <iframe+ style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"+ src="{src}"+ frameborder="0"+ allowfullscreen>+ </iframe>+</div>"""+def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> list[ToolInvokeMessage]:query_dict = {"keywords": tool_parameters.get("query"),@@ -26,6 +37,9 @@ class DuckDuckGoVideoSearchTool(BuiltinTool):# Remove None values to use API defaultsquery_dict = {k: v for k, v in query_dict.items() if v is not None}+ # Get proxy URL from parameters+ proxy_url = tool_parameters.get("proxy_url", "").strip()+response = DDGS().videos(**query_dict)# Create HTML result with embedded iframes@@ -36,20 +50,21 @@ class DuckDuckGoVideoSearchTool(BuiltinTool):title = res.get("title", "")embed_html = res.get("embed_html", "")description = res.get("description", "")+ content_url = res.get("content", "")- # Modify iframe to be responsive- if embed_html:- # Replace fixed dimensions with responsive wrapper and iframe- embed_html = """-<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; \-max-width: 100%; border-radius: 8px;">- <iframe- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"- src="{src}"- frameborder="0"- allowfullscreen>- </iframe>-</div>""".format(src=res.get("embed_url", ""))+ # Handle TED.com videos+ if not embed_html and "ted.com/talks" in content_url:+ embed_url = content_url.replace("www.ted.com", "embed.ted.com")+ if proxy_url:+ embed_url = f"{proxy_url}{embed_url}"+ embed_html = self.IFRAME_TEMPLATE.format(src=embed_url)++ # Original YouTube/other platform handling+ elif embed_html:+ embed_url = res.get("embed_url", "")+ if proxy_url and embed_url:+ embed_url = f"{proxy_url}{embed_url}"+ embed_html = self.IFRAME_TEMPLATE.format(src=embed_url)markdown_result += f"{title}\n\n"markdown_result += f"{embed_html}\n\n"diff --git a/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_video.yaml b/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_video.yamlindex 1ed6fc0e258..a516d3cb98b 100644--- a/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_video.yaml+++ b/api/core/tools/provider/builtin/duckduckgo/tools/ddgo_video.yaml@@ -1,40 +1,43 @@identity:name: ddgo_video- author: Assistant+ author: Tao Wanglabel:en_US: DuckDuckGo Video Searchzh_Hans: DuckDuckGo 视频搜索description:human:- en_US: Perform video searches on DuckDuckGo and get results with embedded videos.- zh_Hans: 在 DuckDuckGo 上进行视频搜索并获取可嵌入的视频结果。- llm: Perform video searches on DuckDuckGo and get results with embedded videos.+ en_US: Search and embedded videos.+ zh_Hans: 搜索并嵌入视频+ llm: Search videos on duckduckgo and embed videos in iframeparameters:- name: query- type: string- required: truelabel:en_US: Query Stringzh_Hans: 查询语句+ type: string+ required: truehuman_description:en_US: Search Query- zh_Hans: 搜索查询语句。+ zh_Hans: 搜索查询语句llm_description: Key words for searchingform: llm- name: max_results+ label:+ en_US: Max Results+ zh_Hans: 最大结果数量type: numberrequired: truedefault: 3minimum: 1maximum: 10- label:- en_US: Max Results- zh_Hans: 最大结果数量human_description:- en_US: The max results (1-10).- zh_Hans: 最大结果数量(1-10)。+ en_US: The max results (1-10)+ zh_Hans: 最大结果数量(1-10)form: form- name: timelimit+ label:+ en_US: Result Time Limit+ zh_Hans: 结果时间限制type: selectrequired: falseoptions:@@ -54,14 +57,14 @@ parameters:label:en_US: Current Yearzh_Hans: 今年- label:- en_US: Result Time Limit- zh_Hans: 结果时间限制human_description:- en_US: Use when querying results within a specific time range only.+ en_US: Query results within a specific time range onlyzh_Hans: 只查询一定时间范围内的结果时使用form: form- name: duration+ label:+ en_US: Video Duration+ zh_Hans: 视频时长type: selectrequired: falseoptions:@@ -77,10 +80,18 @@ parameters:label:en_US: Long (>20 minutes)zh_Hans: 长视频(>20分钟)- label:- en_US: Video Duration- zh_Hans: 视频时长human_description:en_US: Filter videos by durationzh_Hans: 按时长筛选视频form: form+ - name: proxy_url+ label:+ en_US: Proxy URL+ zh_Hans: 视频代理地址+ type: string+ required: false+ default: ""+ human_description:+ en_US: Proxy URL+ zh_Hans: 视频代理地址+ form: form