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 296eb3a..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) @@ -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/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"), 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, }