mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
Enable Codex goals in provider templates (#3089)
* Enable Codex goals in provider templates * feat: add Codex goal mode toggle - Remove forced goals=true from Codex provider presets and custom templates. - Add a Codex provider editor switch that updates [features].goals on demand. - Update docs, i18n, and regression coverage for the optional Goal mode flow. --------- Co-authored-by: Jason <farion1231@gmail.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parse as parseToml } from "smol-toml";
|
||||
import { getCodexCustomTemplate } from "@/config/codexTemplates";
|
||||
|
||||
describe("Codex custom templates", () => {
|
||||
it("does not force Codex Goal mode in the custom provider template", () => {
|
||||
const template = getCodexCustomTemplate();
|
||||
const parsed = parseToml(template.config) as {
|
||||
features?: { goals?: boolean };
|
||||
model_providers?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
expect(template.auth).toEqual({ OPENAI_API_KEY: "" });
|
||||
expect(parsed.features?.goals).toBeUndefined();
|
||||
expect(parsed.model_providers?.custom).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -24,26 +24,25 @@ describe("TheRouter provider presets", () => {
|
||||
expect(env.ANTHROPIC_DEFAULT_SONNET_MODEL).toBe(
|
||||
"anthropic/claude-sonnet-4.6",
|
||||
);
|
||||
expect(env.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe(
|
||||
"anthropic/claude-opus-4.7",
|
||||
);
|
||||
expect(env.ANTHROPIC_DEFAULT_OPUS_MODEL).toBe("anthropic/claude-opus-4.7");
|
||||
});
|
||||
|
||||
it("uses the OpenAI-compatible v1 endpoint for Codex", () => {
|
||||
const preset = codexProviderPresets.find((item) => item.name === "TheRouter");
|
||||
const preset = codexProviderPresets.find(
|
||||
(item) => item.name === "TheRouter",
|
||||
);
|
||||
|
||||
expect(preset).toBeDefined();
|
||||
expect(preset?.websiteUrl).toBe("https://therouter.ai");
|
||||
expect(preset?.apiKeyUrl).toBe("https://dashboard.therouter.ai");
|
||||
expect(preset?.category).toBe("aggregator");
|
||||
expect(preset?.endpointCandidates).toEqual([
|
||||
"https://api.therouter.ai/v1",
|
||||
]);
|
||||
expect(preset?.endpointCandidates).toEqual(["https://api.therouter.ai/v1"]);
|
||||
expect(preset?.auth).toEqual({ OPENAI_API_KEY: "" });
|
||||
expect(preset?.config).toContain('model_provider = "custom"');
|
||||
expect(preset?.config).toContain("[model_providers.custom]");
|
||||
expect(preset?.config).toContain('name = "therouter"');
|
||||
expect(preset?.config).toContain('model = "openai/gpt-5.3-codex"');
|
||||
expect(preset?.config).not.toContain("goals = true");
|
||||
expect(preset?.config).toContain(
|
||||
'base_url = "https://api.therouter.ai/v1"',
|
||||
);
|
||||
@@ -51,7 +50,9 @@ describe("TheRouter provider presets", () => {
|
||||
});
|
||||
|
||||
it("uses the Gemini-native root endpoint for Gemini", () => {
|
||||
const preset = geminiProviderPresets.find((item) => item.name === "TheRouter");
|
||||
const preset = geminiProviderPresets.find(
|
||||
(item) => item.name === "TheRouter",
|
||||
);
|
||||
|
||||
expect(preset).toBeDefined();
|
||||
expect(preset?.websiteUrl).toBe("https://therouter.ai");
|
||||
|
||||
Reference in New Issue
Block a user