dsh-usage-overview 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/client.js +11 -3
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -1329,6 +1329,14 @@ window.__ModuleLoader__.load({
1329
1329
 
1330
1330
  const POLL_INTERVAL_MS = 30000;
1331
1331
 
1332
+ // Headline stat cards show two decimal places (e.g. 53.80亿).
1333
+ function formatStatTokens(value) {
1334
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) return '—';
1335
+ if (value < 10000) return String(Math.round(value));
1336
+ if (value < 100000000) return `${(value / 10000).toFixed(2)}万`;
1337
+ return `${(value / 100000000).toFixed(2)}亿`;
1338
+ }
1339
+
1332
1340
  async function fetchUsage({ range, signal }) {
1333
1341
  const query = range === null ? 'all' : range;
1334
1342
  const response = await fetch(`${USAGE_STATS_PATH}?range=${encodeURIComponent(query)}`, {
@@ -1576,9 +1584,9 @@ window.__ModuleLoader__.load({
1576
1584
  h(
1577
1585
  'div',
1578
1586
  { className: 'dus-cards', key: 'cards' },
1579
- h(StatCard, { value: formatTokensZh(document_?.totals.total ?? 0), label: '累计 Token 数' }),
1587
+ h(StatCard, { value: formatStatTokens(document_?.totals.total ?? 0), label: '累计 Token 数' }),
1580
1588
  h(StatCard, {
1581
- value: formatTokensZh(document_?.totals.peakDayTokens ?? 0),
1589
+ value: formatStatTokens(document_?.totals.peakDayTokens ?? 0),
1582
1590
  label: '单日峰值 Token 数',
1583
1591
  title:
1584
1592
  document_?.totals.peakDay == null
@@ -1586,7 +1594,7 @@ window.__ModuleLoader__.load({
1586
1594
  : `用量最高的一天:${document_.totals.peakDay}`,
1587
1595
  }),
1588
1596
  h(StatCard, {
1589
- value: formatTokensZh(document_?.totals.averageTokensPerActiveDay ?? 0),
1597
+ value: formatStatTokens(document_?.totals.averageTokensPerActiveDay ?? 0),
1590
1598
  label: '日均 Token 数',
1591
1599
  title:
1592
1600
  (document_?.totals.activeDays ?? 0) > 0
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-usage-overview",
3
3
  "displayName": "DSH Usage Overview",
4
4
  "description": "A usage overview for DeepSeek Harness: token totals, activity heatmap, daily token and cache trends, and per-model attribution.",
5
- "version": "1.1.3",
5
+ "version": "1.1.4",
6
6
  "icon": "icon.svg",
7
7
  "author": "w-callan-w",
8
8
  "repository": {