feat(ui): add cache hit rate to context sidebar last-message token breakdown (#1524)
* feat(ui): add cache hit rate to context sidebar with verified formula Add a Cache Hit row to the last-assistant-message token breakdown in the context sidebar. The percentage is computed by the new computeCacheHitRate utility: cache.read / (input + cache.read + cache.write) x 100 The formula was verified against the SDK source (packages/opencode/src/session/session.ts:getUsage), which reports input as the non-cached portion only (totalInputTokens - cacheReadInputTokens - cacheWriteInputTokens). Also export sumTokenBreakdown from tokenUtils for reuse, and fix the event-reducer test type errors (setDelta/getText helpers, toBeCloseTo replacement). Closes: # * fix: wire i18n key for Cache Hit label, fix formatNumber type, drop unintended event-reducer changes * chore: remove unused cacheHitRate and cacheHitRateTooltip i18n keys from en.ts * fix: correct cache hit token display * fix: add French cache hit label --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
284d72bef2
commit
e20cfa2dbc
@@ -1124,6 +1124,7 @@ export const dict: Record<I18nKey, string> = {
|
||||
"contextSidebar.tokens.reasoning": "Razonamiento",
|
||||
"contextSidebar.tokens.cacheRead": "Lectura de caché",
|
||||
"contextSidebar.tokens.cacheWrite": "Escritura de caché",
|
||||
"contextSidebar.tokens.cacheHit": "Acierto de caché",
|
||||
"contextSidebar.actions.copyJson": "Copiar JSON",
|
||||
"contextSidebar.actions.copy": "Copiar",
|
||||
"contextSidebar.actions.copied": "Copiado",
|
||||
|
||||
Reference in New Issue
Block a user