From 58f74ebad10bfa64d9793a83d8448fcb34fcd8c5 Mon Sep 17 00:00:00 2001 From: Luis Pater Date: Thu, 25 Sep 2025 08:19:45 +0800 Subject: [PATCH] refactor(config): remove `force-gpt-5-codex` option and related handlers - Eliminated the deprecated `force-gpt-5-codex` configuration option from all configs, handlers, and documentation. - Updated examples and README files to reflect the removal. - Streamlined related code by dropping unused fields and logging. --- README.md | 4 ---- README_CN.md | 4 ---- config.example.yaml | 3 --- internal/api/handlers/management/config_basic.go | 8 -------- internal/config/config.go | 3 --- internal/watcher/watcher.go | 3 --- 6 files changed, 25 deletions(-) diff --git a/README.md b/README.md index 9874eb05..fa875291 100644 --- a/README.md +++ b/README.md @@ -277,7 +277,6 @@ The server uses a YAML configuration file (`config.yaml`) located in the project | `auth.providers.*.api-keys` | string[] | [] | Inline API keys consumed by the `config-api-key` provider. | | `api-keys` | string[] | [] | Legacy shorthand for inline API keys. Values are mirrored into the `config-api-key` provider for backwards compatibility. | | `generative-language-api-key` | string[] | [] | List of Generative Language API keys. | -| `force-gpt-5-codex` | bool | false | Force the conversion of GPT-5 calls to GPT-5 Codex. | | `codex-api-key` | object | {} | List of Codex API keys. | | `codex-api-key.api-key` | string | "" | Codex API key. | | `codex-api-key.base-url` | string | "" | Custom Codex API endpoint, if you use a third-party API endpoint. | @@ -353,9 +352,6 @@ generative-language-api-key: - "AIzaSy...03" - "AIzaSy...04" -# Force the conversion of GPT-5 calls to GPT-5 Codex. -force-gpt-5-codex: true - # Codex API keys codex-api-key: - api-key: "sk-atSM..." diff --git a/README_CN.md b/README_CN.md index b0c0e27b..602a6324 100644 --- a/README_CN.md +++ b/README_CN.md @@ -289,7 +289,6 @@ console.log(await claudeResponse.json()); | `auth.providers.*.api-keys` | string[] | [] | `config-api-key` 提供方使用的内联密钥。 | | `api-keys` | string[] | [] | 兼容旧配置的简写,会自动同步到默认 `config-api-key` 提供方。 | | `generative-language-api-key` | string[] | [] | 生成式语言API密钥列表。 | -| `force-gpt-5-codex` | bool | false | 强制将 GPT-5 调用转换成 GPT-5 Codex。 | | `codex-api-key` | object | {} | Codex API密钥列表。 | | `codex-api-key.api-key` | string | "" | Codex API密钥。 | | `codex-api-key.base-url` | string | "" | 自定义的Codex API端点 | @@ -365,9 +364,6 @@ generative-language-api-key: - "AIzaSy...03" - "AIzaSy...04" -# 强制将 GPT-5 调用转换成 GPT-5 Codex. -force-gpt-5-codex: true - # Codex API 密钥 codex-api-key: - api-key: "sk-atSM..." diff --git a/config.example.yaml b/config.example.yaml index 9c8666bc..3ec9f088 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -45,9 +45,6 @@ generative-language-api-key: - "AIzaSy...03" - "AIzaSy...04" -# forces the use of GPT-5 Codex model. -force-gpt-5-codex: true - # Codex API keys codex-api-key: - api-key: "sk-atSM..." diff --git a/internal/api/handlers/management/config_basic.go b/internal/api/handlers/management/config_basic.go index 346e24ff..57af692c 100644 --- a/internal/api/handlers/management/config_basic.go +++ b/internal/api/handlers/management/config_basic.go @@ -12,14 +12,6 @@ func (h *Handler) GetConfig(c *gin.Context) { func (h *Handler) GetDebug(c *gin.Context) { c.JSON(200, gin.H{"debug": h.cfg.Debug}) } func (h *Handler) PutDebug(c *gin.Context) { h.updateBoolField(c, func(v bool) { h.cfg.Debug = v }) } -// ForceGPT5Codex -func (h *Handler) GetForceGPT5Codex(c *gin.Context) { - c.JSON(200, gin.H{"gpt-5-codex": h.cfg.ForceGPT5Codex}) -} -func (h *Handler) PutForceGPT5Codex(c *gin.Context) { - h.updateBoolField(c, func(v bool) { h.cfg.ForceGPT5Codex = v }) -} - // Request log func (h *Handler) GetRequestLog(c *gin.Context) { c.JSON(200, gin.H{"request-log": h.cfg.RequestLog}) } func (h *Handler) PutRequestLog(c *gin.Context) { diff --git a/internal/config/config.go b/internal/config/config.go index 6b543a6b..982d0288 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -47,9 +47,6 @@ type Config struct { // ClaudeKey defines a list of Claude API key configurations as specified in the YAML configuration file. ClaudeKey []ClaudeKey `yaml:"claude-api-key" json:"claude-api-key"` - // ForceGPT5Codex forces the use of GPT-5 Codex model. - ForceGPT5Codex bool `yaml:"force-gpt-5-codex" json:"force-gpt-5-codex"` - // Codex defines a list of Codex API key configurations as specified in the YAML configuration file. CodexKey []CodexKey `yaml:"codex-api-key" json:"codex-api-key"` diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index b07df209..fdc9dab8 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -480,9 +480,6 @@ func (w *Watcher) reloadConfig() bool { if oldConfig.RemoteManagement.AllowRemote != newConfig.RemoteManagement.AllowRemote { log.Debugf(" remote-management.allow-remote: %t -> %t", oldConfig.RemoteManagement.AllowRemote, newConfig.RemoteManagement.AllowRemote) } - if oldConfig.ForceGPT5Codex != newConfig.ForceGPT5Codex { - log.Debugf(" force-gpt-5-codex: %t -> %t", oldConfig.ForceGPT5Codex, newConfig.ForceGPT5Codex) - } } log.Infof("config successfully reloaded, triggering client reload")