Skip to content

Improve cache hit percentage display and localization in dashboard#503

Merged
esengine merged 2 commits into
esengine:mainfrom
kabaka9527:main
May 9, 2026
Merged

Improve cache hit percentage display and localization in dashboard#503
esengine merged 2 commits into
esengine:mainfrom
kabaka9527:main

Conversation

@kabaka9527

Copy link
Copy Markdown
Contributor

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 verify passes locally (lint + typecheck + tests + comment-policy gate)
  • [ ✅] No Co-Authored-By: Claude trailer in commits
  • [ ✅] Comments follow CONTRIBUTING.md (no module-essay headers, no incident history)
  • [ ✅] No edits to CHANGELOG.md — release notes are maintainer-written at release time

@esengine esengine merged commit 7642ad6 into esengine:main May 9, 2026
3 checks passed
@esengine esengine mentioned this pull request May 9, 2026
2 tasks
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants