mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-25 16:42:16 +03:00
fix(dashboard): expose custom mode-pack option (#11407)
Validado em lote combinado (batch-0824f, junto de #11399/#11400/#11402) contra o tip de release/v3.8.50: typecheck:core limpo, file-size/changelog/complexity/cognitive-complexity OK, 56/56 testes focados passando incluindo os deste PR (tests/unit/autocombo-unification.test.ts).
Baixo risco: expõe a opção "custom" já suportada em runtime (`getModePack("custom") === undefined`, cai de volta para os pesos explícitos dos sliders) no seletor compartilhado de mode-pack da UI. Obrigado pela contribuição!
This commit is contained in:
@@ -58,6 +58,7 @@ export const DEFAULT_INTELLIGENT_WEIGHTS: IntelligentRoutingWeights = {
|
||||
};
|
||||
|
||||
export const MODE_PACK_OPTIONS = [
|
||||
{ id: "custom", label: "Custom / None (Use Sliders)", emoji: "tune" },
|
||||
{ id: "ship-fast", label: "Ship Fast", emoji: "rocket_launch" },
|
||||
{ id: "cost-saver", label: "Cost Saver", emoji: "savings" },
|
||||
{ id: "quality-first", label: "Quality First", emoji: "target" },
|
||||
|
||||
@@ -2,6 +2,7 @@ import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
const intelligentRouting = await import("../../src/lib/combos/intelligentRouting.ts");
|
||||
const { getModePack } = await import("../../open-sse/services/autoCombo/modePacks.ts");
|
||||
|
||||
test("getStrategyCategory classifies intelligent and deterministic strategies correctly", () => {
|
||||
assert.equal(intelligentRouting.getStrategyCategory("auto"), "intelligent");
|
||||
@@ -155,6 +156,19 @@ test("sidebar visibility excludes the removed auto-combo item", async () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test("custom mode-pack selection preserves explicit slider intent", () => {
|
||||
assert.deepEqual(intelligentRouting.MODE_PACK_OPTIONS[0], {
|
||||
id: "custom",
|
||||
label: "Custom / None (Use Sliders)",
|
||||
emoji: "tune",
|
||||
});
|
||||
assert.equal(
|
||||
intelligentRouting.normalizeIntelligentRoutingConfig({ modePack: "custom" }).modePack,
|
||||
"custom"
|
||||
);
|
||||
assert.equal(getModePack("custom"), undefined);
|
||||
});
|
||||
|
||||
test("intelligent routing helpers normalize config and build provider scores", () => {
|
||||
const normalizedConfig = intelligentRouting.normalizeIntelligentRoutingConfig({
|
||||
candidatePool: ["openai", "anthropic"],
|
||||
|
||||
Reference in New Issue
Block a user