Improve cache hit percentage display and localization in dashboard#503
Merged
Conversation
esengine
added a commit
that referenced
this pull request
May 9, 2026
* chore(format): reuse fmtPct for cache-hit display; keep cachePct numeric Drop the duplicate `formatCacheHitPct` helper added in #503 — `fmtPct` in `dashboard/src/lib/format.ts` already does the same `(n*100).toFixed(1) + "%"` shape and is the canonical formatter for the rest of the panels. In `/status` (`observability.ts`), keep `cachePct` as a number through `renderTinyBar` and only `.toFixed(1)` at the template-string boundary, so we don't round-trip through string + `Number()`. * chore(release): 0.35.0
ChasLui
pushed a commit
to ChasLui/DeepSeek-Reasonix
that referenced
this pull request
May 23, 2026
ChasLui
pushed a commit
to ChasLui/DeepSeek-Reasonix
that referenced
this pull request
May 23, 2026
* chore(format): reuse fmtPct for cache-hit display; keep cachePct numeric Drop the duplicate `formatCacheHitPct` helper added in esengine#503 — `fmtPct` in `dashboard/src/lib/format.ts` already does the same `(n*100).toFixed(1) + "%"` shape and is the canonical formatter for the rest of the panels. In `/status` (`observability.ts`), keep `cachePct` as a number through `renderTinyBar` and only `.toFixed(1)` at the template-string boundary, so we don't round-trip through string + `Number()`. * chore(release): 0.35.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This change fixes the display precision of the cache hit percentage in the dashboard and CLI status panel, and completes the internationalization (i18n) support for the usage chart in the dashboard. Specifically, it replaces Math.round with .toFixed(1) to always show one decimal place for the percentage; adds localized labels such as axisTime, axisUsd, and seriesCost to the usage chart, removing hard‑coded strings; and makes minor corrections to table styles, column ordering, and type annotations.
Why
Previously, using Math.round(stats.cacheHitRatio * 100) would round a value like 85.6% to 86%, losing precision that matters for monitoring. The chart axes and series names were hard‑coded in English, so they could not display correctly in a multi‑language environment. In addition, the table lacked table-layout: auto, and the column header order did not match the data columns, hurting readability. This change switches to .toFixed(1) to preserve one decimal place, fully localizes the chart strings, and corrects the column order and styling to improve i18n support and data clarity.
How to verify
Start the dashboard: Run npm run verify (or the equivalent dev command) from the project root and open the dashboard page.
Check the cache hit percentage: In the sidebar of the Chat panel, view the cache hit ratio and confirm that it is displayed with one decimal place (e.g., 85.6%).
Verify localized chart labels: Switch the interface language (e.g., English and another supported language). Navigate to the Usage panel and ensure that the chart axis labels and series names are fully translated (for example, “cost” becomes a localized equivalent like “费用”, “USD” becomes “美元”, etc.).
Inspect the table column order: In the table on the Usage panel, verify that the columns appear from left to right in the order “window”, “turns”, “cache hit”, “cost (USD)” and match the table headers.
Run the CLI status panel: Launch the CLI interface and confirm that the cache hit ratio is shown with one decimal place and renders correctly.
Checklist
npm run verifypasses locally (lint + typecheck + tests + comment-policy gate)Co-Authored-By: Claudetrailer in commitsCHANGELOG.md— release notes are maintainer-written at release time