From 6b01901a4a9b752d0106bb389778f4cb580e7e39 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 8 Apr 2026 07:29:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20search=5Fweb.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/agent/tools/impl/search_web.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/agent/tools/impl/search_web.py b/app/agent/tools/impl/search_web.py index 146645d2..2f01703b 100644 --- a/app/agent/tools/impl/search_web.py +++ b/app/agent/tools/impl/search_web.py @@ -27,7 +27,7 @@ class SearchWebInput(BaseModel): ..., description="The search query string to search for on the web" ) max_results: Optional[int] = Field( - 5, + 20, description="Maximum number of search results to return (default: 5, max: 10)", ) @@ -40,10 +40,10 @@ class SearchWebTool(MoviePilotTool): def get_tool_message(self, **kwargs) -> Optional[str]: """根据搜索参数生成友好的提示消息""" query = kwargs.get("query", "") - max_results = kwargs.get("max_results", 5) + max_results = kwargs.get("max_results", 20) return f"正在搜索网络内容: {query} (最多返回 {max_results} 条结果)" - async def run(self, query: str, max_results: Optional[int] = 5, **kwargs) -> str: + async def run(self, query: str, max_results: Optional[int] = 20, **kwargs) -> str: """ 执行网络搜索 """ @@ -53,7 +53,7 @@ class SearchWebTool(MoviePilotTool): try: # 限制最大结果数 - max_results = min(max(1, max_results or 5), 10) + max_results = min(max(1, max_results or 20), 20) results = [] # 1. 优先使用 Exa (如果配置了 API Key) @@ -216,7 +216,7 @@ class SearchWebTool(MoviePilotTool): source = result.get("source", "Unknown") # 裁剪摘要 - max_snippet_length = 500 # 增加到500字符,提供更多上下文 + max_snippet_length = 1000 # 增加到1000字符,提供更多上下文 if len(snippet) > max_snippet_length: snippet = snippet[:max_snippet_length] + "..."