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
@@ -1158,6 +1158,7 @@ export const dict = {
|
||||
'contextSidebar.tokens.reasoning': 'Reasoning',
|
||||
'contextSidebar.tokens.cacheRead': 'Cache Read',
|
||||
'contextSidebar.tokens.cacheWrite': 'Cache Write',
|
||||
'contextSidebar.tokens.cacheHit': 'Cache Hit',
|
||||
'contextSidebar.actions.copyJson': 'Copy JSON',
|
||||
'contextSidebar.actions.copy': 'Copy',
|
||||
'contextSidebar.actions.copied': 'Copied',
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1031,6 +1031,7 @@ export const dict = {
|
||||
'contextSidebar.tokens.reasoning': 'Raisonnement',
|
||||
'contextSidebar.tokens.cacheRead': 'Lecture du cache',
|
||||
'contextSidebar.tokens.cacheWrite': 'Écriture du cache',
|
||||
'contextSidebar.tokens.cacheHit': 'Succès du cache',
|
||||
'contextSidebar.actions.copyJson': 'Copier JSON',
|
||||
'contextSidebar.actions.copy': 'Copie',
|
||||
'contextSidebar.actions.copied': 'Copié',
|
||||
|
||||
@@ -1161,6 +1161,7 @@ export const dict: Record<I18nKey, string> = {
|
||||
'contextSidebar.tokens.reasoning': '추론',
|
||||
'contextSidebar.tokens.cacheRead': '캐시 읽기',
|
||||
'contextSidebar.tokens.cacheWrite': '캐시 쓰기',
|
||||
'contextSidebar.tokens.cacheHit': '캐시 적중',
|
||||
'contextSidebar.actions.copyJson': 'JSON 복사',
|
||||
'contextSidebar.actions.copy': '복사',
|
||||
'contextSidebar.actions.copied': '복사됨',
|
||||
|
||||
@@ -1322,6 +1322,7 @@ export const dict: Record<I18nKey, string> = {
|
||||
'contextSidebar.stats.user': 'Użytkownik',
|
||||
'contextSidebar.tokens.cacheRead': 'Odczyt cache',
|
||||
'contextSidebar.tokens.cacheWrite': 'Zapis cache',
|
||||
'contextSidebar.tokens.cacheHit': 'Trafienie cache',
|
||||
'contextSidebar.tokens.input': 'Wejście',
|
||||
'contextSidebar.tokens.output': 'Wyjście',
|
||||
'contextSidebar.tokens.reasoning': 'Rozumowanie',
|
||||
|
||||
@@ -1124,6 +1124,7 @@ export const dict: Record<I18nKey, string> = {
|
||||
"contextSidebar.tokens.reasoning": "Raciocínio",
|
||||
"contextSidebar.tokens.cacheRead": "Leitura de cache",
|
||||
"contextSidebar.tokens.cacheWrite": "Escrita de cache",
|
||||
"contextSidebar.tokens.cacheHit": "Acerto de cache",
|
||||
"contextSidebar.actions.copyJson": "Copiar JSON",
|
||||
"contextSidebar.actions.copy": "Copiar",
|
||||
"contextSidebar.actions.copied": "Copiado",
|
||||
|
||||
@@ -1124,6 +1124,7 @@ export const dict: Record<I18nKey, string> = {
|
||||
"contextSidebar.tokens.reasoning": "Міркування",
|
||||
"contextSidebar.tokens.cacheRead": "Читання кешу",
|
||||
"contextSidebar.tokens.cacheWrite": "Запис кешу",
|
||||
"contextSidebar.tokens.cacheHit": "Влучання в кеш",
|
||||
"contextSidebar.actions.copyJson": "Скопіювати JSON",
|
||||
"contextSidebar.actions.copy": "Копіювати",
|
||||
"contextSidebar.actions.copied": "Скопійовано",
|
||||
|
||||
@@ -1124,6 +1124,7 @@ export const dict: Record<I18nKey, string> = {
|
||||
'contextSidebar.tokens.reasoning': '推理',
|
||||
'contextSidebar.tokens.cacheRead': '缓存读取',
|
||||
'contextSidebar.tokens.cacheWrite': '缓存写入',
|
||||
'contextSidebar.tokens.cacheHit': '缓存命中',
|
||||
'contextSidebar.actions.copyJson': '复制 JSON',
|
||||
'contextSidebar.actions.copy': '复制',
|
||||
'contextSidebar.actions.copied': '已复制',
|
||||
|
||||
@@ -1134,6 +1134,7 @@ export const dict: Record<I18nKey, string> = {
|
||||
'contextSidebar.tokens.reasoning': '推理',
|
||||
'contextSidebar.tokens.cacheRead': '快取讀取',
|
||||
'contextSidebar.tokens.cacheWrite': '快取寫入',
|
||||
'contextSidebar.tokens.cacheHit': '快取命中',
|
||||
'contextSidebar.actions.copyJson': '複製 JSON',
|
||||
'contextSidebar.actions.copy': '複製',
|
||||
'contextSidebar.actions.copied': '已複製',
|
||||
|
||||
Reference in New Issue
Block a user