From f55a1e88ea5948582d0e5a33efea0c5d806e1f4b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 16 Mar 2026 04:25:26 +0200 Subject: Add Snapshot.ScopeReqs/ScopeRPM and simplify 3 callers Centralizes the provider+model map traversal and window-minutes guard that was duplicated in hexaiaction, hexaicli, and lsp. Co-Authored-By: Claude Opus 4.6 --- internal/hexaicli/run.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'internal/hexaicli/run.go') diff --git a/internal/hexaicli/run.go b/internal/hexaicli/run.go index 1563f5e..806f824 100644 --- a/internal/hexaicli/run.go +++ b/internal/hexaicli/run.go @@ -593,16 +593,8 @@ func summarizeChatRun(ctx context.Context, client llm.Client, model string, msgs if err == nil { summary.snapshot = snap } - minsWin := summary.snapshot.Window.Minutes() - if minsWin <= 0 { - minsWin = 0.001 - } - if pe, ok := summary.snapshot.Providers[client.Name()]; ok { - if mc, ok2 := pe.Models[model]; ok2 { - summary.scopeReq = mc.Reqs - } - } - summary.scopeRPM = float64(summary.scopeReq) / minsWin + summary.scopeReq = summary.snapshot.ScopeReqs(client.Name(), model) + summary.scopeRPM = summary.snapshot.ScopeRPM(client.Name(), model) return summary } -- cgit v1.2.3