mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 19:40:42 +00:00
test: curate openrouter live profile signal
This commit is contained in:
@@ -20,6 +20,8 @@ const HIGH_SIGNAL_LIVE_MODEL_PRIORITY = [
|
|||||||
"minimax/minimax-m2.7",
|
"minimax/minimax-m2.7",
|
||||||
"openai/gpt-5.2",
|
"openai/gpt-5.2",
|
||||||
"openai-codex/gpt-5.2",
|
"openai-codex/gpt-5.2",
|
||||||
|
"openrouter/openai/gpt-5.2-chat",
|
||||||
|
"openrouter/minimax/minimax-m2.7",
|
||||||
"opencode-go/glm-5",
|
"opencode-go/glm-5",
|
||||||
"openrouter/ai21/jamba-large-1.7",
|
"openrouter/ai21/jamba-large-1.7",
|
||||||
"xai/grok-4-1-fast-non-reasoning",
|
"xai/grok-4-1-fast-non-reasoning",
|
||||||
@@ -37,6 +39,11 @@ const DEFAULT_HIGH_SIGNAL_LIVE_EXCLUDED_PROVIDERS = new Set(["codex", "codex-cli
|
|||||||
const HIGH_SIGNAL_LIVE_MODEL_PRIORITY_INDEX = new Map<string, number>(
|
const HIGH_SIGNAL_LIVE_MODEL_PRIORITY_INDEX = new Map<string, number>(
|
||||||
HIGH_SIGNAL_LIVE_MODEL_PRIORITY.map((key, index) => [key, index]),
|
HIGH_SIGNAL_LIVE_MODEL_PRIORITY.map((key, index) => [key, index]),
|
||||||
);
|
);
|
||||||
|
const OPENROUTER_HIGH_SIGNAL_LIVE_MODEL_IDS = new Set(
|
||||||
|
HIGH_SIGNAL_LIVE_MODEL_PRIORITY.filter((key) => key.startsWith("openrouter/")).map((key) =>
|
||||||
|
key.slice("openrouter/".length),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
function isHighSignalClaudeModelId(id: string): boolean {
|
function isHighSignalClaudeModelId(id: string): boolean {
|
||||||
const normalized = id.replace(/[_.]/g, "-");
|
const normalized = id.replace(/[_.]/g, "-");
|
||||||
@@ -126,6 +133,13 @@ function isUnsupportedFireworksLiveModelRef(provider: string, id: string): boole
|
|||||||
return !HIGH_SIGNAL_LIVE_MODEL_PRIORITY_INDEX.has(`${provider}/${id}`);
|
return !HIGH_SIGNAL_LIVE_MODEL_PRIORITY_INDEX.has(`${provider}/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isUnsupportedOpenRouterLiveModelRef(provider: string, id: string): boolean {
|
||||||
|
if (provider !== "openrouter") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !OPENROUTER_HIGH_SIGNAL_LIVE_MODEL_IDS.has(id);
|
||||||
|
}
|
||||||
|
|
||||||
export function isModernModelRef(ref: ModelRef): boolean {
|
export function isModernModelRef(ref: ModelRef): boolean {
|
||||||
const provider = normalizeProviderId(ref.provider ?? "");
|
const provider = normalizeProviderId(ref.provider ?? "");
|
||||||
const id = normalizeLowercaseStringOrEmpty(ref.id);
|
const id = normalizeLowercaseStringOrEmpty(ref.id);
|
||||||
@@ -164,6 +178,9 @@ export function isHighSignalLiveModelRef(ref: ModelRef): boolean {
|
|||||||
if (isUnsupportedFireworksLiveModelRef(provider, id)) {
|
if (isUnsupportedFireworksLiveModelRef(provider, id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (isUnsupportedOpenRouterLiveModelRef(provider, id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (isOldMiniMaxLiveModelRef(id)) {
|
if (isOldMiniMaxLiveModelRef(id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -528,6 +528,29 @@ describe("isHighSignalLiveModelRef", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("keeps only curated OpenRouter routes in the default live matrix", () => {
|
||||||
|
providerRuntimeMocks.resolveProviderModernModelRef.mockReturnValue(true);
|
||||||
|
|
||||||
|
expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "openai/gpt-5.2-chat" })).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "minimax/minimax-m2.7" })).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "ai21/jamba-large-1.7" })).toBe(
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
isHighSignalLiveModelRef({ provider: "openrouter", id: "allenai/olmo-3.1-32b-instruct" }),
|
||||||
|
).toBe(false);
|
||||||
|
expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "amazon/nova-lite-v1" })).toBe(
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
expect(isHighSignalLiveModelRef({ provider: "openrouter", id: "amazon/nova-micro-v1" })).toBe(
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it("drops GLM 4.x models from the default live matrix while keeping GLM 5", () => {
|
it("drops GLM 4.x models from the default live matrix while keeping GLM 5", () => {
|
||||||
providerRuntimeMocks.resolveProviderModernModelRef.mockReturnValue(true);
|
providerRuntimeMocks.resolveProviderModernModelRef.mockReturnValue(true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user