Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,46 @@
All notable changes to this project are documented in this file.
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [0.3.0] - 2026-10-19

设置页仪表盘的可用性与观感版本:修掉两处「看着正常其实不能用」的交互,补上
区间、币种与模型占比,并把控件对齐到 shell 的原生观感。

### Fixed

- **模型下拉勾选一个就塌缩(P1)**:宿主先按已选模型过滤、后登记候选,响应里的
`models` 只剩已选中的那个。现在先登记候选再过滤;`models` 项直接带 `key`
(`compositeModelKey` 的结果),客户端不再自己拼 `provider/model` —— 顺带修掉
provider 为空时拼出 `/model`、选中后所有行都不匹配、整页归零的静默空结果。
- **模型/日期浮层被设置面板裁掉**:设置面板是 `overflow: hidden`,绝对定位的浮层
右半边被切。改用 `useFixedPanel`:按锚点实测位置 `position: fixed`、视口夹取、
下方空间不足时上翻。顺带补 `.tsd-model-popover` 缺失的 `box-sizing`。

### Added

- **「全部」区间**:`rangeFor('all')` 取 `[0, now)` 并关掉 `fill`,真实边界是宿主的
`MAX_BUCKETS` 而不是天数;同时删掉「最长 30 天」这句假限制(date input 本来就没有
min/max)。
- **模型占比卡**:KPI 网格第 6 格,按总 Token 显示前 4 个模型 + 「其它」,悬浮/聚焦
切换说明行,明细走各段 `title`(与明细表同一口径,含未定价判定)。
- **参考成本币种切换**:¥ / $ 切换器在参考成本卡的值行最前,切换后重查;宿主
`query` 收 `currency`、在输出边界按固定 7:1 折算并回传实际使用的 `{code, symbol}`;
小于半分显示 `<0.01`。
- **插件图标**:`package.json#icon` + `icon.svg`(同时进 `files[]`),插件卡片与设置页
导航行共用同一图形。

### Changed

- **价目表基准明确为美元**:内置默认价(0.27 / 1.10 / 0.07 USD 每百万 Token)此前
直接配 `¥` 显示,比官方人民币价低约 7 倍;现在按 7:1 折算,显示数字随之变为官方
人民币价位。价目表与「未定价」判定本身不变。
- **文案**:卡片与表头的「成本」改为「参考成本」(英文 `Est. cost`),它确实是按
价目表估算、不是账单。
- **刷新按钮**:34px 描边方块改为 28px 透明图标按钮,图标换成 DSH 原生 16 网格
stroke 1.5 的刷新字形;请求中 `disabled` + `aria-busy`。
- **`SvgIcon`** 支持自带 `viewBox` / `strokeWidth` / 多段 `paths` 的图标定义,字符串
写法仍是 24 网格 stroke 2 的简写。

## [0.2.2] - 2026-10-18

按 DSH 0.2.x 官方 API 审计后的正确性版本:修复「UI 正常但数据恒为空」的数据管道,
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ DeepSeek Harness 的 **Token 用量统计**插件:按天 / 自定义范围查

## 功能

- 今日 / 近 7 天 / 近 30 天 / 自定义范围,按小时·天聚合
- 今日 / 近 7 天 / 近 30 天 / 全部 / 自定义范围(不限跨度),按小时·天聚合
- 模型筛选、按模型明细(请求数、输入/输出、缓存、成本、占比)
- KPI 网格里的「模型占比」卡:按总 Token 显示前 4 个模型与「其它」
- 参考成本可在 ¥ / $ 之间切换(固定汇率 1 USD = 7 CNY,宿主侧折算)
- 可配置的每百万 Token 价格表(内置 DeepSeek 常见模型默认价)
- 年度热力图;深/浅色自适应,只用 DSH 主题变量,无第三方图表库

Expand All @@ -28,6 +30,7 @@ DeepSeek Harness 的 **Token 用量统计**插件:按天 / 自定义范围查
## 配置

设置 → 插件 → `dsh-plugin-usage` 可改 `currency` 和 `prices`(每百万 Token 价格),写入 profile patch,重启保留。
`currency` 是默认显示币种;仪表盘上参考成本卡里的 ¥ / $ 切换只影响当前界面(同浏览器记住选择)。

价格优先匹配 `provider/model`,其次裸 `model`;未配置的模型标为「未定价」,成本记 0。

Expand All @@ -39,6 +42,7 @@ DeepSeek Harness 的 **Token 用量统计**插件:按天 / 自定义范围查
- 计费对齐官方 `tokenUsage` 投影:同一 `(turn, step)` 替换;`llm/retry-started` 后的重试累加;`assistant/attempt` 的 stream 用量也计入
- fork 会话按 `inheritedEventCount` 跳过父会话前缀,不重复计费
- 费用 = Σ(各 Token 分桶 × 对应单价) / 1e6
- 价目表以**美元 / 百万 Token** 为基准(与 DeepSeek 官方价一致);显示 `¥` 时按固定 7:1 折算,价目表本身不改写

## 兼容性

Expand Down
11 changes: 11 additions & 0 deletions icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions locale/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"meta": {
"title": "Usage Statistics",
"description": "Token, call and reference-cost statistics by day and by model, with model filters and a yearly heatmap."
}
}
6 changes: 6 additions & 0 deletions locale/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"meta": {
"title": "用量统计",
"description": "按天、按模型查看 Token、调用次数与参考成本,支持模型筛选与年度热力图。"
}
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "dsh-plugin-usage",
"description": "Token usage statistics for DeepSeek Harness — daily/custom-range views, model filters, call counts and cost, inspired by CC Switch statistics.",
"version": "0.2.2",
"version": "0.3.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/bennett-dsh/dsh-plugin-usage.git"
},
"type": "module",
"icon": "./icon.svg",
"main": "lib/host/index.js",
"exports": {
".": {
Expand All @@ -17,11 +18,14 @@
"default": "./lib/client/index.js"
},
"./cordis.patch.yml": "./cordis.patch.yml",
"./package.json": "./package.json"
"./package.json": "./package.json",
"./locale/*.json": "./locale/*.json"
},
"files": [
"lib",
"cordis.patch.yml",
"icon.svg",
"locale",
"image.png",
"image-1.png"
],
Expand Down
Loading
Loading