dsh-token-dash 1.1.0 → 1.1.2
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.
- package/README.en.md +26 -81
- package/README.md +26 -101
- package/client.js +72 -44
- package/locale/en.json +6 -6
- package/locale/zh.json +6 -6
- package/package.json +4 -3
- package/docs/pic/panel-dashboard.png +0 -0
- package/docs/pic/pill-home.png +0 -0
- package/docs/pic/pill-session.png +0 -0
- package/docs/pic/settings.png +0 -0
package/README.en.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/icon.png" alt="dsh-token-dash" width="96" height="96" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
<h1 align="center">dsh-token-dash</h1>
|
|
2
6
|
|
|
3
7
|
<p align="center">
|
|
@@ -6,7 +10,8 @@
|
|
|
6
10
|
|
|
7
11
|
<p align="center">
|
|
8
12
|
Track daily/monthly model spend and budget headroom right next to the DSH input box:<br />
|
|
9
|
-
paste an API Key and the plan is auto-detected (subscription or pay-as-you-go), set a monthly budget, and consumption is estimated locally in real time
|
|
13
|
+
paste an API Key and the plan is auto-detected (subscription or pay-as-you-go), set a monthly budget, and consumption is estimated locally in real time;<br />
|
|
14
|
+
export the current month as a backup and import it back after switching machines or reinstalling.
|
|
10
15
|
</p>
|
|
11
16
|
|
|
12
17
|
<p align="center">
|
|
@@ -21,13 +26,14 @@
|
|
|
21
26
|
<img src="https://img.shields.io/github/downloads/spartawhy117/dsh-token-dash/total?label=downloads" alt="downloads" />
|
|
22
27
|
<img src="https://img.shields.io/github/license/spartawhy117/dsh-token-dash" alt="license" />
|
|
23
28
|
<img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="node" />
|
|
29
|
+
<a href="https://awesome-dsh-plugin.com/p/spartawhy117/dsh-token-dash"><img src="https://img.shields.io/badge/awesome--dsh--plugin-listed-6ea8ff" alt="awesome-dsh-plugin" /></a>
|
|
24
30
|
</p>
|
|
25
31
|
|
|
26
32
|
- **Providers**: DeepSeek (DS account / API key), GLM Coding (subscription), Kimi Coding (subscription), Kimi / OpenRouter / Qwen (pay-as-you-go; OpenRouter in USD, Qwen CNY domestic / USD international) — paste a key and the billing mode is detected automatically
|
|
27
|
-
- **Pages**: bottom bar Pill → floating dashboard
|
|
28
|
-
- **Dashboard data**: per-provider monthly budget progress (used / total / percent), today's spend, account balance, subscription 5h/weekly windows with reset times
|
|
29
|
-
- **Settings**: per-provider monthly budget (with currency), three refresh intervals, balance toggle,
|
|
30
|
-
- **Data**: daily / monthly usage estimated locally (built-in price catalog + community price table), three-layer model attribution, read-only local sessions
|
|
33
|
+
- **Pages**: bottom bar Pill → floating dashboard (usage / settings tabs); click the pill to expand, click outside to collapse
|
|
34
|
+
- **Dashboard data**: time range (today / last 7 days / last 30 days / all), per-provider monthly budget progress (used / total / percent), today's spend, account balance, subscription 5h / weekly windows with reset times; two tiles for **total cost by currency** and **real Tokens (including cache read/write)**; per provider/model cost, requests and hit rate below
|
|
35
|
+
- **Settings**: per-provider monthly budget (with currency, defaults to 100 when empty), three refresh intervals, balance toggle, logs, data export / import, check for updates
|
|
36
|
+
- **Data**: daily / monthly usage estimated locally (built-in price catalog + community price table), three-layer model attribution, read-only local sessions; subscription models count toward Tokens but not cost, and the billing mode is pinned per key instead of following quota flakiness
|
|
31
37
|
|
|
32
38
|
---
|
|
33
39
|
|
|
@@ -43,103 +49,37 @@ dsh plugin --profile desktop add dsh-token-dash
|
|
|
43
49
|
dsh plugin --profile desktop add github:spartawhy117/dsh-token-dash
|
|
44
50
|
|
|
45
51
|
# Option 3: download dsh-token-dash-x.y.z.tgz from Releases and install locally (offline)
|
|
46
|
-
dsh plugin --profile desktop add /path/to/dsh-token-dash-1.0.
|
|
52
|
+
dsh plugin --profile desktop add /path/to/dsh-token-dash-1.1.0.tgz
|
|
47
53
|
```
|
|
48
54
|
|
|
49
|
-
Update: run `update` with the same name, or use the
|
|
55
|
+
Update: run `update` with the same name, or use the `⤓` button on the right of “Pricing & version” in settings. Remove: run `remove` with the same name; data stays in `$DSH_HOME/dsh-token-dash/`.
|
|
50
56
|
|
|
51
57
|
---
|
|
52
58
|
|
|
53
59
|
## Interface
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
P1 · Bottom bar pill (click to open the dashboard)
|
|
57
|
-
┌──────────────────────────────────────────────────────────┐
|
|
58
|
-
│ [API] Budget 91.9% · Today ¥0.04 · Balance ¥87.66⌃ │
|
|
59
|
-
└──────────────────────────────────────────────────────────┘
|
|
60
|
-
┌──────────────────────────────────────────────────────────┐
|
|
61
|
-
│ [Sub] 5h 42% · Week 18%⌃ │
|
|
62
|
-
└──────────────────────────────────────────────────────────┘
|
|
63
|
-
|
|
64
|
-
P2 · Floating dashboard (opens right above the pill; cards appear as API keys are detected)
|
|
65
|
-
┌──────────────────────────────────────────────────────────┐
|
|
66
|
-
│ Token Dashboard Refresh Settings × │
|
|
67
|
-
│ Pay-as-you-go (3 detected) just now │
|
|
68
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
69
|
-
│ │ DeepSeek Budget ¥91.90/¥100.00 · 91.9% Today Bal. │ │
|
|
70
|
-
│ │ [=========================================-------] │ │
|
|
71
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
72
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
73
|
-
│ │ OpenRouter Budget $22.80/$60.00 · 38.0% Today Bal. │ │
|
|
74
|
-
│ │ [==================--------------------------------] │ │
|
|
75
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
76
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
77
|
-
│ │ Qwen Budget ¥0.40/¥5.00 · 8.0% Today Bal. │ │
|
|
78
|
-
│ │ [====----------------------------------------------] │ │
|
|
79
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
80
|
-
│ Subscriptions (2 detected) │
|
|
81
|
-
│ ┌────────────────────────────┐ ┌────────────────────────┐ │
|
|
82
|
-
│ │ GLM Coding │ │ Kimi Coding │ │
|
|
83
|
-
│ │ 5h 42% Week 18% │ │ 5h 30% Week 12% │ │
|
|
84
|
-
│ │ Resets 14:05 │ │ Resets 15:20 │ │
|
|
85
|
-
│ └────────────────────────────┘ └────────────────────────┘ │
|
|
86
|
-
│ API cost breakdown / this month local estimates │
|
|
87
|
-
│ Model usage / this month total 1.31M │
|
|
88
|
-
└──────────────────────────────────────────────────────────┘
|
|
89
|
-
|
|
90
|
-
P3 · Settings
|
|
91
|
-
┌──────────────────────────────────────────────────────────┐
|
|
92
|
-
│ ← Back Token Dashboard [Close] │
|
|
93
|
-
│ API billing (3 detected) │
|
|
94
|
-
│ DeepSeek Monthly budget [ 100.00 ] CNY │
|
|
95
|
-
│ OpenRouter Monthly budget [ 60.00 ] USD │
|
|
96
|
-
│ Qwen Monthly budget [ 5.00 ] CNY │
|
|
97
|
-
│ Subscriptions (2 detected) [Rescan] │
|
|
98
|
-
│ GLM Coding 5h 42% / Week 18% │
|
|
99
|
-
│ Kimi Coding 5h 30% / Week 12% │
|
|
100
|
-
│ Display │
|
|
101
|
-
│ Refresh interval [30s] [1 min] [5 min] │
|
|
102
|
-
│ Account balance [On] │
|
|
103
|
-
│ Logs │
|
|
104
|
-
│ View logs [Open log folder] [Export logs] │
|
|
105
|
-
│ Pricing & version │
|
|
106
|
-
│ View pricing DeepSeek GLM Kimi OpenRouter Qwen │
|
|
107
|
-
│ Version 1.0.6 [Check update]│
|
|
108
|
-
└──────────────────────────────────────────────────────────┘
|
|
109
|
-
|
|
110
|
-
UI transitions
|
|
111
|
-
click pill / Enter
|
|
112
|
-
┌──────────┐ ──────────────────→ ┌────────────┐
|
|
113
|
-
│ P1 idle │ │ P2 dashboard│
|
|
114
|
-
└──────────┘ ←────────────────── └────────────┘
|
|
115
|
-
↑ click pill / click outside / [×]
|
|
116
|
-
│ │[Settings]
|
|
117
|
-
│ ▼
|
|
118
|
-
│ [← Back] / click outside ┌────────────┐
|
|
119
|
-
└──────────────────────────── │ P3 settings │
|
|
120
|
-
└────────────┘
|
|
121
|
-
```
|
|
61
|
+
Screenshots below use mock data so the full layout is visible at once:
|
|
122
62
|
|
|
123
|
-
**P1 · Bottom bar pill** (
|
|
63
|
+
**P1 · Bottom bar pill** (pay-as-you-go and subscription variants; click to open the panel, click outside or `×` to close)
|
|
124
64
|
|
|
125
65
|
<p align="center">
|
|
126
|
-
<img src="
|
|
66
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-api.png" alt="Pay-as-you-go pill" />
|
|
127
67
|
</p>
|
|
128
68
|
|
|
129
69
|
<p align="center">
|
|
130
|
-
<img src="
|
|
70
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-sub.png" alt="Subscription pill" />
|
|
131
71
|
</p>
|
|
132
72
|
|
|
133
|
-
**P2 · Floating dashboard
|
|
73
|
+
**P2 · Floating dashboard (usage tab)**: monthly budgets and subscriptions, time range, two summary tiles, per-model breakdown
|
|
134
74
|
|
|
135
75
|
<p align="center">
|
|
136
|
-
<img src="
|
|
76
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-dashboard.png" alt="Dashboard" />
|
|
137
77
|
</p>
|
|
138
78
|
|
|
139
|
-
**P3 · Settings
|
|
79
|
+
**P3 · Settings tab**: API billing, subscriptions, display, data & logs, pricing & version
|
|
140
80
|
|
|
141
81
|
<p align="center">
|
|
142
|
-
<img src="
|
|
82
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/settings.png" alt="Settings" />
|
|
143
83
|
</p>
|
|
144
84
|
|
|
145
85
|
---
|
|
@@ -155,11 +95,16 @@ npm run logs -- --module slot,adapter.* # filter by module
|
|
|
155
95
|
|
|
156
96
|
Reads only local session `usage` (title-generation overhead excluded); balances come from official endpoints only, with credentials resolved by the host and never written to disk; costs are local estimates — no billing requests are ever made.
|
|
157
97
|
|
|
98
|
+
Backups happen entirely on disk: `Export data` writes one JSON file (settings + current-month usage, without subscription quotas or balances), `Import data` only parses that file, and the existing files are backed up before the current month is overwritten. No network involved.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
158
102
|
## Development
|
|
159
103
|
|
|
160
104
|
```bash
|
|
161
105
|
npm test # unit tests
|
|
162
106
|
npm run e2e # end-to-end (temp DSH_HOME + web profile + Playwright)
|
|
107
|
+
npm run shots # regenerate the P1/P2/P3 screenshots in docs/pic from mock data (tools/mock)
|
|
163
108
|
npm run pack # build the release tarball into build/
|
|
164
109
|
```
|
|
165
110
|
|
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/icon.png" alt="dsh-token-dash" width="96" height="96" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
<h1 align="center">dsh-token-dash</h1>
|
|
2
6
|
|
|
3
7
|
<p align="center">
|
|
@@ -6,7 +10,8 @@
|
|
|
6
10
|
|
|
7
11
|
<p align="center">
|
|
8
12
|
在 DSH 输入框旁看清每日/每月模型消耗与预算余量:<br />
|
|
9
|
-
API Key
|
|
13
|
+
API Key 一填即自动识别订阅还是按量计费,月度预算可设、消耗实时估算;<br />
|
|
14
|
+
当月数据可导出备份,换机或重装后一键导入恢复。
|
|
10
15
|
</p>
|
|
11
16
|
|
|
12
17
|
<p align="center">
|
|
@@ -21,13 +26,14 @@
|
|
|
21
26
|
<img src="https://img.shields.io/github/downloads/spartawhy117/dsh-token-dash/total?label=downloads" alt="downloads" />
|
|
22
27
|
<img src="https://img.shields.io/github/license/spartawhy117/dsh-token-dash" alt="license" />
|
|
23
28
|
<img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="node" />
|
|
29
|
+
<a href="https://awesome-dsh-plugin.com/zh/p/spartawhy117/dsh-token-dash"><img src="https://img.shields.io/badge/awesome--dsh--plugin-listed-6ea8ff" alt="awesome-dsh-plugin" /></a>
|
|
24
30
|
</p>
|
|
25
31
|
|
|
26
32
|
- **厂商支持**:DeepSeek(DS 账号 / API Key)、GLM Coding(订阅)、Kimi Coding(订阅)、Kimi / OpenRouter / Qwen(按量,OpenRouter USD、Qwen 国内 CNY / 国际 USD)——填 Key 自动识别订阅或按量计费
|
|
27
|
-
- **页面**:底栏 Pill →
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- **数据口径**:每日 / 每月用量本地估算(内置价格表 +
|
|
33
|
+
- **页面**:底栏 Pill → 浮层看板(用量 / 设置双 tab);Pill 点击展开、点击浮层外收起
|
|
34
|
+
- **看板数据**:时间范围(当天 / 近 7 天 / 近 30 天 / 全部)、本月预算进度(已用 / 总额 / 百分比)、今日消耗、账户余额、订阅 5h / 周窗口与重置时间;两格卡显示**总费用(按币种)**与**真实 Tokens(含缓存读写)**;下方按 provider / 模型列出费用、请求数与命中率
|
|
35
|
+
- **设置**:按供应商的月度预算(带币种,未填写默认 100)、刷新间隔三档、账户余额开关、日志、数据导出 / 导入、检查更新
|
|
36
|
+
- **数据口径**:每日 / 每月用量本地估算(内置价格表 + 社区价格表),三层模型归属,只读本地会话;订阅模型计入 Tokens 但不计费用,计费形态按 Key 固化,不随配额接口抖动
|
|
31
37
|
|
|
32
38
|
---
|
|
33
39
|
|
|
@@ -43,123 +49,37 @@ dsh plugin --profile desktop add dsh-token-dash
|
|
|
43
49
|
dsh plugin --profile desktop add github:spartawhy117/dsh-token-dash
|
|
44
50
|
|
|
45
51
|
# 方式三:从 Releases 下载 dsh-token-dash-x.y.z.tgz 后本地安装(离线场景)
|
|
46
|
-
dsh plugin --profile desktop add /path/to/dsh-token-dash-1.0.
|
|
52
|
+
dsh plugin --profile desktop add /path/to/dsh-token-dash-1.1.0.tgz
|
|
47
53
|
```
|
|
48
54
|
|
|
49
|
-
更新:`update` 同名命令(npm / github:
|
|
55
|
+
更新:`update` 同名命令(npm / github: 各自同名),或在插件设置页「价格与版本」右侧的 `⤓` 内完成。卸载:`remove` 同名命令,数据保留在 `$DSH_HOME/dsh-token-dash/`。
|
|
50
56
|
|
|
51
57
|
---
|
|
52
58
|
|
|
53
59
|
## 界面
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
P1 · 底栏 Pill(点击展开看板)
|
|
57
|
-
┌──────────────────────────────────────────────────────────┐
|
|
58
|
-
│ [API] 预算 91.9% · 今日 ¥0.04 · 余额 ¥87.66⌃ │
|
|
59
|
-
└──────────────────────────────────────────────────────────┘
|
|
60
|
-
┌──────────────────────────────────────────────────────────┐
|
|
61
|
-
│ [订阅] 5h 42% · 周 18%⌃ │
|
|
62
|
-
└──────────────────────────────────────────────────────────┘
|
|
63
|
-
|
|
64
|
-
P2 · 浮层看板(pill 正上方弹出;卡片与行随 API Key 侦测动态显示)
|
|
65
|
-
┌──────────────────────────────────────────────────────────┐
|
|
66
|
-
│ Token 看板 刷新 设置 关闭│
|
|
67
|
-
│ API 按量(已检测 3) 刚刚 │
|
|
68
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
69
|
-
│ │ DeepSeek 预算 ¥91.90/¥100.00 · 91.9% 今日 余额 │ │
|
|
70
|
-
│ │ [=========================================-------] │ │
|
|
71
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
72
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
73
|
-
│ │ OpenRouter 预算 $22.80/$60.00 · 38.0% 今日 余额 │ │
|
|
74
|
-
│ │ [==================--------------------------------] │ │
|
|
75
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
76
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
77
|
-
│ │ 通义千问 预算 ¥0.40/¥5.00 · 8.0% 今日 余额 │ │
|
|
78
|
-
│ │ [====----------------------------------------------] │ │
|
|
79
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
80
|
-
│ 订阅套餐(已检测 2) │
|
|
81
|
-
│ ┌────────────────────────────┐ ┌────────────────────────┐ │
|
|
82
|
-
│ │ GLM Coding │ │ Kimi Coding │ │
|
|
83
|
-
│ │ 5h 42% 周 18% │ │ 5h 30% 周 12% │ │
|
|
84
|
-
│ │ 重置 14:05 │ │ 重置 15:20 │ │
|
|
85
|
-
│ └────────────────────────────┘ └────────────────────────┘ │
|
|
86
|
-
│ API 费用明细 / 本月 DSH 本机估算 │
|
|
87
|
-
│ CNY 合计 ¥92.30 │
|
|
88
|
-
│ DeepSeek / DeepSeek-V4.1-Flash 99.6% ¥91.90 │
|
|
89
|
-
│ 通义千问 / Qwen3.8-Max 0.4% ¥0.40 │
|
|
90
|
-
│ USD 合计 $22.80 │
|
|
91
|
-
│ OpenRouter / DeepSeek-V4.1-Flash 100.0% $22.80 │
|
|
92
|
-
│ 模型用量明细 / 本月 合计 1.31M│
|
|
93
|
-
│ 模型 请求 输入 命中 输出 │
|
|
94
|
-
│ DeepSeek / V4.1-Flash 48 0.11M 0.20M 0.02M│
|
|
95
|
-
│ OpenRouter / V4.1-Flash 12 0.02M 0.01M 0.01M│
|
|
96
|
-
│ 通义千问 / Qwen3.8-Max 24 0.05M 0.02M 0.01M│
|
|
97
|
-
│ GLM Coding / GLM-5.3 64 0.30M 0.52M 0.04M│
|
|
98
|
-
└──────────────────────────────────────────────────────────┘
|
|
99
|
-
|
|
100
|
-
P3 · 设置
|
|
101
|
-
┌──────────────────────────────────────────────────────────┐
|
|
102
|
-
│ ← 返回 Token 看板 [关闭] │
|
|
103
|
-
│ API 计费(已检测 3) │
|
|
104
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
105
|
-
│ │ DeepSeek 月度预算 [ 100.00 ] CNY │ │
|
|
106
|
-
│ │ OpenRouter 月度预算 [ 60.00 ] USD │ │
|
|
107
|
-
│ │ 通义千问 月度预算 [ 5.00 ] CNY │ │
|
|
108
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
109
|
-
│ 订阅计费(已检测 2) [重新检测] │
|
|
110
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
111
|
-
│ │ GLM Coding 5h 42% / 周 18% │ │
|
|
112
|
-
│ │ Kimi Coding 5h 30% / 周 12% │ │
|
|
113
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
114
|
-
│ 显示 │
|
|
115
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
116
|
-
│ │ 刷新间隔 [30 秒] [ 1 分钟 ] [5 分钟] │ │
|
|
117
|
-
│ │ 账户余额 [开] │ │
|
|
118
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
119
|
-
│ 日志 │
|
|
120
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
121
|
-
│ │ 查看日志 [打开日志文件夹] [导出日志] │ │
|
|
122
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
123
|
-
│ 价格与版本 │
|
|
124
|
-
│ ┌──────────────────────────────────────────────────────┐ │
|
|
125
|
-
│ │ 查看价格明细 DeepSeek GLM Kimi OpenRouter Qwen │ │
|
|
126
|
-
│ │ 版本 1.0.6 [检查更新] │ │
|
|
127
|
-
│ └──────────────────────────────────────────────────────┘ │
|
|
128
|
-
└──────────────────────────────────────────────────────────┘
|
|
129
|
-
|
|
130
|
-
UI 交互转移
|
|
131
|
-
点击 Pill / Enter
|
|
132
|
-
┌──────────┐ ──────────────────→ ┌──────────┐
|
|
133
|
-
│ P1 收起 │ │ P2 看板 │
|
|
134
|
-
└──────────┘ ←────────────────── └──────────┘
|
|
135
|
-
↑ 点击 Pill / 点击浮层外 / 「关闭」
|
|
136
|
-
│ │「设置」
|
|
137
|
-
│ ▼
|
|
138
|
-
│ 「← 返回」/ 点击浮层外 ┌──────────┐
|
|
139
|
-
└───────────────────────── │ P3 设置 │
|
|
140
|
-
└──────────┘
|
|
141
|
-
```
|
|
61
|
+
以下截图使用假数据演示,便于一次看到完整效果:
|
|
142
62
|
|
|
143
|
-
**P1 · 底栏 Pill
|
|
63
|
+
**P1 · 底栏 Pill**(按量 / 订阅两种形态;点击展开看板,点击浮层外或 `×` 收起)
|
|
144
64
|
|
|
145
65
|
<p align="center">
|
|
146
|
-
<img src="
|
|
66
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-api.png" alt="按量 Pill" />
|
|
147
67
|
</p>
|
|
148
68
|
|
|
149
69
|
<p align="center">
|
|
150
|
-
<img src="
|
|
70
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-sub.png" alt="订阅 Pill" />
|
|
151
71
|
</p>
|
|
152
72
|
|
|
153
|
-
**P2 ·
|
|
73
|
+
**P2 · 浮层看板(用量 tab)**:本月预算与订阅、时间范围、两格统计卡、按模型明细
|
|
154
74
|
|
|
155
75
|
<p align="center">
|
|
156
|
-
<img src="
|
|
76
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-dashboard.png" alt="浮层看板" />
|
|
157
77
|
</p>
|
|
158
78
|
|
|
159
|
-
**P3 ·
|
|
79
|
+
**P3 · 设置 tab**:API 计费、订阅、显示、数据与日志、价格与版本
|
|
160
80
|
|
|
161
81
|
<p align="center">
|
|
162
|
-
<img src="
|
|
82
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/settings.png" alt="设置" />
|
|
163
83
|
</p>
|
|
164
84
|
|
|
165
85
|
---
|
|
@@ -175,11 +95,16 @@ npm run logs -- --module slot,adapter.* # 按模块过滤
|
|
|
175
95
|
|
|
176
96
|
只读本地会话 `usage`,不统计标题生成开销;余额仅访问官方接口,凭据经宿主解析不落盘;费用为本地估算,不发起计费请求。
|
|
177
97
|
|
|
98
|
+
数据备份在本地完成:`导出数据` 生成一个 JSON 文件(设置 + 当月使用数据,不含订阅配额与余额),`导入数据` 只解析该文件,覆盖当月前自动备份原文件,全过程不经过网络。
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
178
102
|
## 开发
|
|
179
103
|
|
|
180
104
|
```bash
|
|
181
105
|
npm test # 单元测试
|
|
182
106
|
npm run e2e # 端到端(临时 DSH_HOME + web profile + Playwright)
|
|
107
|
+
npm run shots # 用假数据重新生成 docs/pic 的 P1/P2/P3 截图(tools/mock)
|
|
183
108
|
npm run pack # 发布 tarball 生成到 build/
|
|
184
109
|
```
|
|
185
110
|
|
package/client.js
CHANGED
|
@@ -37,19 +37,18 @@ window.__ModuleLoader__.load({
|
|
|
37
37
|
'目前支持 DeepSeek / Kimi / GLM / OpenRouter / Qwen API Key': 'Supports DeepSeek / Kimi / GLM / OpenRouter / Qwen API Keys',
|
|
38
38
|
'刷新': 'Refresh', '关闭': 'Close',
|
|
39
39
|
'未定价': 'Unpriced', '请求': 'Req', '命中': 'Hit',
|
|
40
|
-
'
|
|
41
|
-
'
|
|
40
|
+
'本月预算': 'Monthly budget',
|
|
41
|
+
'订阅套餐(账户级)': 'Subscription plan (account-wide)',
|
|
42
42
|
'重新检测订阅配额': 'Recheck subscription quota',
|
|
43
43
|
'未检测到已配置供应商': 'No configured provider detected',
|
|
44
44
|
'供应商探测失败': 'Provider probe failed',
|
|
45
45
|
'时间范围': 'Time range',
|
|
46
46
|
'刷新失败,保留上次数据': 'Refresh failed; keeping previous data',
|
|
47
47
|
'范围数据加载失败': 'Range data failed to load',
|
|
48
|
-
'重试': 'Retry', '总费用': 'Total cost', '按币种': 'By currency',
|
|
49
|
-
'真实 Tokens': 'Real Tokens', '入 {input} · 缓存 {cache} · 出 {output}': 'In {input} · Cache {cache} · Out {output}',
|
|
50
48
|
'范围数据加载中…': 'Loading range data…', '范围内暂无消耗': 'No usage in this range',
|
|
51
49
|
'Tokens 括号说明': 'Tokens bracket legend',
|
|
52
50
|
'Tokens 括号顺序:输入 / 缓存(读+写)/ 输出': 'Tokens bracket order: input / cache (read+write) / output',
|
|
51
|
+
'真实 Tokens': 'Real Tokens',
|
|
53
52
|
'Token 数据不可用': 'Token data unavailable', 'Token 数据加载中…': 'Loading Token data…',
|
|
54
53
|
'设置加载失败': 'Failed to load settings', '已保存': 'Saved',
|
|
55
54
|
'保存失败:{reason}': 'Save failed: {reason}', '请输入 0 或正数': 'Enter 0 or a positive number',
|
|
@@ -60,7 +59,8 @@ window.__ModuleLoader__.load({
|
|
|
60
59
|
'已重新检测': 'Rechecked', '已打开日志文件夹': 'Log folder opened',
|
|
61
60
|
'无法打开,已复制路径': 'Could not open; path copied', '打开日志失败': 'Failed to open logs',
|
|
62
61
|
'日志已导出': 'Logs exported', '日志导出失败': 'Log export failed',
|
|
63
|
-
'数据': 'Data', '备份与恢复': 'Backup and restore',
|
|
62
|
+
'数据': 'Data', '备份与恢复': 'Backup and restore',
|
|
63
|
+
'{n} 分钟后': 'in {n} min', '{n} 小时后': 'in {n} h', '{n} 天后': 'in {n} d',
|
|
64
64
|
'导入中…': 'Importing…', '数据已导出': 'Data exported', '数据导出失败': 'Data export failed',
|
|
65
65
|
'已导入 {month} 数据': 'Imported {month} data', '导入失败:{reason}': 'Import failed: {reason}',
|
|
66
66
|
'检查失败': 'Check failed', '未发布': 'Not published', '已是最新': 'Up to date',
|
|
@@ -70,8 +70,7 @@ window.__ModuleLoader__.load({
|
|
|
70
70
|
'更新失败({reason})': 'Update failed ({reason})',
|
|
71
71
|
'已更新到 {version},重启 DSH 后生效': 'Updated to {version}; restart DSH to apply',
|
|
72
72
|
'已更新,重启 DSH 后生效': 'Updated; restart DSH to apply',
|
|
73
|
-
'API
|
|
74
|
-
'订阅(已检测 {count})': 'Subscription ({count} detected)',
|
|
73
|
+
'API 计费': 'API billing',
|
|
75
74
|
'发现 {version},点击更新': 'Found {version}; click to update',
|
|
76
75
|
'版本 {version}': 'Version {version}',
|
|
77
76
|
'{name} · {action} Token 看板': '{name} · {action} Token dashboard',
|
|
@@ -128,6 +127,20 @@ window.__ModuleLoader__.load({
|
|
|
128
127
|
const hm = `${pad(date.getHours())}:${pad(date.getMinutes())}`
|
|
129
128
|
return date.toDateString() === now.toDateString() ? hm : `${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${hm}`
|
|
130
129
|
}
|
|
130
|
+
/** 重置时间带相对量:`3 小时后 · 11-03 20:15`;<1h 用分钟(最小 1),<24h 用小时,其余用天。 */
|
|
131
|
+
const fmtReset = (ts) => {
|
|
132
|
+
if (!Number.isFinite(ts) || ts <= 0) return null
|
|
133
|
+
const date = new Date(ts)
|
|
134
|
+
const pad = (value) => String(value).padStart(2, '0')
|
|
135
|
+
const time = `${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`
|
|
136
|
+
const minutes = Math.max(1, Math.round((Number(ts) - Date.now()) / 60000))
|
|
137
|
+
const label = minutes < 60
|
|
138
|
+
? tr('{n} 分钟后', { n: minutes })
|
|
139
|
+
: minutes < 1440
|
|
140
|
+
? tr('{n} 小时后', { n: Math.round(minutes / 60) })
|
|
141
|
+
: tr('{n} 天后', { n: Math.round(minutes / 1440) })
|
|
142
|
+
return `${label} · ${time}`
|
|
143
|
+
}
|
|
131
144
|
const budgetColor = (state) => (state === 'over' ? T.over : state === 'warn' ? T.warn : T.accent)
|
|
132
145
|
const percentColor = (value) => (value >= 100 ? T.over : value >= 80 ? T.warn : T.accent)
|
|
133
146
|
const sourceLabel = (source) => String(source ?? '').includes('community') ? tr('社区') : tr('内置兜底')
|
|
@@ -270,7 +283,7 @@ window.__ModuleLoader__.load({
|
|
|
270
283
|
num: { fontWeight: 600, fontVariantNumeric: 'tabular-nums' },
|
|
271
284
|
panel: {
|
|
272
285
|
position: 'absolute', bottom: 'calc(100% + 8px)', left: 0,
|
|
273
|
-
width: 'min(
|
|
286
|
+
width: 'min(360px, calc(100vw - 16px))', boxSizing: 'border-box', maxHeight: '70vh',
|
|
274
287
|
overflow: 'auto', zIndex: 9999, padding: 12, borderRadius: 12,
|
|
275
288
|
background: 'var(--dsw-alias-bg-layer-2, var(--dsh-bg-elevated, #1f1f1f))', color: T.text,
|
|
276
289
|
border: `1px solid ${T.border}`, boxShadow: '0 12px 40px rgba(0,0,0,.35)', fontSize: 12, outline: 'none',
|
|
@@ -301,7 +314,8 @@ window.__ModuleLoader__.load({
|
|
|
301
314
|
},
|
|
302
315
|
section: { background: T.section, borderRadius: 10, padding: 10, marginTop: 10, display: 'grid', gridTemplateColumns: 'minmax(0,1fr)', alignContent: 'start', gap: 6, minWidth: 0 },
|
|
303
316
|
sectionHead: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 6, minHeight: 20 },
|
|
304
|
-
budgetRow: { display: 'grid',
|
|
317
|
+
budgetRow: { display: 'grid', gap: 4, padding: '3px 0', fontSize: 10.5 },
|
|
318
|
+
budgetHead: { display: 'grid', gridTemplateColumns: 'minmax(0,1fr) 34px minmax(0,1fr) 72px', alignItems: 'center', columnGap: 6 },
|
|
305
319
|
budgetName: { fontSize: 12, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
|
|
306
320
|
quotaRow: { display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap', minHeight: 22, fontSize: 11 },
|
|
307
321
|
quotaName: { fontSize: 12, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth: 88 },
|
|
@@ -489,9 +503,9 @@ window.__ModuleLoader__.load({
|
|
|
489
503
|
}))
|
|
490
504
|
}
|
|
491
505
|
|
|
492
|
-
function MiniBar({ ratio = 0, neutral = false }) {
|
|
506
|
+
function MiniBar({ ratio = 0, neutral = false, stretch = false }) {
|
|
493
507
|
return h('span', {
|
|
494
|
-
style: { display: 'block', width: 48, height: 4, borderRadius: 999, overflow: 'hidden', background: 'color-mix(in srgb, var(--dsw-alias-label-primary, #eee) 10%, transparent)' },
|
|
508
|
+
style: { display: 'block', width: stretch ? '100%' : 48, height: 4, borderRadius: 999, overflow: 'hidden', background: 'color-mix(in srgb, var(--dsw-alias-label-primary, #eee) 10%, transparent)' },
|
|
495
509
|
}, h('span', { style: {
|
|
496
510
|
display: 'block', height: '100%', width: `${Math.max(0, Math.min(100, (Number(ratio) || 0) * 100))}%`,
|
|
497
511
|
borderRadius: 999, background: neutral ? 'color-mix(in srgb, currentColor 30%, transparent)' : T.accent,
|
|
@@ -596,7 +610,7 @@ window.__ModuleLoader__.load({
|
|
|
596
610
|
const measurePanel = useCallback(() => {
|
|
597
611
|
const rect = pillRef.current?.getBoundingClientRect()
|
|
598
612
|
if (rect === undefined) return
|
|
599
|
-
const width = Math.min(
|
|
613
|
+
const width = Math.min(360, window.innerWidth - 16)
|
|
600
614
|
setPanelShift(Math.min(0, window.innerWidth - 8 - rect.left - width))
|
|
601
615
|
const available = Math.round(rect.top) - 16
|
|
602
616
|
setPanelMaxHeight(`${Math.max(200, Math.min(window.innerHeight * 0.7, available))}px`)
|
|
@@ -760,30 +774,44 @@ window.__ModuleLoader__.load({
|
|
|
760
774
|
const hasBudget = budget !== undefined && budget.state !== 'unset' && budget.amount > 0
|
|
761
775
|
const color = budgetColor(budget?.state)
|
|
762
776
|
return h('div', { 'data-testid': `token-dash-api-row-${provider.id}`, style: styles.budgetRow },
|
|
763
|
-
h('
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
777
|
+
h('div', { style: styles.budgetHead },
|
|
778
|
+
h('span', { style: styles.budgetName, title: provider.name }, provider.name),
|
|
779
|
+
h('span', { style: { color, fontWeight: 600, fontVariantNumeric: 'tabular-nums', whiteSpace: 'nowrap' } },
|
|
780
|
+
hasBudget ? fmtRatio(budget.percent) : tr('未设置')),
|
|
781
|
+
h('span', { 'data-testid': `token-dash-budget-cost-${provider.id}`, style: { color: T.muted, fontVariantNumeric: 'tabular-nums', whiteSpace: 'nowrap' } },
|
|
782
|
+
hasBudget ? `${fmtMoney(budget.used, provider.currency)}/${fmtMoney(budget.amount, provider.currency)}` : '—'),
|
|
783
|
+
h('span', { 'data-testid': `token-dash-budget-balance-${provider.id}`, style: { textAlign: 'left', color: T.muted, fontVariantNumeric: 'tabular-nums', whiteSpace: 'nowrap' } },
|
|
784
|
+
`${tr('余额 {value}', { value: balanceText(provider, true) ?? '—' })}`)),
|
|
785
|
+
h('div', { 'data-testid': `token-dash-budget-bar-${provider.id}` },
|
|
786
|
+
h(MiniBar, { ratio: hasBudget ? budget.percent : 1, neutral: !hasBudget, stretch: true })))
|
|
771
787
|
}
|
|
772
788
|
|
|
773
|
-
|
|
789
|
+
/** 重置时间标准块:`3 小时后 · 11-03 20:15 重置`,P2 订阅行与 P3 共用。 */
|
|
790
|
+
function ResetLabel({ ts, style }) {
|
|
791
|
+
const text = fmtReset(ts)
|
|
792
|
+
if (text === null) return null
|
|
793
|
+
return h('span', { 'data-testid': 'token-dash-reset', style: style ?? { marginLeft: 'auto', color: T.weak, fontSize: 10.5 } },
|
|
794
|
+
`${text} ${tr('重置')}`)
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function QuotaRow({ provider, reset = false, heading = true }) {
|
|
774
798
|
const windows = Array.isArray(provider.windows) ? provider.windows : []
|
|
775
|
-
const
|
|
799
|
+
const resetTs = reset && windows.length > 0 ? windows[windows.length - 1].resetAt : null
|
|
800
|
+
const resetNode = resetTs === null ? null : h(ResetLabel, { ts: resetTs })
|
|
776
801
|
return h('div', { 'data-testid': `token-dash-sub-row-${provider.id}`, style: { display: 'grid', gap: 2, padding: '2px 0' } },
|
|
777
|
-
h('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } },
|
|
802
|
+
heading ? h('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } },
|
|
778
803
|
h('span', { style: styles.quotaName, title: provider.name }, provider.name),
|
|
779
|
-
|
|
804
|
+
resetNode) : null,
|
|
780
805
|
windows.length === 0
|
|
781
806
|
? h('span', { style: styles.muted }, tr('套餐查询失败'))
|
|
782
|
-
: h('div', {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
807
|
+
: h('div', {
|
|
808
|
+
'data-testid': `token-dash-quota-windows-${provider.id}`,
|
|
809
|
+
style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, flexWrap: 'wrap' },
|
|
810
|
+
},
|
|
811
|
+
...windows.map((plan) => h('span', { key: plan.key, style: { display: 'inline-flex', alignItems: 'center', gap: 4 } },
|
|
812
|
+
h('span', { style: { color: T.muted } }, windowLabel(plan.key)),
|
|
813
|
+
h('b', { style: { color: percentColor(plan.usedPercent ?? 0), fontVariantNumeric: 'tabular-nums', display: 'inline-block', minWidth: 34 } }, fmtPercent(plan.usedPercent)),
|
|
814
|
+
h(MiniBar, { ratio: (Number(plan.usedPercent) || 0) / 100 })))))
|
|
787
815
|
}
|
|
788
816
|
|
|
789
817
|
function DetailGroup({ rows }) {
|
|
@@ -831,12 +859,12 @@ window.__ModuleLoader__.load({
|
|
|
831
859
|
const hasUsage = usage !== null
|
|
832
860
|
const fixed = []
|
|
833
861
|
if (api.length > 0) {
|
|
834
|
-
fixed.push(h('div', { key: 'api-head', style: styles.sectionHead }, h('b', { style: styles.title }, tr('
|
|
862
|
+
fixed.push(h('div', { key: 'api-head', style: styles.sectionHead }, h('b', { style: styles.title }, tr('本月预算'))))
|
|
835
863
|
fixed.push(...api.map((provider) => h(BudgetRow, { key: provider.id, provider })))
|
|
836
864
|
}
|
|
837
865
|
if (subscriptions.length > 0) {
|
|
838
866
|
fixed.push(h('div', { key: 'sub-head', style: { ...styles.sectionHead, marginTop: 4 } },
|
|
839
|
-
h('b', { style: styles.title }, tr('
|
|
867
|
+
h('b', { style: styles.title }, tr('订阅套餐(账户级)')),
|
|
840
868
|
h(IconButton, { label: tr('重新检测订阅配额'), testid: 'token-dash-rescan', onClick: () => { void onRefreshSubs?.() } },
|
|
841
869
|
h(Icon, { name: 'refresh', size: 12 }))))
|
|
842
870
|
fixed.push(...subscriptions.map((provider) => h(QuotaRow, { key: provider.id, provider, reset: true })))
|
|
@@ -860,9 +888,8 @@ window.__ModuleLoader__.load({
|
|
|
860
888
|
h('div', { style: styles.rangeCard },
|
|
861
889
|
h('div', { style: styles.tile },
|
|
862
890
|
h('div', { style: styles.tileLabel }, tr('总费用')),
|
|
863
|
-
...costEntries.map(([currency, value]) => h('div', { key: currency, style: { ...styles.tileValue, fontSize: 14, color: T.
|
|
864
|
-
pending ? h('div', { key: 'pending', style: { ...styles.tileValue, fontSize: 14, color: T.
|
|
865
|
-
h('div', { style: styles.tileDetail }, tr('按币种'))),
|
|
891
|
+
...costEntries.map(([currency, value]) => h('div', { key: currency, style: { ...styles.tileValue, fontSize: 14, color: T.accent } }, fmtMoney(value.cost, currency))),
|
|
892
|
+
pending ? h('div', { key: 'pending', style: { ...styles.tileValue, fontSize: 14, color: T.accent } }, '—') : null),
|
|
866
893
|
h('div', { style: styles.tile },
|
|
867
894
|
h('div', { style: styles.tileLabel },
|
|
868
895
|
`${tr('真实 Tokens')} `,
|
|
@@ -874,11 +901,7 @@ window.__ModuleLoader__.load({
|
|
|
874
901
|
h('div', { style: styles.tileValue }, pending ? '—' : fmtTokens(total?.tokens ?? 0)),
|
|
875
902
|
h('div', { style: styles.tileDetail }, pending
|
|
876
903
|
? '—'
|
|
877
|
-
:
|
|
878
|
-
input: fmtTokens(total?.input ?? 0),
|
|
879
|
-
cache: fmtTokens(total?.cache ?? 0),
|
|
880
|
-
output: fmtTokens(total?.output ?? 0),
|
|
881
|
-
})))),
|
|
904
|
+
: `${fmtTokens(total?.input ?? 0)} · ${fmtTokens(total?.cache ?? 0)} · ${fmtTokens(total?.output ?? 0)}`))),
|
|
882
905
|
!hasUsage && loading ? h('div', { style: styles.empty }, tr('范围数据加载中…')) : null,
|
|
883
906
|
hasUsage && models.length === 0 ? h('div', { style: styles.empty }, tr('范围内暂无消耗')) : null,
|
|
884
907
|
hasUsage && models.length > 0 ? [...groups.entries()].map(([providerId, rows]) => h(DetailGroup, { key: providerId, rows })) : null))
|
|
@@ -1067,9 +1090,14 @@ window.__ModuleLoader__.load({
|
|
|
1067
1090
|
}), h('span', { style: styles.muted }, provider.currency))),
|
|
1068
1091
|
fieldErrors[provider.id] ? h('div', { style: { color: T.over, fontSize: 10.5, textAlign: 'right' }, role: 'alert' }, fieldErrors[provider.id]) : null))
|
|
1069
1092
|
|
|
1070
|
-
const subRows = subscriptions.map((provider) =>
|
|
1071
|
-
|
|
1072
|
-
|
|
1093
|
+
const subRows = subscriptions.map((provider) => {
|
|
1094
|
+
const windows = Array.isArray(provider.windows) ? provider.windows : []
|
|
1095
|
+
const resetTs = windows.length > 0 ? windows[windows.length - 1].resetAt : null
|
|
1096
|
+
return h('div', { key: provider.id, style: { padding: '3px 0' } },
|
|
1097
|
+
h('div', { style: styles.row },
|
|
1098
|
+
h('b', { style: styles.budgetName, title: provider.name }, provider.name),
|
|
1099
|
+
resetTs === null ? null : h(ResetLabel, { ts: resetTs, style: styles.weak })))
|
|
1100
|
+
})
|
|
1073
1101
|
|
|
1074
1102
|
let updateControl
|
|
1075
1103
|
const updateBusy = update.phase === 'checking' || update.phase === 'installing'
|
|
@@ -1101,8 +1129,8 @@ window.__ModuleLoader__.load({
|
|
|
1101
1129
|
|
|
1102
1130
|
const statusText = update.text ?? status?.text ?? tr('版本 {version}', { version })
|
|
1103
1131
|
return h('div', { 'data-testid': 'token-dash-settings', style: { display: 'grid', gridTemplateColumns: 'minmax(0,1fr)', gap: 0, minWidth: 0 } },
|
|
1104
|
-
api.length > 0 ? section(tr('API
|
|
1105
|
-
subscriptions.length > 0 ? section(tr('
|
|
1132
|
+
api.length > 0 ? section(tr('API 计费'), h('div', null, ...apiRows)) : null,
|
|
1133
|
+
subscriptions.length > 0 ? section(tr('订阅'),
|
|
1106
1134
|
h('div', null, ...subRows),
|
|
1107
1135
|
h(IconButton, { label: tr('重新检测订阅配额'), testid: 'token-dash-settings-rescan', disabled: subRefreshing, onClick: refreshSubscriptions }, h(Icon, { name: subRefreshing ? 'loader' : 'refresh', size: 12 }))) : null,
|
|
1108
1136
|
section(tr('显示'), h('div', { style: { display: 'grid', gap: 7 } },
|
package/locale/en.json
CHANGED
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"未定价": "Unpriced",
|
|
38
38
|
"请求": "Req",
|
|
39
39
|
"命中": "Hit",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"本月预算": "Monthly budget",
|
|
41
|
+
"订阅套餐(账户级)": "Subscription plan (account-wide)",
|
|
42
42
|
"重新检测订阅配额": "Recheck subscription quota",
|
|
43
43
|
"未检测到已配置供应商": "No configured provider detected",
|
|
44
44
|
"供应商探测失败": "Provider probe failed",
|
|
@@ -47,9 +47,7 @@
|
|
|
47
47
|
"范围数据加载失败": "Range data failed to load",
|
|
48
48
|
"重试": "Retry",
|
|
49
49
|
"总费用": "Total cost",
|
|
50
|
-
"按币种": "By currency",
|
|
51
50
|
"真实 Tokens": "Real Tokens",
|
|
52
|
-
"入 {input} · 缓存 {cache} · 出 {output}": "In {input} · Cache {cache} · Out {output}",
|
|
53
51
|
"范围数据加载中…": "Loading range data…",
|
|
54
52
|
"范围内暂无消耗": "No usage in this range",
|
|
55
53
|
"Tokens 括号说明": "Tokens bracket legend",
|
|
@@ -76,6 +74,9 @@
|
|
|
76
74
|
"打开日志失败": "Failed to open logs",
|
|
77
75
|
"日志已导出": "Logs exported",
|
|
78
76
|
"日志导出失败": "Log export failed",
|
|
77
|
+
"{n} 分钟后": "in {n} min",
|
|
78
|
+
"{n} 小时后": "in {n} h",
|
|
79
|
+
"{n} 天后": "in {n} d",
|
|
79
80
|
"数据": "Data",
|
|
80
81
|
"备份与恢复": "Backup and restore",
|
|
81
82
|
"导出数据": "Export data",
|
|
@@ -99,8 +100,7 @@
|
|
|
99
100
|
"更新失败({reason})": "Update failed ({reason})",
|
|
100
101
|
"已更新到 {version},重启 DSH 后生效": "Updated to {version}; restart DSH to apply",
|
|
101
102
|
"已更新,重启 DSH 后生效": "Updated; restart DSH to apply",
|
|
102
|
-
"API
|
|
103
|
-
"订阅(已检测 {count})": "Subscription ({count} detected)",
|
|
103
|
+
"API 计费": "API billing",
|
|
104
104
|
"发现 {version},点击更新": "Found {version}; click to update",
|
|
105
105
|
"版本 {version}": "Version {version}",
|
|
106
106
|
"{name} · {action} Token 看板": "{name} · {action} Token dashboard",
|
package/locale/zh.json
CHANGED
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"未定价": "未定价",
|
|
38
38
|
"请求": "请求",
|
|
39
39
|
"命中": "命中",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"本月预算": "本月预算",
|
|
41
|
+
"订阅套餐(账户级)": "订阅套餐(账户级)",
|
|
42
42
|
"重新检测订阅配额": "重新检测订阅配额",
|
|
43
43
|
"未检测到已配置供应商": "未检测到已配置供应商",
|
|
44
44
|
"供应商探测失败": "供应商探测失败",
|
|
@@ -47,9 +47,7 @@
|
|
|
47
47
|
"范围数据加载失败": "范围数据加载失败",
|
|
48
48
|
"重试": "重试",
|
|
49
49
|
"总费用": "总费用",
|
|
50
|
-
"按币种": "按币种",
|
|
51
50
|
"真实 Tokens": "真实 Tokens",
|
|
52
|
-
"入 {input} · 缓存 {cache} · 出 {output}": "入 {input} · 缓存 {cache} · 出 {output}",
|
|
53
51
|
"范围数据加载中…": "范围数据加载中…",
|
|
54
52
|
"范围内暂无消耗": "范围内暂无消耗",
|
|
55
53
|
"Tokens 括号说明": "Tokens 括号说明",
|
|
@@ -76,6 +74,9 @@
|
|
|
76
74
|
"打开日志失败": "打开日志失败",
|
|
77
75
|
"日志已导出": "日志已导出",
|
|
78
76
|
"日志导出失败": "日志导出失败",
|
|
77
|
+
"{n} 分钟后": "{n} 分钟后",
|
|
78
|
+
"{n} 小时后": "{n} 小时后",
|
|
79
|
+
"{n} 天后": "{n} 天后",
|
|
79
80
|
"数据": "数据",
|
|
80
81
|
"备份与恢复": "备份与恢复",
|
|
81
82
|
"导出数据": "导出数据",
|
|
@@ -99,8 +100,7 @@
|
|
|
99
100
|
"更新失败({reason})": "更新失败({reason})",
|
|
100
101
|
"已更新到 {version},重启 DSH 后生效": "已更新到 {version},重启 DSH 后生效",
|
|
101
102
|
"已更新,重启 DSH 后生效": "已更新,重启 DSH 后生效",
|
|
102
|
-
"API
|
|
103
|
-
"订阅(已检测 {count})": "订阅(已检测 {count})",
|
|
103
|
+
"API 计费": "API 计费",
|
|
104
104
|
"发现 {version},点击更新": "发现 {version},点击更新",
|
|
105
105
|
"版本 {version}": "版本 {version}",
|
|
106
106
|
"{name} · {action} Token 看板": "{name} · {action} Token 看板",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-token-dash",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "DeepSeek Harness Token 看板:月度预算与订阅配额、账户余额、时间范围费用与真实 Tokens 明细,支持本地 JSON 导出 / 导入备份。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"exports": {
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"client.js",
|
|
15
15
|
"src",
|
|
16
16
|
"locale",
|
|
17
|
-
"docs/pic",
|
|
18
17
|
"cordis.patch.yml",
|
|
19
18
|
"README.md",
|
|
20
19
|
"LICENSE",
|
|
@@ -44,6 +43,8 @@
|
|
|
44
43
|
"test": "node --test test/unit/*.test.mjs",
|
|
45
44
|
"e2e": "node scripts/e2e.mjs",
|
|
46
45
|
"logs": "node tools/logs.mjs",
|
|
46
|
+
"shots": "node tools/mock/shots.mjs",
|
|
47
|
+
"icon": "node tools/mock/icon.mjs",
|
|
47
48
|
"pack": "node -e \"require('fs').mkdirSync('build',{recursive:true})\" && npm pack --pack-destination build",
|
|
48
49
|
"prepublishOnly": "npm test"
|
|
49
50
|
},
|
|
Binary file
|
package/docs/pic/pill-home.png
DELETED
|
Binary file
|
|
Binary file
|
package/docs/pic/settings.png
DELETED
|
Binary file
|