From de54aba1e223b1d9aa4feebd197eb3e908d65c30 Mon Sep 17 00:00:00 2001 From: thzxx Date: Fri, 12 Jun 2026 14:18:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20fetch=5Ftop=E6=94=B9=E4=B8=BA=E5=BF=85?= =?UTF-8?q?=E4=BC=A0=EF=BC=8C=E6=9C=80=E4=BD=8E3=E6=9D=A1=EF=BC=8CSearXNG?= =?UTF-8?q?=E5=92=8C=E5=86=85=E7=BD=AE=E5=BC=95=E6=93=8E=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8A=93=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/tool-handlers-system.ts | 2 +- src/renderer/services/tool-registry.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/tool-handlers-system.ts b/src/main/tool-handlers-system.ts index 246817f..9bc772e 100644 --- a/src/main/tool-handlers-system.ts +++ b/src/main/tool-handlers-system.ts @@ -582,7 +582,7 @@ 582| const maxResults = Math.min(params.max_results || 30, 30); 583| const timeRange = params.time_range || ''; 584| const enhanceSnippets = params.enhance_snippets !== false; -585| const fetchTop = Math.min(params.fetch_top || 0, 10); +585| const fetchTop = Math.max(3, Math.min(params.fetch_top || 3, 10)); 586| 587| let result: ToolResult; 588| diff --git a/src/renderer/services/tool-registry.ts b/src/renderer/services/tool-registry.ts index 36a6759..88eda40 100644 --- a/src/renderer/services/tool-registry.ts +++ b/src/renderer/services/tool-registry.ts @@ -345,10 +345,10 @@ export const TOOL_DEFINITIONS: ToolDefinition[] = [ max_results: { type: 'integer', description: 'Maximum number of results to return. Default: 30, max: 30.' }, time_range: { type: 'string', enum: ['day', 'week', 'month', 'year'], description: 'Filter results by time. Supported by Bing and Google. Use for recent news, latest version, etc.' }, enhance_snippets: { type: 'boolean', description: 'Auto-fetch detailed snippet for results with too-short descriptions. Default: true.' }, - fetch_top: { type: 'integer', description: 'Automatically fetch full content from the top N search results. Default: 0 (no auto-fetch). Recommended: 3-5.' } + fetch_top: { type: 'integer', description: 'Number of top results to auto-fetch full content for. Min: 3, max: 10. Results shorter than this are useless — snippets lack detail.' } } - } - } + }, + required: ['query', 'fetch_top'] }, // ══════════════════════════════════════════════ // v4.0 新增工具:记忆和会话管理