Files
cc-switch/tests/config/hermesMinimaxProviderKey.test.ts
Jason f460410f5d feat(hermes): warn when a provider key is a Hermes built-in provider id
Hermes routes model.provider to its built-in provider whenever the name is a
canonical built-in id (runtime_provider_custom._shadowed_by_builtin), so a card
keyed "deepseek" or "openrouter" is ignored: Hermes asks for the built-in's own
API key env var and never uses the card's endpoint or key. #8538 only fixed the
two MiniMax presets by prefilling cc-switch-minimax.

The provider key field now shows a warning for any of the 52 canonical ids
(generated from hermes-agent rc.3-v0.22.0) and suggests cc-switch-<key>. A
locked key gets a variant that says to re-add the provider under another key.
Aliases such as kimi still reach the custom provider and are not flagged.
Saving is not blocked.
2026-10-20 21:59:20 +08:00

31 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { isHermesBuiltinProviderId } from "@/config/hermesBuiltinProviderIds";
import { hermesProviderPresets } from "@/config/hermesProviderPresets";
describe("Hermes MiniMax presets", () => {
it.each(["MiniMax", "MiniMax en"])(
"%s prefills a provider key that no Hermes built-in shadows",
(name) => {
const preset = hermesProviderPresets.find((p) => p.name === name);
expect(preset).toBeDefined();
const key = preset!.providerKey;
expect(key).toMatch(/^[a-z0-9]+(-[a-z0-9]+)*$/);
expect(isHermesBuiltinProviderId(key!)).toBe(false);
expect(preset!.settingsConfig.name).toBe(key);
expect(preset!.suggestedDefaults?.model.provider).toBe(key);
},
);
it.each(["MiniMax", "MiniMax en"])(
"%s declares image input for MiniMax-M3.1-Flash",
(name) => {
const preset = hermesProviderPresets.find((p) => p.name === name);
const flash = preset!.settingsConfig.models?.find(
(m) => m.id === "MiniMax-M3.1-Flash",
);
expect(flash?.supports_vision).toBe(true);
},
);
});