mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
fix: Codex model catalog WYSIWYG and config consolidation
- Remove mergeCodexDefaultCatalogModelForSave implicit injection (P1) The model mapping table is now the single source of truth; no hidden entries are prepended on save. - Sync first catalog row model into config.toml on save Ensures Codex default request model matches the table's first entry instead of retaining a stale template value. - Remove API Format selector from CodexFormFields (P3) wire_api is always 'responses'; the selector confused users into thinking they were changing the upstream protocol. Only the 'Needs Local Routing' toggle remains. - Add restart hint to model mapping i18n text (P2) model_catalog_json is loaded at Codex startup; users are now informed that a restart is needed after changes. - Unify write_codex_live_with_catalog helper (P4) Replaces three scattered prepare+write call sites in config.rs, provider/live.rs, and proxy.rs with a single entry point. - Clean up useCodexConfigState dead state (P3 follow-up) Remove codexModelName, codexContextWindow, codexAutoCompactLimit and their handlers/effects since no component consumes them after the UI consolidation.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizeCodexCatalogModelsForSave } from "@/components/providers/forms/ProviderForm";
|
||||
|
||||
describe("ProviderForm Codex catalog helpers", () => {
|
||||
it("normalizes catalog rows and removes empty or duplicate models", () => {
|
||||
expect(
|
||||
normalizeCodexCatalogModelsForSave([
|
||||
{ model: " deepseek-v4-flash ", displayName: " DeepSeek " },
|
||||
{ model: "deepseek-v4-flash", displayName: "Duplicate" },
|
||||
{ model: "", displayName: "Empty" },
|
||||
{ model: "kimi-k2", contextWindow: "128000 tokens" },
|
||||
]),
|
||||
).toEqual([
|
||||
{ model: "deepseek-v4-flash", displayName: "DeepSeek" },
|
||||
{ model: "kimi-k2", contextWindow: 128000 },
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user