refactor(claude-desktop): lock route IDs to sonnet/opus/haiku roles

Adapt to Claude Desktop 1.6259.1+ fail-all validation which only
accepts claude-(sonnet|opus|haiku)-* route IDs. Branded model names
(DeepSeek, Kimi, GLM, etc.) now live in a new labelOverride field
instead of being embedded in route IDs.

- Backend auto-repairs legacy unsafe routes to the next free
  sonnet/opus/haiku slot instead of erroring
- Frontend swaps the free-form route input for a role dropdown plus
  menu display name field
- Add CLAUDE_DESKTOP_ROLE_ROUTE_IDS as the single source of truth
  for role-to-route mapping; presets and form both consume it
- Drop the dead displayName alias on ClaudeDesktopModelRoute and the
  ineffective /v1/models display_name injection (UI ignores it)
- Update i18n (en/ja/zh) and form focus test for the new fields
This commit is contained in:
Jason
2026-05-13 15:22:23 +08:00
parent edf28b6422
commit 84bac6dce6
10 changed files with 493 additions and 233 deletions
+7 -3
View File
@@ -182,8 +182,12 @@
"modelMappingOffHint": "Use this when the provider already exposes and accepts claude-* / anthropic/claude-* model IDs through Anthropic Messages. Claude Desktop connects to the provider directly.",
"modelMappingOnHint": "Claude Desktop currently restricts model IDs. If your provider offers non-Claude models, enable this switch and keep local routing running while in use.",
"routeMapTitle": "Model mapping",
"routeMapHint": "The left field controls the Claude Desktop-visible model ID. 1M only declares 1M context support to Claude Desktop; requested model IDs are sent upstream exactly as entered on the right.",
"routeModelLabel": "Desktop display model",
"routeMapHint": "Choose a model role and CC Switch will generate a Claude Desktop-compatible route automatically. Use the menu display name for branded models such as DeepSeek or Kimi; requested model IDs are sent upstream exactly as entered.",
"routeModelLabel": "Model role",
"routeRoleSonnet": "Sonnet",
"routeRoleOpus": "Opus",
"routeRoleHaiku": "Haiku",
"labelOverrideLabel": "Menu display name",
"upstreamModelLabel": "Requested model",
"supports1mLabel": "Declare 1M",
"supports1mShort": "1M",
@@ -193,7 +197,7 @@
"directModelInvalid": "Direct models must use claude-* / anthropic/claude-* model IDs",
"addModel": "Add model",
"addRoute": "Add model",
"routeInvalid": "Please enter both the Desktop display model and requested model",
"routeInvalid": "Choose a model role and enter the requested model",
"routesRequired": "At least one model mapping is required",
"statusTitle": "Claude Desktop configuration needs attention",
"statusUnsupported": "This platform does not support writing Claude Desktop 3P configuration yet.",
+7 -3
View File
@@ -182,8 +182,12 @@
"modelMappingOffHint": "プロバイダーが Anthropic Messages で claude-* / anthropic/claude-* のモデル ID を公開し、そのまま受け付ける場合に使います。Claude Desktop はプロバイダーへ直接接続します。",
"modelMappingOnHint": "Claude Desktop は現在モデル ID を制限しています。お使いのプロバイダーが Claude 系列以外のモデルを提供する場合、このスイッチを有効にし、使用中はローカルルーティングを起動したままにしてください。",
"routeMapTitle": "モデルマッピング",
"routeMapHint": "左側は Claude Desktop のモデルメニューに表示されるモデル ID です。1M は Claude Desktop に 1M コンテキスト対応を宣言するだけで、上流へのリクエストモデル ID は右側の入力どおりに送信されます。",
"routeModelLabel": "Desktop 表示モデル",
"routeMapHint": "モデル役割を選ぶと、CC Switch が Claude Desktop 互換ルートを自動生成します。DeepSeek や Kimi などのブランド名はメニュー表示名に入れ、実際のリクエストモデルは右側の入力どおりに送信されます。",
"routeModelLabel": "モデル役割",
"routeRoleSonnet": "Sonnet",
"routeRoleOpus": "Opus",
"routeRoleHaiku": "Haiku",
"labelOverrideLabel": "メニュー表示名",
"upstreamModelLabel": "リクエストモデル",
"supports1mLabel": "1M 対応を宣言",
"supports1mShort": "1M",
@@ -193,7 +197,7 @@
"directModelInvalid": "直結モデルは claude-* / anthropic/claude-* のモデル ID を使う必要があります",
"addModel": "モデルを追加",
"addRoute": "モデルを追加",
"routeInvalid": "Desktop 表示モデルとリクエストモデルを入力してください",
"routeInvalid": "モデル役割を選択し、リクエストモデルを入力してください",
"routesRequired": "少なくとも 1 つのモデルマッピングが必要です",
"statusTitle": "Claude Desktop 設定の確認が必要です",
"statusUnsupported": "このプラットフォームでは Claude Desktop 3P 設定の書き込みはまだサポートされていません。",
+7 -3
View File
@@ -182,8 +182,12 @@
"modelMappingOffHint": "适合供应商已经暴露并接受 claude-* / anthropic/claude-* 模型名的 Anthropic Messages API;请求会由 Claude Desktop 直连供应商。",
"modelMappingOnHint": "Claude Desktop 目前对模型 ID 进行了限制,如果您的供应商提供的模型不是 Claude 系列模型,则需要打开本开关,并在使用过程中保持本地路由开启。",
"routeMapTitle": "模型映射",
"routeMapHint": "左侧决定 Claude Desktop 模型菜单里的可见模型 ID1M 只控制是否向 Claude Desktop 声明支持 1M 上下文,实际请求模型按右侧填写内容发送。",
"routeModelLabel": "Desktop 显示模型",
"routeMapHint": "选择模型角色后,CC Switch 会自动生成 Claude Desktop 兼容路由;菜单显示名可以写 DeepSeek、Kimi 等品牌模型,实际请求模型按右侧填写内容发送。",
"routeModelLabel": "模型角色",
"routeRoleSonnet": "Sonnet",
"routeRoleOpus": "Opus",
"routeRoleHaiku": "Haiku",
"labelOverrideLabel": "菜单显示名",
"upstreamModelLabel": "实际请求模型",
"supports1mLabel": "声明支持 1M",
"supports1mShort": "1M",
@@ -193,7 +197,7 @@
"directModelInvalid": "直连模型必须使用 claude-* / anthropic/claude-* 模型名",
"addModel": "添加模型",
"addRoute": "添加模型",
"routeInvalid": "请填写 Desktop 显示模型和实际请求模型",
"routeInvalid": "请选择模型角色并填写实际请求模型",
"routesRequired": "至少填写一个模型映射",
"statusTitle": "Claude Desktop 配置需要检查",
"statusUnsupported": "当前平台暂不支持 Claude Desktop 3P 配置写入。",