feat: 设置面板添加代理配置 — web_search/web_fetch走HTTP代理(Clash等)

This commit is contained in:
thzxx
2026-06-10 15:38:56 +08:00
parent 3c54f15218
commit 3f11e7c3cd
6 changed files with 50 additions and 1 deletions
+15
View File
@@ -394,6 +394,21 @@ async function init(): Promise<void> {
(document.querySelector('#inputMCPTimeout') as HTMLInputElement).value = mcpTimeout >= 0 ? String(mcpTimeout) : '';
logInit(`超时设置: HTTP=${httpTimeout>=0?httpTimeout:30}s 流式=${streamTimeout>=0?streamTimeout:300}s MCP=${mcpTimeout>=0?mcpTimeout:60}s`);
// ── 代理设置 ──
const proxyUrl = await db.getSetting('proxyUrl', '');
if (proxyUrl) {
try {
await fetch(proxyUrl, { method: 'HEAD', signal: AbortSignal.timeout(2000) });
logInit(`代理: ${proxyUrl}`);
} catch { logInit(`代理: ${proxyUrl} (无法连接,但已设置)`); }
state.set('proxyUrl', proxyUrl);
// 通知主进程设置环境变量
if (bridge?.tool?.setProxy) {
await bridge.tool.setProxy(proxyUrl);
}
}
(document.querySelector('#inputProxyUrl') as HTMLInputElement).value = proxyUrl;
// ── Tool Calling 设置(永久开启,不可关闭)──
state.set('toolCallingEnabled', true);
const runCommandMode = await db.getSetting('runCommandMode', 'confirm') as 'auto' | 'confirm' | 'disabled';