summaryrefslogtreecommitdiff
path: root/internal/hexaicli/run.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-16 04:25:26 +0200
committerPaul Buetow <paul@buetow.org>2026-03-16 04:25:26 +0200
commitf55a1e88ea5948582d0e5a33efea0c5d806e1f4b (patch)
treea180dc8c0266c87b0bc8d05a8e9c18d18748d751 /internal/hexaicli/run.go
parent7dd1bfa797b462791dc398690f599a2c5e5d1962 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'internal/hexaicli/run.go')
-rw-r--r--internal/hexaicli/run.go12
1 files changed, 2 insertions, 10 deletions
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
}