mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
feat(codex): support native Responses direct-connect with generated model catalog
Codex providers can now run in two modes per provider: - Proxy-Chat (route takeover): apiFormat=openai_chat, existing Responses<->Chat conversion. Unchanged. - Native-Responses (direct): apiFormat=openai_responses, no proxy. cc-switch generates ~/.codex/cc-switch-model-catalog.json so Codex shows the custom models and tools work without the freeform apply_patch (type=custom) tool that native gateways like MiMo reject; editing falls back to shell_command. Catalog generation is keyed on apiFormat (CodexCatalogToolProfile), decoupled from the takeover toggle, so native providers persist a catalog without enabling local route mapping. Codex's catalog parser requires base_instructions on every entry; the native template carries a neutral default and per-vendor official text overrides it (MiMo, MiniMax). Synthesized catalogs for Qwen/Doubao/LongCat use the neutral default. Existing native providers must be re-saved once to regenerate a valid catalog (no DB migration).
This commit is contained in:
@@ -15,4 +15,38 @@ describe("ProviderForm Codex catalog helpers", () => {
|
||||
{ model: "kimi-k2", contextWindow: 128000 },
|
||||
]);
|
||||
});
|
||||
|
||||
it("preserves native-profile overrides (parallel tool calls + input modalities + base instructions)", () => {
|
||||
expect(
|
||||
normalizeCodexCatalogModelsForSave([
|
||||
{
|
||||
model: "MiniMax-M3",
|
||||
displayName: "MiniMax-M3",
|
||||
contextWindow: 1000000,
|
||||
supportsParallelToolCalls: true,
|
||||
inputModalities: ["text", "image"],
|
||||
baseInstructions:
|
||||
" You are Codex, a coding agent based on MiniMax-M3. ",
|
||||
},
|
||||
// false must be preserved (not dropped as falsy); empty modalities dropped;
|
||||
// empty/whitespace baseInstructions dropped
|
||||
{
|
||||
model: "mimo-v2.5-pro",
|
||||
supportsParallelToolCalls: false,
|
||||
inputModalities: [],
|
||||
baseInstructions: " ",
|
||||
},
|
||||
]),
|
||||
).toEqual([
|
||||
{
|
||||
model: "MiniMax-M3",
|
||||
displayName: "MiniMax-M3",
|
||||
contextWindow: 1000000,
|
||||
supportsParallelToolCalls: true,
|
||||
inputModalities: ["text", "image"],
|
||||
baseInstructions: "You are Codex, a coding agent based on MiniMax-M3.",
|
||||
},
|
||||
{ model: "mimo-v2.5-pro", supportsParallelToolCalls: false },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user