mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-17 12:42:21 +03:00
Widen getModelLatencyStats() to also compute avgTtftMs, avgE2ELatencyMs and avgTokensPerSecond from usage_history's existing ttft_ms/tokens_output columns (no schema change), and feed them into buildAutoCandidates() so the existing speed-ranking factor (#6011, speedRanking.ts/routerStrategy.ts) scores on real telemetry instead of falling back to the pool median. avgE2ELatencyMs aliases avgLatencyMs: usage_history has no distinct second latency column beyond latency_ms/ttft_ms. Extracted the accumulation/reduction logic into pure helpers (accumulateLatencySample, buildLatencyStatsEntry, resolvePositiveOption) in usageHistory/helpers.ts to keep getModelLatencyStats() under the complexity ratchet and usageHistory.ts under its frozen file-size baseline.