mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-27 08:14:33 +08:00
b972f0a3bd
Bump the default model IDs across every preset file and the downstream defaults that mirror them: - claude-opus-4-8 / anthropic/claude-opus-4.8 / global.anthropic.claude-opus-4-8 -> claude-opus-5, covering all three naming forms - gpt-5.5 and the bare gpt-5.6 -> gpt-5.6-sol - gemini-3.5-flash -> gemini-3.6-flash Add gemini-3.6-flash to the built-in pricing seed (1.50 in / 7.50 out / 0.15 cache read per million). The seed runs INSERT OR IGNORE on every startup, so existing databases pick the row up without overriding prices the user edited by hand. Advance the Claude Desktop opus route ID in step with the frontend SSOT: CURRENT_OPUS_ROUTE_ID becomes claude-opus-5 and claude-opus-4-8 takes over the LEGACY slot, so route IDs stored in existing user configs still resolve through is_compatible_opus_route_alias. Also sync omo.ts recommendations, form placeholders, the SudoCode partner blurb and all four locales, plus the preset assertions that pin these IDs.
86 lines
3.1 KiB
TypeScript
86 lines
3.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
OPENCODE_PRESET_MODEL_VARIANTS,
|
|
opencodeProviderPresets,
|
|
} from "@/config/opencodeProviderPresets";
|
|
import { openclawProviderPresets } from "@/config/openclawProviderPresets";
|
|
|
|
describe("TheRouter OpenCode and OpenClaw presets", () => {
|
|
it("uses OpenAI-compatible config for OpenCode", () => {
|
|
const preset = opencodeProviderPresets.find(
|
|
(item) => item.name === "TheRouter",
|
|
);
|
|
const models = preset?.settingsConfig.models ?? {};
|
|
|
|
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?.settingsConfig.npm).toBe("@ai-sdk/openai-compatible");
|
|
expect(preset?.settingsConfig.options?.baseURL).toBe(
|
|
"https://api.therouter.ai/v1",
|
|
);
|
|
expect(preset?.settingsConfig.options?.setCacheKey).toBe(true);
|
|
expect(models).toHaveProperty("openai/gpt-5.3-codex");
|
|
expect(models).toHaveProperty("anthropic/claude-sonnet-5");
|
|
expect(models).toHaveProperty("google/gemini-3.6-flash");
|
|
expect(models["google/gemini-3.6-flash"]?.name).toBe("Gemini 3.6 Flash");
|
|
});
|
|
|
|
it("uses OpenAI completions config for OpenClaw", () => {
|
|
const preset = openclawProviderPresets.find(
|
|
(item) => item.name === "TheRouter",
|
|
);
|
|
const openClawModels = preset?.settingsConfig.models ?? [];
|
|
const modelIds = openClawModels.map((model) => model.id);
|
|
|
|
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?.settingsConfig.baseUrl).toBe("https://api.therouter.ai/v1");
|
|
expect(preset?.settingsConfig.api).toBe("openai-completions");
|
|
expect(modelIds).toEqual(
|
|
expect.arrayContaining([
|
|
"anthropic/claude-sonnet-5",
|
|
"openai/gpt-5.3-codex",
|
|
"openai/gpt-5.2",
|
|
"google/gemini-3.6-flash",
|
|
]),
|
|
);
|
|
expect(
|
|
openClawModels.find((model) => model.id === "google/gemini-3.6-flash"),
|
|
).toMatchObject({
|
|
name: "Gemini 3.6 Flash",
|
|
cost: { input: 1.5, output: 9, cacheRead: 0.15 },
|
|
});
|
|
expect(preset?.suggestedDefaults?.model).toEqual({
|
|
primary: "therouter/anthropic/claude-sonnet-5",
|
|
fallbacks: [
|
|
"therouter/openai/gpt-5.2",
|
|
"therouter/google/gemini-3.6-flash",
|
|
],
|
|
});
|
|
});
|
|
|
|
it("keeps Google OpenCode preset model ids unique", () => {
|
|
const googleModels = OPENCODE_PRESET_MODEL_VARIANTS["@ai-sdk/google"];
|
|
const ids = googleModels.map((model) => model.id);
|
|
const geminiFlashModels = googleModels.filter(
|
|
(model) => model.id === "gemini-3.6-flash",
|
|
);
|
|
|
|
expect(new Set(ids).size).toBe(ids.length);
|
|
expect(geminiFlashModels).toHaveLength(1);
|
|
expect(geminiFlashModels[0]).toMatchObject({
|
|
name: "Gemini 3.6 Flash",
|
|
variants: {
|
|
minimal: expect.any(Object),
|
|
low: expect.any(Object),
|
|
medium: expect.any(Object),
|
|
high: expect.any(Object),
|
|
},
|
|
});
|
|
});
|
|
});
|