mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 21:30:17 +08:00
fix(hermes): prevent YAML pollution and drop of OAuth mcp auth
DeepLink Hermes import was emitting camelCase (baseUrl / apiKey / apiMode) that the Hermes runtime does not recognise, poisoning `custom_providers:` entries on activation. The MCP sync path was also stripping `auth: oauth` on round-trip, silently downgrading OAuth-type servers to unauthenticated calls. The Hermes deeplink branch now emits snake_case via a dedicated builder; `sanitize_hermes_provider_keys` runs on both `set_provider` and `get_providers` so legacy DB records heal on next access. `HERMES_EXTRA_FIELDS` preserves `auth`. The `api_mode` dropdown gains `codex_responses` (Copilot / OpenCode), and the schema-migrated warning copy no longer hard-codes "v12" (upstream `_config_version` is now 19).
This commit is contained in:
@@ -63,7 +63,7 @@ function getWarningText(
|
||||
case "schema_migrated_v12":
|
||||
return t("hermes.health.schemaMigratedV12", {
|
||||
defaultValue:
|
||||
"Hermes moved some providers into the 'providers:' dict. CC Switch only manages 'custom_providers:' — edit or remove those entries via Hermes Web UI.",
|
||||
"Hermes' newer schema moved some providers into the 'providers:' dict. CC Switch only manages 'custom_providers:' — edit or remove those entries via Hermes Web UI.",
|
||||
});
|
||||
default:
|
||||
return fallback;
|
||||
|
||||
@@ -45,7 +45,10 @@ export interface HermesSuggestedDefaults {
|
||||
}
|
||||
|
||||
/** Hermes custom_provider protocol mode (optional; auto-detected when omitted). */
|
||||
export type HermesApiMode = "chat_completions" | "anthropic_messages";
|
||||
export type HermesApiMode =
|
||||
| "chat_completions"
|
||||
| "anthropic_messages"
|
||||
| "codex_responses";
|
||||
|
||||
/**
|
||||
* Form-facing value used by the API Mode dropdown.
|
||||
@@ -70,6 +73,7 @@ export const hermesApiModes: Array<{
|
||||
value: "anthropic_messages",
|
||||
labelKey: "hermes.form.apiModeAnthropicMessages",
|
||||
},
|
||||
{ value: "codex_responses", labelKey: "hermes.form.apiModeCodexResponses" },
|
||||
];
|
||||
|
||||
export interface HermesProviderPreset {
|
||||
|
||||
@@ -1653,6 +1653,7 @@
|
||||
"apiModeAuto": "Auto-detect",
|
||||
"apiModeChatCompletions": "OpenAI Chat Completions",
|
||||
"apiModeAnthropicMessages": "Anthropic Messages",
|
||||
"apiModeCodexResponses": "Codex Responses (Copilot / OpenCode)",
|
||||
"models": "Models",
|
||||
"addModel": "Add model",
|
||||
"noModels": "No models configured. Switching to this provider won't change the default model.",
|
||||
@@ -1684,7 +1685,7 @@
|
||||
"modelDefaultNotInProvider": "model.default is not in the selected provider's models list.",
|
||||
"duplicateProviderName": "custom_providers contains duplicate provider names — only one entry will be used.",
|
||||
"duplicateProviderBaseUrl": "custom_providers contains duplicate base_urls — possible accidental copy.",
|
||||
"schemaMigratedV12": "Hermes moved some providers into the 'providers:' dict. CC Switch only manages 'custom_providers:' — edit or remove those entries via Hermes Web UI."
|
||||
"schemaMigratedV12": "Hermes' newer schema moved some providers into the 'providers:' dict. CC Switch only manages 'custom_providers:' — edit or remove those entries via Hermes Web UI."
|
||||
},
|
||||
"memory": {
|
||||
"title": "Memory",
|
||||
|
||||
@@ -1653,6 +1653,7 @@
|
||||
"apiModeAuto": "自動検出",
|
||||
"apiModeChatCompletions": "OpenAI Chat Completions",
|
||||
"apiModeAnthropicMessages": "Anthropic Messages",
|
||||
"apiModeCodexResponses": "Codex Responses(Copilot / OpenCode)",
|
||||
"models": "モデル一覧",
|
||||
"addModel": "モデルを追加",
|
||||
"noModels": "モデル未設定。このプロバイダーに切り替えてもデフォルトモデルは更新されません。",
|
||||
@@ -1684,7 +1685,7 @@
|
||||
"modelDefaultNotInProvider": "model.default は選択中のプロバイダーのモデル一覧に含まれていません。",
|
||||
"duplicateProviderName": "custom_providers にプロバイダー名の重複があります。1 件のみ有効になります。",
|
||||
"duplicateProviderBaseUrl": "custom_providers に重複した base_url があります。誤ってコピーされた可能性があります。",
|
||||
"schemaMigratedV12": "Hermes は一部のプロバイダーを 'providers:' dict に移しました。CC Switch は 'custom_providers:' のみを管理します。該当する項目は Hermes Web UI で編集・削除してください。"
|
||||
"schemaMigratedV12": "Hermes の新しいスキーマでは一部のプロバイダーが 'providers:' dict に移動しました。CC Switch は 'custom_providers:' のみを管理します。該当する項目は Hermes Web UI で編集・削除してください。"
|
||||
},
|
||||
"memory": {
|
||||
"title": "メモリ",
|
||||
|
||||
@@ -1653,6 +1653,7 @@
|
||||
"apiModeAuto": "自动检测",
|
||||
"apiModeChatCompletions": "OpenAI Chat Completions",
|
||||
"apiModeAnthropicMessages": "Anthropic Messages",
|
||||
"apiModeCodexResponses": "Codex Responses(Copilot / OpenCode)",
|
||||
"models": "模型列表",
|
||||
"addModel": "添加模型",
|
||||
"noModels": "暂无模型配置。切换到此供应商时将不会更新默认模型。",
|
||||
@@ -1684,7 +1685,7 @@
|
||||
"modelDefaultNotInProvider": "model.default 指向的模型不在所选供应商的模型列表中。",
|
||||
"duplicateProviderName": "custom_providers 中存在重复的供应商名,只会有一条生效。",
|
||||
"duplicateProviderBaseUrl": "custom_providers 中存在重复的 base_url,可能是意外复制。",
|
||||
"schemaMigratedV12": "Hermes 把部分供应商移到了 'providers:' dict。CC Switch 只管理 'custom_providers:',请在 Hermes Web UI 编辑或删除这些条目。"
|
||||
"schemaMigratedV12": "Hermes 新版 schema 把部分供应商移到了 'providers:' dict。CC Switch 只管理 'custom_providers:',请在 Hermes Web UI 编辑或删除这些条目。"
|
||||
},
|
||||
"memory": {
|
||||
"title": "记忆管理",
|
||||
|
||||
Reference in New Issue
Block a user