mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 13:52:09 +03:00
T1 (openai-to-claude.ts): response_format injection for json_schema/json_object T2 (base.ts): intra-URL retry for 429 errors (2x, 2s delay) T3 (gemini-cli.ts): CLI fingerprint headers (User-Agent, X-Goog-Api-Client) T5 (modelFamilyFallback.ts + chatCore.ts): intra-family model fallback on 400/404 T9 (pricing.ts): deepseek-3.1, deepseek-3.2, qwen3-coder-next pricing T10 (scoring.ts + modePacks.ts): tierPriority as 7th scoring factor (Ultra>Pro>Free) T12 (cliRuntime.ts): isSafePath() guard for CLI_*_BIN env var paths
69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
/**
|
|
* Mode Packs — Pre-defined weight profiles for Auto-Combo scoring.
|
|
*
|
|
* Each pack optimizes for a different priority:
|
|
* - ship-fast: Prioritize latency and health
|
|
* - cost-saver: Prioritize cost efficiency
|
|
* - quality-first: Prioritize task fitness and stability
|
|
* - offline-friendly: Prioritize quota availability
|
|
*/
|
|
|
|
import type { ScoringWeights } from "./scoring";
|
|
|
|
export const MODE_PACKS: Record<string, ScoringWeights> = {
|
|
// Prioritize latency → health. tierPriority replaces 0.05 from stability.
|
|
"ship-fast": {
|
|
quota: 0.15,
|
|
health: 0.3,
|
|
costInv: 0.05,
|
|
latencyInv: 0.35,
|
|
taskFit: 0.1,
|
|
stability: 0.0,
|
|
tierPriority: 0.05,
|
|
},
|
|
// Prioritize cost. tierPriority replaces 0.05 from stability.
|
|
"cost-saver": {
|
|
quota: 0.15,
|
|
health: 0.2,
|
|
costInv: 0.4,
|
|
latencyInv: 0.05,
|
|
taskFit: 0.1,
|
|
stability: 0.05,
|
|
tierPriority: 0.05,
|
|
},
|
|
// Prioritize task fitness. tierPriority replaces 0.05 from latencyInv.
|
|
"quality-first": {
|
|
quota: 0.1,
|
|
health: 0.2,
|
|
costInv: 0.05,
|
|
latencyInv: 0.05,
|
|
taskFit: 0.4,
|
|
stability: 0.15,
|
|
tierPriority: 0.05,
|
|
},
|
|
// Prioritize quota availability. tierPriority replaces 0.05 from taskFit.
|
|
"offline-friendly": {
|
|
quota: 0.4,
|
|
health: 0.3,
|
|
costInv: 0.1,
|
|
latencyInv: 0.05,
|
|
taskFit: 0.0,
|
|
stability: 0.1,
|
|
tierPriority: 0.05,
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Get a mode pack by name, falling back to default weights.
|
|
*/
|
|
export function getModePack(name: string): ScoringWeights | undefined {
|
|
return MODE_PACKS[name];
|
|
}
|
|
|
|
/**
|
|
* Get all available mode pack names.
|
|
*/
|
|
export function getModePackNames(): string[] {
|
|
return Object.keys(MODE_PACKS);
|
|
}
|