feat: 重构 WebSearch/WebFetch,新增 Tavily 适配器及 /web-tools 面板

- WebSearch: 默认 Tavily,适配器优先级 WEB_SEARCH_ADAPTER > settings.webSearchAdapter > tavily
- WebFetch: 支持 Tavily /extract 返回 Markdown,移除 domain blacklist 远程检查
- 新增 /web-tools 命令面板(Search/Fetch 双 Tab + 二级配置菜单)
- 新增 settings 字段: webSearchAdapter, webFetchAdapter, tavilyEndpointUrl, braveApiKey, exaApiKey, exaEndpointUrl, webFetchHttpTimeoutMs
- 适配器联动: Tavily/Exa 从 settings 读取 endpoint 和 API key

Co-Authored-By: deepseek-v4-pro <deepseek-ai@claude-code-best.win>
This commit is contained in:
claude-code-best
2026-06-15 15:54:02 +08:00
parent 2714bbf812
commit 9d845d77b9
10 changed files with 1005 additions and 160 deletions

View File

@@ -661,6 +661,54 @@ export const SettingsSchema = lazySchema(() =>
.describe(
'Skip the WebFetch blocklist check for enterprise environments with restrictive security policies',
),
webSearchAdapter: z
.enum(['api', 'bing', 'brave', 'exa', 'tavily'])
.optional()
.describe(
'Web search backend adapter. "tavily" uses Tavily Search API (default), ' +
'"api" uses Anthropic server-side search, "bing" scrapes Bing HTML, ' +
'"brave" uses Brave Search API, "exa" uses Exa AI.',
),
webFetchAdapter: z
.enum(['tavily', 'http'])
.optional()
.describe(
'Web fetch backend. "tavily" uses Tavily Extract API which returns Markdown directly (default), ' +
'"http" fetches the URL directly via HTTP.',
),
tavilyEndpointUrl: z
.string()
.optional()
.describe(
'Custom Tavily API endpoint URL. Defaults to https://tavily.claude-code-best.win. ' +
'Used by both WebSearch and WebFetch when tavily adapter is selected.',
),
braveApiKey: z
.string()
.optional()
.describe(
'Brave Search API key. Required when using the brave web search adapter.',
),
webFetchHttpTimeoutMs: z
.number()
.int()
.positive()
.optional()
.describe(
'HTTP timeout in milliseconds for the HTTP direct web fetch backend. Defaults to 60000 (60s).',
),
exaApiKey: z
.string()
.optional()
.describe(
'Exa AI API key. Required when using the exa web search adapter.',
),
exaEndpointUrl: z
.string()
.optional()
.describe(
'Custom Exa AI MCP endpoint URL. Defaults to https://mcp.exa.ai/mcp.',
),
sandbox: SandboxSettingsSchema().optional(),
feedbackSurveyRate: z
.number()