dsh-token-dash 2.0.0 → 2.0.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 +16 -14
- package/README.md +12 -11
- package/client.js +33 -21
- package/package.json +1 -1
- package/src/providers.js +2 -2
package/README.en.md
CHANGED
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
|
|
35
35
|
| Provider | Billing | Credential | What you get |
|
|
36
36
|
|---|---|---|---|
|
|
37
|
-
| DeepSeek |
|
|
38
|
-
| Zhipu GLM Coding | Subscription / API | `ZHIPU_API_KEY` / `GLM_API_KEY` / `ZAI_API_KEY` | 5h + weekly windows |
|
|
39
|
-
| Kimi Coding | Subscription / API | `KIMI_API_KEY` / `KIMI_CODING_API_KEY`, optional `MOONSHOT_API_KEY` | 5h + weekly/monthly windows; falls back to balance |
|
|
40
|
-
| OpenRouter |
|
|
41
|
-
| Qwen |
|
|
37
|
+
| DeepSeek | API usage | DS account wallet / `DEEPSEEK_API_KEY` | Balance, month-to-date spend, budget |
|
|
38
|
+
| Zhipu GLM Coding | Subscription / API usage | `ZHIPU_API_KEY` / `GLM_API_KEY` / `ZAI_API_KEY` | 5h + weekly windows |
|
|
39
|
+
| Kimi Coding | Subscription / API usage | `KIMI_API_KEY` / `KIMI_CODING_API_KEY`, optional `MOONSHOT_API_KEY` | 5h + weekly/monthly windows; falls back to balance |
|
|
40
|
+
| OpenRouter | API usage | `OPENROUTER_API_KEY` | Credits (USD) |
|
|
41
|
+
| Qwen | API usage | `DASHSCOPE_API_KEY` (CNY) / `DASHSCOPE_INTL_API_KEY` (USD) | Usage only; balance unsupported |
|
|
42
42
|
| OpenCode Go | Subscription | `OPENCODE_GO_API_KEY` | 5h / weekly / monthly windows (USD) |
|
|
43
43
|
| Command Code | Subscription | `COMMAND_CODE_API_KEY` + `COMMAND_CODE_ORG_ID` | 5h + weekly windows, credits (CNY) |
|
|
44
44
|
|
|
@@ -51,28 +51,28 @@
|
|
|
51
51
|
|
|
52
52
|
Screenshots use mock data so the full layout is visible at once.
|
|
53
53
|
|
|
54
|
-
**P1 · Composer footer-right Pill**:
|
|
54
|
+
**P1 · Composer footer-right Pill**: API usage / subscription variants; click to open, click outside, `×` or `Esc` to close.
|
|
55
55
|
|
|
56
56
|
<p align="center">
|
|
57
|
-
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-api.png" alt="
|
|
57
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/en/pill-api.png" alt="API usage pill" />
|
|
58
58
|
</p>
|
|
59
59
|
|
|
60
60
|
<p align="center">
|
|
61
|
-
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-sub.png" alt="Subscription pill" />
|
|
61
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/en/pill-sub.png" alt="Subscription pill" />
|
|
62
62
|
</p>
|
|
63
63
|
|
|
64
64
|
**P2 · Floating panel (current model)**: fixed 380, one row with three groups — used ring / used-budget / real balance — with the balance right-aligned to the panel edge, a full-width range control and the usage table.
|
|
65
65
|
|
|
66
66
|
<p align="center">
|
|
67
|
-
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-api.png" alt="Floating panel -
|
|
67
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/en/panel-api.png" alt="Floating panel - API usage" />
|
|
68
68
|
</p>
|
|
69
69
|
|
|
70
70
|
<p align="center">
|
|
71
|
-
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-sub-2.png" alt="Floating panel - two subscription windows" />
|
|
71
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/en/panel-sub-2.png" alt="Floating panel - two subscription windows" />
|
|
72
72
|
</p>
|
|
73
73
|
|
|
74
74
|
<p align="center">
|
|
75
|
-
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-sub-3.png" alt="Floating panel - three subscription windows" />
|
|
75
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/en/panel-sub-3.png" alt="Floating panel - three subscription windows" />
|
|
76
76
|
</p>
|
|
77
77
|
|
|
78
78
|
- Subscription windows use three slots: first left, second center, third right; two windows occupy the first two slots.
|
|
@@ -81,10 +81,10 @@ Screenshots use mock data so the full layout is visible at once.
|
|
|
81
81
|
**P3 · Full dashboard**: cards for 7 providers, summary band, 8-column model breakdown and a settings capsule; the page owns its scrollbar at the window edge.
|
|
82
82
|
|
|
83
83
|
<p align="center">
|
|
84
|
-
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/settings.png" alt="Full dashboard" />
|
|
84
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/en/settings.png" alt="Full dashboard" />
|
|
85
85
|
</p>
|
|
86
86
|
|
|
87
|
-
-
|
|
87
|
+
- API usage card: budget input, planned balance, real balance, month-to-date spend; subscription card: one ring per window with remaining percentage and countdown.
|
|
88
88
|
- Breakdown: model / Tokens / input / cache / output / requests / hit rate / cost; everything except the model column is right-aligned.
|
|
89
89
|
- Settings capsule: refresh interval + account-balance toggle; logs, export/import, price table and version below.
|
|
90
90
|
- The settings section has an external "Settings and data" title above the capsule; the capsule itself keeps the refresh interval, logs/data controls and version row.
|
|
@@ -112,6 +112,7 @@ Update: run `update` with the same name, or use the `⤓` button on the right of
|
|
|
112
112
|
## Compatibility & limitations
|
|
113
113
|
|
|
114
114
|
- DSH `0.2.1+`; verified on `0.2.2-rc.1`. DSH 0.2.2 is a pre-release and itself requires Node 24.9.
|
|
115
|
+
- The UI currently ships Chinese / English only. Other DSH languages (Japanese, German, Russian, etc.) fall back to English.
|
|
115
116
|
- After a DSH upgrade the plugin may disappear from the profile; reinstall the same tarball — the ledger is not deleted.
|
|
116
117
|
- Qwen tracks usage only; its balance endpoint is unsupported. Other balances/quotas follow what each API returns.
|
|
117
118
|
- Upstream APIs are rate-limited; successful results are cached for 60s, failures for 10s, and concurrent requests are coalesced.
|
|
@@ -145,7 +146,8 @@ Common events:
|
|
|
145
146
|
```bash
|
|
146
147
|
npm test # unit tests (80 passing)
|
|
147
148
|
npm run e2e # end-to-end (temp DSH_HOME + web profile + Playwright)
|
|
148
|
-
npm run shots
|
|
149
|
+
npm run shots # regenerate the Chinese P1/P2/P3 screenshots in docs/pic
|
|
150
|
+
npm run shots -- --en # regenerate the English screenshots in docs/pic/en
|
|
149
151
|
npm run pack # build the release tarball into build/
|
|
150
152
|
```
|
|
151
153
|
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
在 DSH 输入框旁看清今天的模型消耗、本月的预算余量,以及 7 家供应商的订阅窗口。<br />
|
|
13
|
-
填 Key
|
|
13
|
+
填 Key 自动识别订阅或 API 用量;费用、Tokens、缓存命中全部在本地估算;<br />
|
|
14
14
|
当月数据可导出备份,换机或重装后一键导入恢复。
|
|
15
15
|
</p>
|
|
16
16
|
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
|
|
35
35
|
| 供应商 | 计费形态 | 凭据 | 能看到什么 |
|
|
36
36
|
|---|---|---|---|
|
|
37
|
-
| DeepSeek |
|
|
38
|
-
|
|
|
39
|
-
| Kimi Coding | 订阅 /
|
|
40
|
-
| OpenRouter |
|
|
41
|
-
|
|
|
37
|
+
| DeepSeek | API 用量 | DS 账号钱包 / `DEEPSEEK_API_KEY` | 账户余额、本月已花、预算 |
|
|
38
|
+
| Zhipu GLM Coding | 订阅 / API 用量 | `ZHIPU_API_KEY` / `GLM_API_KEY` / `ZAI_API_KEY` | 5h + 周窗口 |
|
|
39
|
+
| Kimi Coding | 订阅 / API 用量 | `KIMI_API_KEY` / `KIMI_CODING_API_KEY`,可选 `MOONSHOT_API_KEY` | 5h + 周/月窗口;订阅查询失败可回落余额 |
|
|
40
|
+
| OpenRouter | API 用量 | `OPENROUTER_API_KEY` | Credits(USD) |
|
|
41
|
+
| Qwen | API 用量 | `DASHSCOPE_API_KEY`(CNY)/ `DASHSCOPE_INTL_API_KEY`(USD) | 仅用量;余额不支持 |
|
|
42
42
|
| OpenCode Go | 订阅 | `OPENCODE_GO_API_KEY` | 5h / 周 / 月窗口(USD) |
|
|
43
43
|
| Command Code | 订阅 | `COMMAND_CODE_API_KEY` + `COMMAND_CODE_ORG_ID` | 5h + 周窗口、Credits(CNY) |
|
|
44
44
|
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
|
|
52
52
|
以下截图使用假数据演示,便于一次看到完整效果。
|
|
53
53
|
|
|
54
|
-
**P1 · 输入框底栏右侧 Pill
|
|
54
|
+
**P1 · 输入框底栏右侧 Pill**:API 用量 / 订阅两种形态,点击展开浮层,点击外部、`×` 或 `Esc` 收起。
|
|
55
55
|
|
|
56
56
|
<p align="center">
|
|
57
|
-
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-api.png" alt="
|
|
57
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-api.png" alt="API 用量 Pill" />
|
|
58
58
|
</p>
|
|
59
59
|
|
|
60
60
|
<p align="center">
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
**P2 · 浮层(当前模型)**:固定 380,单行三组「已用环 / 已用·预算 / 真实余额」,真实余额右对齐到面板右缘;时间范围撑满,下面是用量表。
|
|
65
65
|
|
|
66
66
|
<p align="center">
|
|
67
|
-
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-api.png" alt="浮层 ·
|
|
67
|
+
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-api.png" alt="浮层 · API 用量形态" />
|
|
68
68
|
</p>
|
|
69
69
|
|
|
70
70
|
<p align="center">
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
<img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/settings.png" alt="整页看板" />
|
|
85
85
|
</p>
|
|
86
86
|
|
|
87
|
-
-
|
|
87
|
+
- API 用量卡:预算输入、计划余额、真实余额、本月已花;订阅卡:每个窗口一个环 + 剩余百分比 + 倒计时。
|
|
88
88
|
- 明细表:模型 / Tokens / 输入 / 缓存 / 输出 / 请求 / 命中 / 费用;除模型列外全部右对齐。
|
|
89
89
|
- 设置区:胶囊外是「设置与数据管理」区块标题;胶囊内第一行刷新间隔 + 账户余额开关,下面是日志、导出导入、价格表与版本。
|
|
90
90
|
- 间距只使用 4 / 8 / 12 / 16 / 24 / 32 六档,P2 / P3 同一套 token。
|
|
@@ -111,8 +111,9 @@ dsh plugin --profile desktop add /path/to/dsh-token-dash-x.y.z.tgz
|
|
|
111
111
|
## 兼容与限制
|
|
112
112
|
|
|
113
113
|
- DSH `0.2.1+`;已在 `0.2.2-rc.1` 上验证。DSH 0.2.2 是预发布版,且自身要求 Node 24.9。
|
|
114
|
+
- 界面语言当前仅中文 / English;选择日语、德语、俄语等其他 DSH 语言时,插件文案显示英文回退。
|
|
114
115
|
- 升级 DSH 后插件可能从 profile 消失,重装同一个 tarball 即可,账本不会被删。
|
|
115
|
-
-
|
|
116
|
+
- Qwen 只统计用量,余额接口不支持;其余供应商的余额/配额以接口实际返回为准。
|
|
116
117
|
- 上游接口有速率限制;成功结果缓存 60s、失败结果缓存 10s,并发请求会合并。
|
|
117
118
|
|
|
118
119
|
## 数据与隐私
|
package/client.js
CHANGED
|
@@ -45,9 +45,9 @@ window.__ModuleLoader__.load({
|
|
|
45
45
|
'社区': 'Community', '内置兜底': 'Built-in fallback',
|
|
46
46
|
'查询失败': 'Query failed', '套餐查询失败': 'Quota query failed',
|
|
47
47
|
'周': 'Week', '月': 'Month', '重置': 'Reset',
|
|
48
|
-
'
|
|
48
|
+
'API 用量': 'API usage', '订阅': 'Subscription', '账户套餐': 'Account plan',
|
|
49
49
|
'预算': 'Budget', '未设置': 'Not set', '今日 {value}': 'Today {value}',
|
|
50
|
-
'余额 {value}': 'Balance {value}', '预算已用 {value}': 'Budget used {value}',
|
|
50
|
+
'余额': 'Balance', '余额 {value}': 'Balance {value}', '预算已用 {value}': 'Budget used {value}',
|
|
51
51
|
'预算未设置': 'Budget not set', '收起': 'Collapse', '展开': 'Expand',
|
|
52
52
|
'Token 看板': 'Token dashboard', '点击查看 Token 看板': 'Click to view Token dashboard',
|
|
53
53
|
'Token 看板:{text}': 'Token dashboard: {text}',
|
|
@@ -56,12 +56,12 @@ window.__ModuleLoader__.load({
|
|
|
56
56
|
'目前支持 DeepSeek / Kimi / GLM / OpenRouter / Qwen API Key': 'Supports DeepSeek / Kimi / GLM / OpenRouter / Qwen API Keys',
|
|
57
57
|
'刷新': 'Refresh', '关闭': 'Close',
|
|
58
58
|
'未定价': 'Unpriced', '请求': 'Req', '命中': 'Hit',
|
|
59
|
-
'
|
|
59
|
+
'API 用量(按供应商)': 'API usage (by provider)',
|
|
60
60
|
'订阅套餐(按供应商)': 'Subscription plans (by provider)',
|
|
61
61
|
'名称': 'Name', '已用': 'Used', '已用 / 预算': 'Used / budget', '计划余额': 'Planned left', '真实余额': 'Real balance',
|
|
62
62
|
'剩余 {value}': '{value} left', '本月已花': 'Spent this month',
|
|
63
63
|
'今日': 'Today', '总费用': 'Total cost', '重试': 'Retry',
|
|
64
|
-
'模型': 'Model', '共 {n} 个模型': 'Total {n} models', '窗': 'windows', '数据来源': 'Data source', '数据来自本机会话记录,费用与 Tokens 均在本地估算': 'Estimated locally from local session records', '范围与明细': 'Range & details', '输入': 'In', '缓存': 'Cache', '输出': 'Out', '费用': 'Cost',
|
|
64
|
+
'模型用量明细': 'Model usage details', '模型': 'Model', '共 {n} 个模型': 'Total {n} models', '窗': 'windows', '数据来源': 'Data source', '数据来自本机会话记录,费用与 Tokens 均在本地估算': 'Estimated locally from local session records', '范围与明细': 'Range & details', '输入': 'In', '缓存': 'Cache', '输出': 'Out', '费用': 'Cost',
|
|
65
65
|
'费用(API 计价估算)': 'Cost (API estimate)',
|
|
66
66
|
'重新检测订阅配额': 'Recheck subscription quota',
|
|
67
67
|
'未检测到已配置供应商': 'No configured provider detected',
|
|
@@ -85,6 +85,7 @@ window.__ModuleLoader__.load({
|
|
|
85
85
|
'日志已导出': 'Logs exported', '日志导出失败': 'Log export failed',
|
|
86
86
|
'数据': 'Data', '备份与恢复': 'Backup and restore',
|
|
87
87
|
'{n} 分钟后': 'in {n} min', '{n} 小时后': 'in {n} h', '{n} 天后': 'in {n} d',
|
|
88
|
+
'导出数据': 'Export data', '导入数据': 'Import data', '版本': 'Version',
|
|
88
89
|
'导入中…': 'Importing…', '数据已导出': 'Data exported', '数据导出失败': 'Data export failed',
|
|
89
90
|
'已导入 {month} 数据': 'Imported {month} data', '导入失败:{reason}': 'Import failed: {reason}',
|
|
90
91
|
'检查失败': 'Check failed', '未发布': 'Not published', '已是最新': 'Up to date',
|
|
@@ -98,12 +99,13 @@ window.__ModuleLoader__.load({
|
|
|
98
99
|
'版本 {version}': 'Version {version}',
|
|
99
100
|
'{name} · {action} Token 看板': '{name} · {action} Token dashboard',
|
|
100
101
|
'{name} 月度预算': '{name} monthly budget',
|
|
101
|
-
'{name}
|
|
102
|
+
'{name},API 用量,{budget},今日 {today}{balance}': '{name}, API usage, {budget}, today {today}{balance}',
|
|
102
103
|
'{name},订阅,账户套餐,{value}': '{name}, subscription, account plan, {value}',
|
|
103
104
|
'更新于 {time}': 'Updated {time}', '数据来自本机会话记录': 'From local session records',
|
|
104
105
|
'未配置凭据': 'No credentials', '刷新中': 'Refreshing',
|
|
105
106
|
'编辑预算': 'Edit budget', '退出编辑': 'Exit editing',
|
|
106
107
|
'设置与数据管理': 'Settings and data',
|
|
108
|
+
'语言跟随DSH设置;当前仅中文/English,其他语言回退英文': 'Language follows DSH settings; Chinese/English only; other languages fall back to English',
|
|
107
109
|
'账户真实余额,不受预算影响': 'Account balance; not affected by budget',
|
|
108
110
|
'本月累计消耗,等于已用/预算 的分子': 'Month-to-date spend; numerator of used/budget',
|
|
109
111
|
'提示': 'Note',
|
|
@@ -431,6 +433,8 @@ window.__ModuleLoader__.load({
|
|
|
431
433
|
boardSection: { display: 'grid', gap: 12, minWidth: 0 },
|
|
432
434
|
boardSectionHead: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, minHeight: 24 },
|
|
433
435
|
sectionTitle: { fontSize: 13, fontWeight: 600 },
|
|
436
|
+
settingsHead: { display: 'flex', alignItems: 'baseline', flexWrap: 'wrap', gap: 8, minWidth: 0 },
|
|
437
|
+
settingsHint: { color: T.muted, fontSize: 11, lineHeight: '16px', minWidth: 0, overflowWrap: 'anywhere' },
|
|
434
438
|
cardBox: {
|
|
435
439
|
border: `1px solid ${T.border}`, borderRadius: 8, padding: 12, background: T.section,
|
|
436
440
|
display: 'grid', gap: 4, minWidth: 0,
|
|
@@ -636,11 +640,14 @@ window.__ModuleLoader__.load({
|
|
|
636
640
|
} }))
|
|
637
641
|
}
|
|
638
642
|
|
|
639
|
-
function Segmented({ value, options, onChange, label, kind = 'tablist' }) {
|
|
643
|
+
function Segmented({ value, options, onChange, label, kind = 'tablist', fit = false }) {
|
|
640
644
|
const itemRole = kind === 'radiogroup' ? 'radio' : 'tab'
|
|
641
645
|
return h('div', {
|
|
642
646
|
role: kind, 'aria-label': label,
|
|
643
|
-
style: {
|
|
647
|
+
style: {
|
|
648
|
+
display: 'flex', width: fit ? 'max-content' : '100%', height: 28, padding: 2,
|
|
649
|
+
boxSizing: 'border-box', gap: 2, borderRadius: 8, background: T.segment,
|
|
650
|
+
},
|
|
644
651
|
}, options.map((option, index) => {
|
|
645
652
|
const selected = option.value === value
|
|
646
653
|
return h('button', {
|
|
@@ -656,8 +663,8 @@ window.__ModuleLoader__.load({
|
|
|
656
663
|
onChange(options[(index + direction + options.length) % options.length].value)
|
|
657
664
|
},
|
|
658
665
|
style: {
|
|
659
|
-
flex: 1, minWidth: 0, height: 24, padding: '0 4px', borderRadius: 6, border: 'none',
|
|
660
|
-
fontSize: 11, fontWeight: 500, cursor: 'pointer', font: 'inherit',
|
|
666
|
+
flex: fit ? '0 0 auto' : 1, minWidth: 0, height: 24, padding: '0 4px', borderRadius: 6, border: 'none',
|
|
667
|
+
fontSize: 11, fontWeight: 500, cursor: 'pointer', font: 'inherit', whiteSpace: 'nowrap',
|
|
661
668
|
background: selected ? T.segmentOn : 'transparent',
|
|
662
669
|
color: selected ? T.text : T.muted,
|
|
663
670
|
boxShadow: selected ? 'var(--dsw-shadow-lv1, 0 1px 2px rgba(0,0,0,.08))' : 'none',
|
|
@@ -1032,7 +1039,7 @@ window.__ModuleLoader__.load({
|
|
|
1032
1039
|
const current = providers.find((provider) => provider.id === summary?.currentProviderId) ?? providers[0]
|
|
1033
1040
|
let prefix = '[API]'
|
|
1034
1041
|
let bodyNodes = [h('span', { key: 'unknown' }, '--')]
|
|
1035
|
-
let ariaText = tr('
|
|
1042
|
+
let ariaText = tr('API 用量')
|
|
1036
1043
|
if (current?.kind === 'subscription') {
|
|
1037
1044
|
prefix = `[${tr('订阅')}]`
|
|
1038
1045
|
bodyNodes = subscriptionNodes(current)
|
|
@@ -1059,7 +1066,7 @@ window.__ModuleLoader__.load({
|
|
|
1059
1066
|
h('span', { 'data-td-label': true, style: styles.summaryLabel }, tr('余额')),
|
|
1060
1067
|
h('span', { style: styles.num }, balance)),
|
|
1061
1068
|
].filter(Boolean)
|
|
1062
|
-
ariaText = tr('{name}
|
|
1069
|
+
ariaText = tr('{name},API 用量,{budget},今日 {today}{balance}', { name: current.name, budget: hasBudget ? tr('预算已用 {value}', { value: fmtRatio(budget.percent) }) : tr('预算未设置'), today: fmtMoney(current.usage?.todayCost, current.currency), balance: balance === null ? '' : `,${tr('余额 {value}', { value: balance })}` })
|
|
1063
1070
|
}
|
|
1064
1071
|
const hoverTitle = tr('{name} · {action} Token 看板', { name: current?.name ?? '', action: open ? tr('收起') : tr('展开') })
|
|
1065
1072
|
|
|
@@ -1224,7 +1231,7 @@ window.__ModuleLoader__.load({
|
|
|
1224
1231
|
return h(React.Fragment, null,
|
|
1225
1232
|
h('div', { style: styles.providerLine },
|
|
1226
1233
|
h('span', { style: styles.title, title: provider.name }, provider.name),
|
|
1227
|
-
h('span', { style: styles.providerChip }, `[ ${tr('
|
|
1234
|
+
h('span', { style: styles.providerChip }, `[ ${tr('API 用量')} ]`)),
|
|
1228
1235
|
h('div', { 'data-testid': 'token-dash-summary-row', style: styles.summaryRow },
|
|
1229
1236
|
h('span', { style: styles.summaryCell },
|
|
1230
1237
|
h(InlineRing, {
|
|
@@ -1499,7 +1506,7 @@ window.__ModuleLoader__.load({
|
|
|
1499
1506
|
updateControl)))
|
|
1500
1507
|
}
|
|
1501
1508
|
|
|
1502
|
-
/** P3
|
|
1509
|
+
/** P3 API 用量卡:每 provider 一张,竖排 Gauge + 常显预算输入 + 三行字段。 */
|
|
1503
1510
|
function BudgetTable({ providers, prefs, onSave }) {
|
|
1504
1511
|
const [errors, setErrors] = useState({})
|
|
1505
1512
|
const [saving, setSaving] = useState(null)
|
|
@@ -1547,7 +1554,7 @@ window.__ModuleLoader__.load({
|
|
|
1547
1554
|
},
|
|
1548
1555
|
h('div', { style: styles.apiCardHead },
|
|
1549
1556
|
h('span', { style: styles.apiCardName, title: provider.name }, provider.name),
|
|
1550
|
-
h('span', { style: styles.apiChip }, `[ ${tr('
|
|
1557
|
+
h('span', { style: styles.apiChip }, `[ ${tr('API 用量')} ]`)),
|
|
1551
1558
|
h('div', { style: styles.apiGaugeWrap },
|
|
1552
1559
|
h(QuotaGauge, {
|
|
1553
1560
|
label: tr('已用'), percent,
|
|
@@ -1778,7 +1785,7 @@ window.__ModuleLoader__.load({
|
|
|
1778
1785
|
h('span', null, tr('刷新失败,保留上次数据')),
|
|
1779
1786
|
h('button', { type: 'button', style: styles.button, onClick: () => { void refresh() } }, tr('重试'))) : null,
|
|
1780
1787
|
api.length > 0 ? h('section', { style: styles.boardSection },
|
|
1781
|
-
h('div', { style: styles.boardSectionHead }, h('b', { style: styles.sectionTitle }, tr('
|
|
1788
|
+
h('div', { style: styles.boardSectionHead }, h('b', { style: styles.sectionTitle }, tr('API 用量(按供应商)'))),
|
|
1782
1789
|
h(BudgetTable, { providers: api, prefs, onSave: savePrefs })) : null,
|
|
1783
1790
|
subscriptions.length > 0 ? h('section', { style: styles.boardSection },
|
|
1784
1791
|
h('div', { style: styles.boardSectionHead },
|
|
@@ -1795,8 +1802,8 @@ window.__ModuleLoader__.load({
|
|
|
1795
1802
|
h('div', { style: styles.boardSectionHead }, h('b', { style: styles.sectionTitle }, tr('范围与明细'))),
|
|
1796
1803
|
h('div', { style: styles.rangeBox },
|
|
1797
1804
|
h('div', { style: styles.rangeHead },
|
|
1798
|
-
h('div', { style: { width:
|
|
1799
|
-
value: range, onChange: setRange, label: tr('时间范围'),
|
|
1805
|
+
h('div', { style: { width: 'max-content', maxWidth: '100%', flex: '0 0 auto', minWidth: 0 } }, h(Segmented, {
|
|
1806
|
+
value: range, onChange: setRange, label: tr('时间范围'), fit: true,
|
|
1800
1807
|
options: RANGES.map(([value, label]) => ({ value, label: tr(label) })),
|
|
1801
1808
|
})),
|
|
1802
1809
|
h('span', { style: styles.rangeMeta },
|
|
@@ -1811,10 +1818,15 @@ window.__ModuleLoader__.load({
|
|
|
1811
1818
|
})))),
|
|
1812
1819
|
h('section', { style: styles.boardSection },
|
|
1813
1820
|
h('div', { style: styles.boardSectionHead },
|
|
1814
|
-
h('
|
|
1815
|
-
'
|
|
1816
|
-
|
|
1817
|
-
|
|
1821
|
+
h('div', { style: styles.settingsHead },
|
|
1822
|
+
h('b', {
|
|
1823
|
+
'data-testid': 'token-dash-settings-title',
|
|
1824
|
+
style: styles.sectionTitle,
|
|
1825
|
+
}, tr('设置与数据管理')),
|
|
1826
|
+
h('span', {
|
|
1827
|
+
'data-testid': 'token-dash-settings-locale-hint',
|
|
1828
|
+
style: styles.settingsHint,
|
|
1829
|
+
}, tr('语言跟随DSH设置;当前仅中文/English,其他语言回退英文')))),
|
|
1818
1830
|
h('div', { 'data-testid': 'token-dash-settings-capsule', style: styles.capsule },
|
|
1819
1831
|
h(SettingsRows, { summary, prefs, onSave: savePrefs, onRefresh: refresh, onRefreshSubs: refreshSubs })))))
|
|
1820
1832
|
}
|
package/package.json
CHANGED
package/src/providers.js
CHANGED
|
@@ -48,7 +48,7 @@ const PROVIDERS = {
|
|
|
48
48
|
},
|
|
49
49
|
zhipu: {
|
|
50
50
|
id: 'zhipu',
|
|
51
|
-
label: '
|
|
51
|
+
label: 'Zhipu AI',
|
|
52
52
|
currency: 'CNY',
|
|
53
53
|
subscription: true,
|
|
54
54
|
defaultModel: 'glm-5.3',
|
|
@@ -85,7 +85,7 @@ const PROVIDERS = {
|
|
|
85
85
|
},
|
|
86
86
|
qwen: {
|
|
87
87
|
id: 'qwen',
|
|
88
|
-
label: '
|
|
88
|
+
label: 'Qwen',
|
|
89
89
|
currency: 'CNY',
|
|
90
90
|
subscription: false,
|
|
91
91
|
defaultModel: 'qwen3.8-max',
|