mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-25 17:22:27 +08:00
Move first-party, sponsor and relay presets to current model IDs so a pasted Key works without editing the model list. - Claude: opus/sonnet 5 -> 5.5, haiku 4.5 -> 5.5, fable 5 -> 5.1 - GPT: gpt-5.6-sol / gpt-6-sol -> gpt-6.1-sol; add gpt-6-astra/luna - Gemini 3.6 Flash -> 3.8 Flash, 3.1 Pro preview -> 4 Argon; Grok 4.5 -> 4.7; GLM 5.1/5.2 -> 5.3 (+5.3 Flash); DeepSeek V4 Flash -> V4.1 Flash; Doubao 2.1 Pro 260628 -> 260915; StepFun Step Plan -> step-5-preview; add Kimi K3.1 Pro, Qwen3.8 Max, MiniMax M3.1 Flash where the site serves them - Drop retired models: NVIDIA moonshotai/kimi-k3 (EOL 2026-10-15, now kimi-k2.6 without unverified Codex reasoning levels), MiMo V2.5 / V2.5 Pro, Claude Sonnet 4.5, MiniMax M2.7 on Tencent Token Plan Enterprise Pro - Relay presets follow each site's own ID spelling and catalog; DIT.ai, BuyToken and hao.ai are left as configured from their docs; Soshow, SiliconFlow CN, OpenCode Zen and the Ark rolling alias stay - MoArk Codex keeps the tested Kimi-K2.7-Code; K3.1 Pro and Qwen3.8 Max stay out of its Codex catalog until their levels are verified Tests updated to the new IDs; cross-app invariants unchanged.
133 lines
4.1 KiB
TypeScript
133 lines
4.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import {
|
|
getPiModelCatalogReference,
|
|
piModelCatalog,
|
|
} from "@/config/piModelCatalog";
|
|
import { piProviderPresets } from "@/config/piProviderPresets";
|
|
import {
|
|
isPiThinkingLevelMap,
|
|
PI_THINKING_LEVELS,
|
|
piThinkingBindings,
|
|
piThinkingProfiles,
|
|
resolvePiThinkingProfile,
|
|
} from "@/config/piThinkingProfiles";
|
|
|
|
describe("Pi thinking profiles", () => {
|
|
it("keeps valid, non-empty native maps", () => {
|
|
for (const profile of Object.values(piThinkingProfiles)) {
|
|
expect(isPiThinkingLevelMap(profile.map)).toBe(true);
|
|
expect(Object.keys(profile.map).length).toBeGreaterThan(0);
|
|
expect(
|
|
Object.keys(profile.map).every((key) =>
|
|
PI_THINKING_LEVELS.includes(
|
|
key as (typeof PI_THINKING_LEVELS)[number],
|
|
),
|
|
),
|
|
).toBe(true);
|
|
}
|
|
});
|
|
|
|
it("uses only explicit catalog and API bindings", () => {
|
|
for (const binding of piThinkingBindings) {
|
|
expect(resolvePiThinkingProfile(binding)).toEqual({
|
|
profileId: binding.profileId,
|
|
map: { ...piThinkingProfiles[binding.profileId].map },
|
|
...(binding.modelCompat
|
|
? { modelCompat: { ...binding.modelCompat } }
|
|
: {}),
|
|
});
|
|
expect(
|
|
resolvePiThinkingProfile({
|
|
...binding,
|
|
api:
|
|
binding.api === "openai-responses"
|
|
? "openai-completions"
|
|
: "openai-responses",
|
|
}),
|
|
).toBeUndefined();
|
|
}
|
|
});
|
|
|
|
it("materializes preset-local profiles without serializing references", () => {
|
|
const materialized = [];
|
|
for (const preset of piProviderPresets) {
|
|
for (const model of preset.settingsConfig.models) {
|
|
if (!model.thinkingLevelMap) continue;
|
|
const reference = getPiModelCatalogReference(model);
|
|
materialized.push({
|
|
preset: preset.name,
|
|
modelId: model.id,
|
|
profileId: reference?.presetThinkingProfileId,
|
|
map: model.thinkingLevelMap,
|
|
});
|
|
expect(reference).toBeDefined();
|
|
expect(piModelCatalog).toHaveProperty(reference!.catalogKey);
|
|
expect(JSON.parse(JSON.stringify(model))).not.toHaveProperty(
|
|
"presetThinkingProfileId",
|
|
);
|
|
}
|
|
}
|
|
|
|
expect(materialized).toEqual(
|
|
expect.arrayContaining([
|
|
expect.objectContaining({
|
|
preset: "Kimi",
|
|
modelId: "kimi-k2.7-code",
|
|
profileId: "offUnsupported",
|
|
}),
|
|
expect.objectContaining({
|
|
preset: "DeepSeek",
|
|
modelId: "deepseek-v4-pro",
|
|
profileId: "deepseekV4",
|
|
}),
|
|
expect.objectContaining({
|
|
preset: "OpenCode Go",
|
|
modelId: "glm-5.3",
|
|
profileId: "openCodeGoGlm52",
|
|
}),
|
|
expect.objectContaining({
|
|
preset: "AWS Bedrock",
|
|
modelId: "global.anthropic.claude-opus-5",
|
|
profileId: "xhighAndMax",
|
|
}),
|
|
]),
|
|
);
|
|
});
|
|
|
|
it("gives every reasoning preset an explicit map", () => {
|
|
for (const preset of piProviderPresets) {
|
|
for (const model of preset.settingsConfig.models) {
|
|
if (!model.reasoning) continue;
|
|
expect(model).toHaveProperty("thinkingLevelMap");
|
|
expect(isPiThinkingLevelMap(model.thinkingLevelMap)).toBe(true);
|
|
}
|
|
}
|
|
});
|
|
|
|
it("pairs Anthropic adaptive maps with Pi's required compatibility flag", () => {
|
|
const adaptiveModels = piProviderPresets.flatMap((preset) =>
|
|
preset.settingsConfig.api === "anthropic-messages"
|
|
? preset.settingsConfig.models.filter(
|
|
(model) =>
|
|
model.compat?.forceAdaptiveThinking === true &&
|
|
Object.keys(model.thinkingLevelMap ?? {}).length > 0,
|
|
)
|
|
: [],
|
|
);
|
|
|
|
expect(adaptiveModels.length).toBeGreaterThan(0);
|
|
for (const model of adaptiveModels) {
|
|
expect(model.compat).toMatchObject({ forceAdaptiveThinking: true });
|
|
}
|
|
});
|
|
|
|
it("does not add a generic binding for host-sensitive model families", () => {
|
|
expect(
|
|
piThinkingBindings.some((binding) =>
|
|
/^(deepseek|zai|moonshotai)\//.test(binding.catalogKey),
|
|
),
|
|
).toBe(false);
|
|
});
|
|
});
|