From 3297ca182105d11abc28e5e4e49df1d6e96750d2 Mon Sep 17 00:00:00 2001 From: Autumn-27 <53844290+Autumn-27@users.noreply.github.com> Date: Sun, 23 Aug 2026 10:41:16 -0400 Subject: [PATCH] =?UTF-8?q?change(llm):=20=E5=87=BA=E7=AB=99=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E7=95=99=E7=A9=BA=3D=E7=9B=B4=E8=BF=9E,=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E5=9B=9E=E9=80=80=20HTTP=5FPROXY=20=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - quotaAwareHTTPClient: proxy 为空时 transport.Proxy=nil(直连), 不再用 http.ProxyFromEnvironment 吃 HTTP_PROXY/HTTPS_PROXY - 前端代理输入:提示可带账号密码(socks5://user:pass@host:port), 文案改为「留空表示不使用代理(直连)」 显式的 ARTEX_LLM_PROXY 环境变量不受影响(仍写入 Config.Proxy)。 Claude-Session: https://claude.ai/code/session_019QXSCDmzimwnjntBNCgUD7 --- agent/provider.go | 7 ++++--- web/src/app/(main)/system/llm/page.tsx | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/agent/provider.go b/agent/provider.go index 6c1c8b5..6011ada 100644 --- a/agent/provider.go +++ b/agent/provider.go @@ -31,8 +31,9 @@ type Config struct { BaseURL string APIKey string Model string - // Proxy routes all LLM requests through the given proxy URL (http/https/socks5). - // Empty falls back to the standard *_PROXY environment variables. + // Proxy routes all LLM requests through the given proxy URL (http/https/socks5, + // optionally with user:pass@ credentials). Empty means direct — it does NOT + // fall back to the standard *_PROXY environment variables. Proxy string // RatePerSecond / RatePerMinute cap the shared request rate across ALL agents // using the provider (0 = that window unlimited). @@ -268,7 +269,7 @@ func quotaAwareHTTPClient(proxy string) (*http.Client, error) { transport := http.DefaultTransport.(*http.Transport).Clone() proxy = strings.TrimSpace(proxy) if proxy == "" { - transport.Proxy = http.ProxyFromEnvironment + transport.Proxy = nil // 留空=直连,不回退 HTTP_PROXY/HTTPS_PROXY 环境变量 } else { proxyURL, err := url.Parse(proxy) if err != nil { diff --git a/web/src/app/(main)/system/llm/page.tsx b/web/src/app/(main)/system/llm/page.tsx index 5ac1e28..2a5db5b 100644 --- a/web/src/app/(main)/system/llm/page.tsx +++ b/web/src/app/(main)/system/llm/page.tsx @@ -522,12 +522,12 @@ function ProfileSheet({ setProxy(e.target.value)} />

- 仅 LLM 出站请求走此代理,支持 http/https/socks5;留空则用环境变量(HTTP_PROXY/HTTPS_PROXY)。 + 仅 LLM 出站请求走此代理,支持 http/https/socks5,可带账号密码(如 socks5://user:pass@host:port,密码含特殊字符需 URL 编码);留空表示不使用代理(直连)。