From 3989add60b09efa03c880bff7b4aad4c89fd5e13 Mon Sep 17 00:00:00 2001 From: hex2077 Date: Tue, 3 Mar 2026 01:15:43 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=87=B32.10.4=E5=B9=B6=E7=A7=BB=E9=99=A4iFlow=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新VERSION文件至2.10.4 - 在tls-sidecar中强制日志输出到stdout,避免Node.js误判 - 更新程序时排除tls-sidecar目录 - 增强GrokConverter的模型列表转换逻辑,支持更多数据结构 --- README-JA.md | 17 ++++------------- README-ZH.md | 17 ++++------------- README.md | 17 ++++------------- VERSION | 2 +- src/converters/strategies/GrokConverter.js | 14 +++++++------- src/ui-modules/update-api.js | 3 ++- tls-sidecar/main.go | 3 +++ 7 files changed, 25 insertions(+), 48 deletions(-) diff --git a/README-JA.md b/README-JA.md index e6475da..a7d0c08 100644 --- a/README-JA.md +++ b/README-JA.md @@ -38,8 +38,7 @@ > - **2026.01.26** - Codexプロトコルサポートを追加:OpenAI Codex OAuth認証での接続に対応 > - **2026.01.25** - AI 監視プラグインの強化:AI プロトコル変換前後のリクエストパラメータとレスポンスの監視をサポート。ログ管理の最適化:統一されたログ形式、ビジュアル設定 > - **2026.01.15** - プロバイダープールマネージャーの最適化:非同期リフレッシュキューメカニズム、バッファキュー重複排除、グローバル並行制御、ノードウォームアップと自動期限切れ検出を追加 -> - **2026.01.07** - iFlowプロトコルサポートの追加、OAuth認証方式でQwen、Kimi、DeepSeek、GLMシリーズモデルにアクセス可能、自動トークンリフレッシュ機能をサポート -> - **2026.01.03** - テーマ切替機能を追加し、プロバイダープール初期化を最適化、プロバイダーのデフォルト設定を使用するフォールバック戦略を削除 +> > - **2026.01.03** - テーマ切替機能を追加し、プロバイダープール初期化を最適化、プロバイダーのデフォルト設定を使用するフォールバック戦略を削除 > - **2025.12.30** - メインプロセス管理と自動更新機能を追加 > - **2025.12.25** - 設定ファイル統一管理:すべての設定を `configs/` ディレクトリに集約。Dockerユーザーはマウントパスを `-v "ローカルパス:/app/configs"` に更新が必要 > - **2025.12.11** - Dockerイメージが自動的にビルドされ、Docker Hubで公開されました: [justlikemaki/aiclient-2-api](https://hub.docker.com/r/justlikemaki/aiclient-2-api) @@ -111,12 +110,12 @@ AIClient-2-APIを使い始める最も推奨される方法は、自動起動ス #### 🐳 Docker クイックスタート (推奨) ```bash -docker run -d -p 3000:3000 -p 8085-8087:8085-8087 -p 1455:1455 -p 19876-19880:19876-19880 --restart=always -v "指定パス:/app/configs" --name aiclient2api justlikemaki/aiclient-2-api +docker run -d -p 3000:3000 -p 8085-8086:8085-8086 -p 1455:1455 -p 19876-19880:19876-19880 --restart=always -v "指定パス:/app/configs" --name aiclient2api justlikemaki/aiclient-2-api ``` **パラメータ説明**: - `-d`:バックグラウンドでコンテナを実行 -- `-p 3000:3000 ...`:ポートマッピング。3000はWeb UI用、その他はOAuthコールバック用(Gemini: 8085, Antigravity: 8086, iFlow: 8087, Codex: 1455, Kiro: 19876-19880) +- `-p 3000:3000 ...`:ポートマッピング。3000はWeb UI用、その他はOAuthコールバック用(Gemini: 8085, Antigravity: 8086, Codex: 1455, Kiro: 19876-19880) - `--restart=always`:コンテナ自動再起動ポリシー - `-v "指定パス:/app/configs"`:設定ディレクトリをマウント(「指定パス」を実際のパスに置き換えてください、例:`/home/user/aiclient-configs`) - `--name aiclient2api`:コンテナ名 @@ -292,13 +291,6 @@ curl http://localhost:3000/claude-kiro-oauth/v1/chat/completions \ - `budget_tokens` は `[1024, 24576]` の範囲に制限されます(省略または無効な場合はデフォルトの `20000` が適用されます)。 - トークンの取得/リフレッシュ/プールローテーションメカニズムは変更されません。 -#### iFlow OAuth設定 -1. **初回認証**:Web UIの「設定管理」または「プロバイダープール」ページで、iFlowの「認証生成」ボタンをクリック -2. **電話番号ログイン**:システムがiFlow認証ページを開き、電話番号でログイン認証を完了 -3. **自動保存**:認証成功後、システムは自動的にAPI Keyを取得し認証情報を保存 -4. **サポートモデル**:Qwen3シリーズ、Kimi K2、DeepSeek V3/R1、GLM-4.6/4.7など -5. **自動リフレッシュ**:システムはトークンの期限切れが近づくと自動的にリフレッシュ、手動介入不要 - #### Codex OAuth設定 1. **認証の生成**:Web UIの「プロバイダープール」または「設定管理」ページで、Codexの「認証生成」ボタンをクリック 2. **ブラウザログイン**:システムがOpenAI Codex認証ページを開き、OAuthログインを完了 @@ -335,7 +327,6 @@ curl http://localhost:3000/claude-kiro-oauth/v1/chat/completions \ | **Kiro** | `~/.aws/sso/cache/kiro-auth-token.json` | Kiro認証トークン | | **Qwen** | `~/.qwen/oauth_creds.json` | Qwen OAuth認証情報 | | **Antigravity** | `~/.antigravity/oauth_creds.json` | Antigravity OAuth認証情報 (Claude 4.5 Opus サポート) | -| **iFlow** | `~/.iflow/oauth_creds.json` | iFlow OAuth認証情報 (Qwen、Kimi、DeepSeek、GLM サポート) | | **Codex** | `~/.codex/oauth_creds.json` | Codex OAuth認証情報 | > **説明**:`~`はユーザーホームディレクトリを表します(Windows: `C:\Users\ユーザー名`、Linux/macOS: `/home/ユーザー名`または`/Users/ユーザー名`) @@ -545,7 +536,7 @@ curl http://localhost:3000/ollama/api/chat \ **解決策**: - **ネットワーク接続を確認**:Google、アリババクラウドなどのサービスに正常にアクセスできることを確認 -- **ポート占有を確認**:OAuthコールバックには特定のポートが必要です(Gemini: 8085, Antigravity: 8086, iFlow: 8087, Codex: 1455, Kiro: 19876-19880)、これらのポートが占有されていないことを確認 +- **ポート占有を確認**:OAuthコールバックには特定のポートが必要です(Gemini: 8085, Antigravity: 8086, Codex: 1455, Kiro: 19876-19880)、これらのポートが占有されていないことを確認 - **ブラウザキャッシュをクリア**:シークレットモードを使用するか、ブラウザキャッシュをクリアして再試行 - **ファイアウォール設定を確認**:ファイアウォールがローカルコールバックポートへのアクセスを許可していることを確認 - **Dockerユーザー**:すべてのOAuthコールバックポートが正しくマッピングされていることを確認 diff --git a/README-ZH.md b/README-ZH.md index 66ff990..b82d85d 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -38,8 +38,7 @@ > - **2026.01.26** - 新增 Codex 协议支持:支持 OpenAI Codex OAuth 授权接入 > - **2026.01.25** - 增强 AI 监控插件:支持监控 AI 协议转换前后的请求参数和响应。优化日志管理:统一日志格式,可视化配置 > - **2026.01.15** - 优化提供商池管理器:新增异步刷新队列机制、缓冲队列去重、全局并发控制,支持节点预热和自动过期检测 -> - **2026.01.07** - 新增 iFlow 协议支持,通过 OAuth 认证方式访问 Qwen、Kimi、DeepSeek 和 GLM 系列模型,支持自动 token 刷新功能 -> - **2026.01.03** - 新增主题切换功能并优化提供商池初始化,移除使用提供商默认配置的降级策略 +> > - **2026.01.03** - 新增主题切换功能并优化提供商池初始化,移除使用提供商默认配置的降级策略 > - **2025.12.30** - 添加主进程管理和自动更新功能 > - **2025.12.25** - 配置文件统一管理:所有配置集中到 `configs/` 目录,Docker 用户需更新挂载路径为 `-v "本地路径:/app/configs"` > - **2025.12.11** - Docker 镜像自动构建并发布到 Docker Hub: [justlikemaki/aiclient-2-api](https://hub.docker.com/r/justlikemaki/aiclient-2-api) @@ -110,12 +109,12 @@ #### 🐳 Docker 快捷启动 (推荐) ```bash -docker run -d -p 3000:3000 -p 8085-8087:8085-8087 -p 1455:1455 -p 19876-19880:19876-19880 --restart=always -v "指定路径:/app/configs" --name aiclient2api justlikemaki/aiclient-2-api +docker run -d -p 3000:3000 -p 8085-8086:8085-8086 -p 1455:1455 -p 19876-19880:19876-19880 --restart=always -v "指定路径:/app/configs" --name aiclient2api justlikemaki/aiclient-2-api ``` **参数说明**: - `-d`:后台运行容器 -- `-p 3000:3000 ...`:端口映射。3000 为 Web UI,其余为 OAuth 回调端口(Gemini: 8085, Antigravity: 8086, iFlow: 8087, Codex: 1455, Kiro: 19876-19880) +- `-p 3000:3000 ...`:端口映射。3000 为 Web UI,其余为 OAuth 回调端口(Gemini: 8085, Antigravity: 8086, Codex: 1455, Kiro: 19876-19880) - `--restart=always`:容器自动重启策略 - `-v "指定路径:/app/configs"`:挂载配置目录(请将"指定路径"替换为实际路径,如 `/home/user/aiclient-configs`) - `--name aiclient2api`:容器名称 @@ -291,13 +290,6 @@ curl http://localhost:3000/claude-kiro-oauth/v1/chat/completions \ - `budget_tokens` 被限制在 `[1024, 24576]` 之间(如果省略或无效,默认值为 `20000`)。 - Token 获取/刷新/池轮换机制保持不变。 -#### iFlow OAuth 配置 -1. **首次授权**:在 Web UI 的"配置管理"或"提供商池"页面,点击 iFlow 的"生成授权"按钮 -2. **手机登录**:系统将打开 iFlow 授权页面,使用手机号完成登录验证 -3. **自动保存**:授权成功后,系统会自动获取 API Key 并保存凭据 -4. **支持模型**:Qwen3 系列、Kimi K2、DeepSeek V3/R1、GLM-4.6/4.7 等 -5. **自动刷新**:系统会在 Token 即将过期时自动刷新,无需手动干预 - #### Codex OAuth 配置 1. **生成授权**:在 Web UI 的"提供商池"或"配置管理"页面,点击 Codex 的"生成授权"按钮 2. **浏览器登录**:系统将打开 OpenAI Codex 授权页面,完成 OAuth 登录 @@ -334,7 +326,6 @@ curl http://localhost:3000/claude-kiro-oauth/v1/chat/completions \ | **Kiro** | `~/.aws/sso/cache/kiro-auth-token.json` | Kiro 认证令牌 | | **Qwen** | `~/.qwen/oauth_creds.json` | Qwen OAuth 凭据 | | **Antigravity** | `~/.antigravity/oauth_creds.json` | Antigravity OAuth 凭据 (支持 Claude 4.5 Opus) | -| **iFlow** | `~/.iflow/oauth_creds.json` | iFlow OAuth 凭据 (支持 Qwen、Kimi、DeepSeek、GLM) | | **Codex** | `~/.codex/oauth_creds.json` | Codex OAuth 凭据 | > **说明**:`~` 表示用户主目录(Windows: `C:\Users\用户名`,Linux/macOS: `/home/用户名` 或 `/Users/用户名`) @@ -544,7 +535,7 @@ curl http://localhost:3000/ollama/api/chat \ **解决方案**: - **检查网络连接**:确保能够正常访问 Google、阿里云等服务 -- **检查端口占用**:OAuth 回调需要特定端口(Gemini: 8085, Antigravity: 8086, iFlow: 8087, Codex: 1455, Kiro: 19876-19880),确保这些端口未被占用 +- **检查端口占用**:OAuth 回调需要特定端口(Gemini: 8085, Antigravity: 8086, Codex: 1455, Kiro: 19876-19880),确保这些端口未被占用 - **清除浏览器缓存**:尝试使用无痕模式或清除浏览器缓存后重试 - **检查防火墙设置**:确保防火墙允许本地回调端口的访问 - **Docker 用户**:确保已正确映射所有 OAuth 回调端口 diff --git a/README.md b/README.md index 8bb8394..3b59662 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,7 @@ > - **2026.01.26** - Added Codex protocol support: supports OpenAI Codex OAuth authorization access > - **2026.01.25** - Enhanced AI Monitor plugin: supports monitoring request parameters and responses before and after AI protocol conversion. Optimized log management: unified log format, visual configuration > - **2026.01.15** - Optimized provider pool manager: added async refresh queue mechanism, buffer queue deduplication, global concurrency control, node warmup and automatic expiry detection -> - **2026.01.07** - Added iFlow protocol support, enabling access to Qwen, Kimi, DeepSeek, and GLM series models via OAuth authentication with automatic token refresh -> - **2026.01.03** - Added theme switching functionality and optimized provider pool initialization, removed the fallback strategy of using provider default configuration +> > - **2026.01.03** - Added theme switching functionality and optimized provider pool initialization, removed the fallback strategy of using provider default configuration > - **2025.12.30** - Added main process management and automatic update functionality > - **2025.12.25** - Unified configuration management: All configs centralized to `configs/` directory. Docker users need to update mount path to `-v "local_path:/app/configs"` > - **2025.12.11** - Automatically built Docker images are now available on Docker Hub: [justlikemaki/aiclient-2-api](https://hub.docker.com/r/justlikemaki/aiclient-2-api) @@ -111,12 +110,12 @@ The most recommended way to use AIClient-2-API is to start it through an automat #### 🐳 Docker Quick Start (Recommended) ```bash -docker run -d -p 3000:3000 -p 8085-8087:8085-8087 -p 1455:1455 -p 19876-19880:19876-19880 --restart=always -v "your_path:/app/configs" --name aiclient2api justlikemaki/aiclient-2-api +docker run -d -p 3000:3000 -p 8085-8086:8085-8086 -p 1455:1455 -p 19876-19880:19876-19880 --restart=always -v "your_path:/app/configs" --name aiclient2api justlikemaki/aiclient-2-api ``` **Parameter Description**: - `-d`: Run container in background -- `-p 3000:3000 ...`: Port mapping. 3000 is for Web UI, others are for OAuth callbacks (Gemini: 8085, Antigravity: 8086, iFlow: 8087, Codex: 1455, Kiro: 19876-19880) +- `-p 3000:3000 ...`: Port mapping. 3000 is for Web UI, others are for OAuth callbacks (Gemini: 8085, Antigravity: 8086, Codex: 1455, Kiro: 19876-19880) - `--restart=always`: Container auto-restart policy - `-v "your_path:/app/configs"`: Mount configuration directory (replace "your_path" with actual path, e.g., `/home/user/aiclient-configs`) - `--name aiclient2api`: Container name @@ -292,13 +291,6 @@ Notes: - `budget_tokens` is clamped to `[1024, 24576]` (default `20000` if omitted/invalid). - Token acquisition/refresh/pool rotation is unchanged. -#### iFlow OAuth Configuration -1. **First Authorization**: In Web UI's "Configuration" or "Provider Pools" page, click the "Generate Authorization" button for iFlow -2. **Phone Login**: The system will open the iFlow authorization page, complete login verification using your phone number -3. **Auto Save**: After successful authorization, the system will automatically obtain the API Key and save credentials -4. **Supported Models**: Qwen3 series, Kimi K2, DeepSeek V3/R1, GLM-4.6/4.7, etc. -5. **Auto Refresh**: The system will automatically refresh tokens when they are about to expire, no manual intervention required - #### Codex OAuth Configuration 1. **Generate Authorization**: On the Web UI "Provider Pools" or "Configuration" page, click the "Generate Authorization" button for Codex 2. **Browser Login**: The system opens the OpenAI Codex authorization page to complete OAuth login @@ -335,7 +327,6 @@ Default storage locations for authorization credential files of each service: | **Kiro** | `~/.aws/sso/cache/kiro-auth-token.json` | Kiro authentication token | | **Qwen** | `~/.qwen/oauth_creds.json` | Qwen OAuth credentials | | **Antigravity** | `~/.antigravity/oauth_creds.json` | Antigravity OAuth credentials (supports Claude 4.5 Opus) | -| **iFlow** | `~/.iflow/oauth_creds.json` | iFlow OAuth credentials (supports Qwen, Kimi, DeepSeek, GLM) | | **Codex** | `~/.codex/oauth_creds.json` | Codex OAuth credentials | > **Note**: `~` represents the user home directory (Windows: `C:\Users\username`, Linux/macOS: `/home/username` or `/Users/username`) @@ -545,7 +536,7 @@ When all accounts under a Provider Type (e.g., `gemini-cli-oauth`) are exhausted **Solutions**: - **Check Network Connection**: Ensure you can access Google, Alibaba Cloud, and other services normally -- **Check Port Occupation**: OAuth callbacks require specific ports (Gemini: 8085, Antigravity: 8086, iFlow: 8087, Codex: 1455, Kiro: 19876-19880), ensure these ports are not occupied +- **Check Port Occupation**: OAuth callbacks require specific ports (Gemini: 8085, Antigravity: 8086, Codex: 1455, Kiro: 19876-19880), ensure these ports are not occupied - **Clear Browser Cache**: Try using incognito mode or clearing browser cache and retry - **Check Firewall Settings**: Ensure the firewall allows access to local callback ports - **Docker Users**: Ensure all OAuth callback ports are correctly mapped diff --git a/VERSION b/VERSION index efa8f5a..b52282a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.10.3.3 +2.10.4 diff --git a/src/converters/strategies/GrokConverter.js b/src/converters/strategies/GrokConverter.js index 20a3de4..7fb48f4 100644 --- a/src/converters/strategies/GrokConverter.js +++ b/src/converters/strategies/GrokConverter.js @@ -1120,15 +1120,15 @@ export class GrokConverter extends BaseConverter { * Grok模型列表 -> OpenAI模型列表 */ toOpenAIModelList(grokModels) { - const models = Array.isArray(grokModels) ? grokModels : (grokModels?.models || []); + const models = Array.isArray(grokModels) ? grokModels : (grokModels?.models || grokModels?.data || []); return { object: "list", data: models.map(m => ({ - id: m.id || m.name, + id: m.id || m.name || (typeof m === 'string' ? m : ''), object: "model", created: Math.floor(Date.now() / 1000), owned_by: "xai", - display_name: m.name || m.id, + display_name: m.display_name || m.name || m.id || (typeof m === 'string' ? m : ''), })), }; } @@ -1137,13 +1137,13 @@ export class GrokConverter extends BaseConverter { * Grok模型列表 -> Gemini模型列表 */ toGeminiModelList(grokModels) { - const models = Array.isArray(grokModels) ? grokModels : (grokModels?.models || []); + const models = Array.isArray(grokModels) ? grokModels : (grokModels?.models || grokModels?.data || []); return { models: models.map(m => ({ - name: `models/${m.id || m.name}`, + name: `models/${m.id || m.name || (typeof m === 'string' ? m : '')}`, version: "1.0", - displayName: m.name || m.id, - description: m.description || `Grok model: ${m.name || m.id}`, + displayName: m.display_name || m.name || m.id || (typeof m === 'string' ? m : ''), + description: m.description || `Grok model: ${m.name || m.id || (typeof m === 'string' ? m : '')}`, inputTokenLimit: 131072, outputTokenLimit: 8192, supportedGenerationMethods: ["generateContent", "streamGenerateContent"] diff --git a/src/ui-modules/update-api.js b/src/ui-modules/update-api.js index b0c890f..ce0bb08 100644 --- a/src/ui-modules/update-api.js +++ b/src/ui-modules/update-api.js @@ -422,7 +422,8 @@ async function performTarballUpdate(localVersion, latestTag) { 'configs', // 用户配置目录 'node_modules', // 依赖目录 '.update_temp', // 临时更新目录 - 'logs' // 日志目录 + 'logs', // 日志目录 + 'tls-sidecar' // TLS Sidecar 目录 ]; // 7. 复制新文件到应用目录 diff --git a/tls-sidecar/main.go b/tls-sidecar/main.go index 83f0abc..13415c1 100644 --- a/tls-sidecar/main.go +++ b/tls-sidecar/main.go @@ -174,6 +174,9 @@ func (rt *utlsRoundTripper) CloseIdleConnections() { // ──────────────── Main ──────────────── func main() { + // 强制将日志输出到 Stdout,避免 Node.js 侧将其误判为 Error + log.SetOutput(os.Stdout) + port := defaultPort if p := os.Getenv("TLS_SIDECAR_PORT"); p != "" { if v, err := strconv.Atoi(p); err == nil {