From db3ea5eec2f57e2681b480e8fd7d8d95254374c4 Mon Sep 17 00:00:00 2001 From: xiaotian2333 <1719549416@qq.com> Date: Sat, 14 Feb 2026 15:41:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=8F=98=E4=BD=93=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化GLM-5模型变体的配置 放宽请求超时时间(60->300) --- internal/chat.go | 2 +- internal/model_fetcher.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/chat.go b/internal/chat.go index 296eb3a..e8529fb 100644 --- a/internal/chat.go +++ b/internal/chat.go @@ -288,7 +288,7 @@ func makeUpstreamRequest(token string, messages []Message, model string, imageUR LogDebug("Upstream request: model=%s, messages=%d, XFF=%s", targetModel, len(messages), randomIP) - client := &http.Client{Timeout: 60 * time.Second} + client := &http.Client{Timeout: 300 * time.Second} resp, err := client.Do(req) if err != nil { return nil, "", err diff --git a/internal/model_fetcher.go b/internal/model_fetcher.go index 12940d1..0db7b99 100644 --- a/internal/model_fetcher.go +++ b/internal/model_fetcher.go @@ -164,9 +164,9 @@ func initBuiltinMappings() { DisplayName: "GLM-5", UpstreamModelID: "glm-5", UpstreamModelName: "GLM-5", - EnableThinking: true, - AutoWebSearch: true, - MCPServers: []string{"advanced-search"}, + EnableThinking: false, + AutoWebSearch: false, + MCPServers: []string{}, OwnedBy: "z.ai", IsBuiltin: true, } @@ -175,8 +175,8 @@ func initBuiltinMappings() { UpstreamModelID: "glm-5", UpstreamModelName: "GLM-5-Thinking", EnableThinking: true, - AutoWebSearch: true, - MCPServers: []string{"advanced-search"}, + AutoWebSearch: false, + MCPServers: []string{}, OwnedBy: "z.ai", IsBuiltin: true, } From 6d950bcb0ac5c85394ad54278804d226991f95b6 Mon Sep 17 00:00:00 2001 From: xiaotian2333 <1719549416@qq.com> Date: Thu, 19 Feb 2026 14:53:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8FAPI=5FENDPOINT=E6=B2=A1=E6=9C=89=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E4=BD=BF=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 2 +- internal/chat.go | 4 ++-- internal/config.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 2a67960..79d7a69 100644 --- a/.env.example +++ b/.env.example @@ -7,7 +7,7 @@ PORT=8000 # API 配置 # =================== # API 端点地址 -API_ENDPOINT=https://chat.z.ai/api/chat/completions +API_ENDPOINT=https://chat.z.ai/api/v2/chat/completions # 认证令牌(支持多个,逗号分隔) # 用于验证客户端请求 diff --git a/internal/chat.go b/internal/chat.go index e8529fb..c0ef1ab 100644 --- a/internal/chat.go +++ b/internal/chat.go @@ -172,8 +172,8 @@ func makeUpstreamRequest(token string, messages []Message, model string, imageUR signature := GenerateSignature(userID, requestID, latestUserContent, timestamp) - url := fmt.Sprintf("https://chat.z.ai/api/v2/chat/completions?timestamp=%d&requestId=%s&user_id=%s&version=0.0.1&platform=web&token=%s¤t_url=%s&pathname=%s&signature_timestamp=%d", - timestamp, requestID, userID, token, + url := fmt.Sprintf("%s?timestamp=%d&requestId=%s&user_id=%s&version=0.0.1&platform=web&token=%s¤t_url=%s&pathname=%s&signature_timestamp=%d", + Cfg.APIEndpoint, timestamp, requestID, userID, token, fmt.Sprintf("https://chat.z.ai/c/%s", chatID), fmt.Sprintf("/c/%s", chatID), timestamp) diff --git a/internal/config.go b/internal/config.go index 83e6ff3..8a23606 100644 --- a/internal/config.go +++ b/internal/config.go @@ -111,7 +111,7 @@ func LoadConfig() { Port: getEnvString("PORT", "8000"), // API Configuration - APIEndpoint: getEnvString("API_ENDPOINT", "https://chat.z.ai/api/chat/completions"), + APIEndpoint: getEnvString("API_ENDPOINT", "https://chat.z.ai/api/v2/chat/completions"), AuthTokens: getEnvStringSlice("AUTH_TOKEN"), BackupTokens: getEnvStringSlice("BACKUP_TOKEN"),