mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-04 19:45:34 +08:00
feat(codex): add default model field to provider form
Expose the top-level `model` key of config.toml as an editable field in the Codex provider form, so users can switch to newly released models (e.g. gpt-5.6) without waiting for a preset update — preset updates only affect newly added providers, existing ones keep their saved TOML. The field syncs bidirectionally with the TOML editor (mirroring the base-URL pattern), suggests models from the mapping catalog plus the provider's /models endpoint, and offers a one-click "add to mapping" action when the value is outside a non-empty catalog. Hidden for official providers. Details: - Save-time catalog sync now only backfills the first mapping row into the top-level model when the field was left empty, so the explicit field wins over the implicit row-0 sync - Escape model names (and base_url) with TOML basic-string escaping and strip control characters from field input: /models ids are remote data and unescaped interpolation could inject config.toml lines (e.g. a forged [mcp_servers.*] command) - The strict model-line matcher now recognizes escaped output, empty strings and single-quoted literals, keeping extract/set round-trips stable; deliberately no key-only loose matching (it would misfire on assignment-looking text inside multiline strings) - Invalidate the fetched model list whenever the request identity changes (base URL, full-URL toggle, API key, custom UA) and discard in-flight responses via a sequence guard, so the dropdown never shows a previous provider's models - i18n for zh/en/ja/zh-TW
This commit is contained in:
@@ -1307,6 +1307,11 @@
|
||||
"autoCompactLimitHint": "Auto-compacts history when context reaches this token limit",
|
||||
"modelMetadataAdvanced": "Model Metadata Advanced Options",
|
||||
"modelMetadataAdvancedHint": "Overrides Codex metadata for unknown models; clearing a field removes the matching config.toml entry.",
|
||||
"defaultModelLabel": "Default Model",
|
||||
"defaultModelPlaceholder": "e.g. gpt-5.6",
|
||||
"defaultModelHint": "The model Codex requests by default; change it anytime without waiting for a preset update. If left empty while model mapping is configured, the first mapping row is used.",
|
||||
"defaultModelNotInCatalog": "This model is not in the model mapping, so the Codex /model menu won't list it (direct requests still work).",
|
||||
"addToModelMapping": "Add to mapping",
|
||||
"modelMappingTitle": "Model Mapping",
|
||||
"modelMappingHint": "Generates Codex model_catalog_json so /model can show these third-party model names; entries are saved exactly as listed. Codex must be restarted to refresh the model list after changes.",
|
||||
"addCatalogModel": "Add Model",
|
||||
|
||||
@@ -1307,6 +1307,11 @@
|
||||
"autoCompactLimitHint": "コンテキストトークン数がこのしきい値に達すると履歴を自動圧縮",
|
||||
"modelMetadataAdvanced": "モデルメタデータ詳細オプション",
|
||||
"modelMetadataAdvancedHint": "未知のモデル向けに Codex メタデータを上書きします。空にすると対応する config.toml 設定を削除します。",
|
||||
"defaultModelLabel": "デフォルトモデル",
|
||||
"defaultModelPlaceholder": "例: gpt-5.6",
|
||||
"defaultModelHint": "Codex がデフォルトでリクエストするモデルです。プリセットの更新を待たずにいつでも変更できます。空欄のままモデルマッピングを設定している場合は、マッピングの先頭行が使われます。",
|
||||
"defaultModelNotInCatalog": "このモデルはモデルマッピングにないため、Codex の /model メニューには表示されません(直接リクエストは有効です)。",
|
||||
"addToModelMapping": "マッピングに追加",
|
||||
"modelMappingTitle": "モデルマッピング",
|
||||
"modelMappingHint": "Codex model_catalog_json を生成し、/model コマンドでこれらの第三者モデル名を表示できるようにします。リストの内容はそのまま保存されます。変更後、モデルリストを更新するには Codex の再起動が必要です。",
|
||||
"addCatalogModel": "モデルを追加",
|
||||
|
||||
@@ -1273,6 +1273,11 @@
|
||||
"maxOutputTokensLabel": "最大輸出 tokens",
|
||||
"maxOutputTokensPlaceholder": "留空則使用預設 8192",
|
||||
"maxOutputTokensHint": "Codex 不會把 model_max_output_tokens 寫進請求體,預設上限 8192 容易在長回答或深度思考時被截斷(stop_reason=max_tokens)。此處設定會作為 Anthropic 的 max_tokens 覆蓋請求值。請勿超過該模型/閘道的真實輸出上限,否則可能 400。留空使用預設 8192。",
|
||||
"defaultModelLabel": "預設模型",
|
||||
"defaultModelPlaceholder": "例如: gpt-5.6",
|
||||
"defaultModelHint": "Codex 預設請求的模型,隨時可改,無需等待軟體更新供應商範本。留空且設定了模型映射時,預設使用映射第一行。",
|
||||
"defaultModelNotInCatalog": "該模型不在模型映射中,Codex 的 /model 選單不會列出它(直接請求仍然有效)。",
|
||||
"addToModelMapping": "加入映射",
|
||||
"modelMappingTitle": "模型映射",
|
||||
"modelMappingHint": "產生 Codex model_catalog_json,讓 /model 指令顯示這些第三方模型名;表中條目按填寫內容原樣儲存。修改後需要重新啟動 Codex 才能重新整理模型清單。",
|
||||
"addCatalogModel": "新增模型",
|
||||
|
||||
@@ -1307,6 +1307,11 @@
|
||||
"autoCompactLimitHint": "上下文 token 数达到此阈值时自动压缩历史",
|
||||
"modelMetadataAdvanced": "模型元数据高级选项",
|
||||
"modelMetadataAdvancedHint": "用于未知模型的 Codex 元数据覆盖;清空字段会从 config.toml 删除对应配置。",
|
||||
"defaultModelLabel": "默认模型",
|
||||
"defaultModelPlaceholder": "例如: gpt-5.6",
|
||||
"defaultModelHint": "Codex 默认请求的模型,随时可改,无需等待预设更新。留空且配置了模型映射时,默认使用映射第一行。",
|
||||
"defaultModelNotInCatalog": "该模型不在模型映射中,Codex 的 /model 菜单不会列出它(直接请求仍然有效)。",
|
||||
"addToModelMapping": "加入映射",
|
||||
"modelMappingTitle": "模型映射",
|
||||
"modelMappingHint": "生成 Codex model_catalog_json,让 /model 命令显示这些第三方模型名;表中条目按填写内容原样保存。修改后需要重启 Codex 才能刷新模型列表。",
|
||||
"addCatalogModel": "添加模型",
|
||||
|
||||
Reference in New Issue
Block a user