@dougen/dsh-deepseek-usage 0.4.2 → 0.4.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.
- package/README.md +4 -4
- package/lib/client.js +2 -3
- package/lib/pricing.js +16 -8
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ DeepSeek **余额侧边栏插件**(DeepSeek Harness Web UI):在 DSH **网
|
|
|
10
10
|
|
|
11
11
|
- **Balance**: `¥ 110.00` large display (symbol follows account currency: `¥` CNY / `$` USD)
|
|
12
12
|
- **Unit pricing**: `→|1.5 ⚡0.05 |→4.5` (input / input cache / output, bottom-right of the card; switches with the active model and peak/off-peak window — **updates instantly when you switch models**)
|
|
13
|
-
- **Peak indicator**: top-right dot, orange during peak hours (9:00–12:00, 14:00–18:00 Beijing Time), green otherwise
|
|
13
|
+
- **Peak indicator**: top-right dot, orange during peak hours (Mon–Fri 9:00–12:00, 14:00–18:00 Beijing Time), green otherwise
|
|
14
14
|
- **Auto refresh**: every 5 minutes; click the card to refresh instantly
|
|
15
15
|
- **i18n**: UI copy follows the DSH locale (Chinese / English)
|
|
16
16
|
- Follows the app light/dark theme
|
|
17
17
|
|
|
18
18
|
- **余额**:`¥ 110.00` 大字显示(符号随账号币种自动切换:人民币 `¥` / 美元 `$`)
|
|
19
19
|
- **档单价**:`→|1.5 ⚡0.05 |→4.5`(输入 / 输入缓存 / 输出,位于卡片右下角;随当前启用模型与峰谷时段自动切换,**切换模型时立即同步**)
|
|
20
|
-
-
|
|
20
|
+
- **峰谷指示灯**:卡片右上角,高峰(周一至周五 9:00–12:00、14:00–18:00 北京时间)橙色,空闲绿色
|
|
21
21
|
- **自动刷新**:每 5 分钟一次;点击卡片任意位置立即刷新
|
|
22
22
|
- **多语言**:界面文案跟随 DSH 语言(中文 / English)
|
|
23
23
|
- 跟随应用明暗主题
|
|
@@ -47,12 +47,12 @@ Restart the web app (`dsh web`), open http://127.0.0.1:3080 , and the usage card
|
|
|
47
47
|
| Data | Source |
|
|
48
48
|
|---|---|
|
|
49
49
|
| Balance | Official DeepSeek API `GET /user/balance` (uses `DEEPSEEK_API_KEY` configured in DSH) |
|
|
50
|
-
| Unit pricing / peak window | Built-in price table (DeepSeek official peak/off-peak pricing snapshot, effective 2026-08-
|
|
50
|
+
| Unit pricing / peak window | Built-in price table (DeepSeek official peak/off-peak pricing snapshot, effective 2026-08-21) |
|
|
51
51
|
|
|
52
52
|
| 数据 | 来源 |
|
|
53
53
|
|---|---|
|
|
54
54
|
| 余额 | DeepSeek 官方 API `GET /user/balance`(使用 DSH 中已配置的 `DEEPSEEK_API_KEY`) |
|
|
55
|
-
| 档单价 / 峰谷时段 | 内置价格表(DeepSeek 官方峰谷定价快照,2026-08-
|
|
55
|
+
| 档单价 / 峰谷时段 | 内置价格表(DeepSeek 官方峰谷定价快照,2026-08-21 起) |
|
|
56
56
|
|
|
57
57
|
Make sure `DEEPSEEK_API_KEY` is configured in DSH (Model settings page) before use.
|
|
58
58
|
|
package/lib/client.js
CHANGED
|
@@ -168,9 +168,8 @@ window.__ModuleLoader__.load({
|
|
|
168
168
|
background: data && data.peak ? C.peak : C.idle,
|
|
169
169
|
boxShadow: "0 0 4px rgba(0,0,0,.3)",
|
|
170
170
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
: t("peak.off");
|
|
171
|
+
// 指示灯 hover 文案:仅状态文字,不附加具体时段(与空闲一致)。
|
|
172
|
+
const peakTitle = data && data.peak ? t("peak.peak") : t("peak.off");
|
|
174
173
|
|
|
175
174
|
if (!wide) {
|
|
176
175
|
return h("div", {
|
package/lib/pricing.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-deepseek-usage — 定价表(元 / 百万 tokens)。
|
|
3
3
|
*
|
|
4
|
-
* DeepSeek 官方价格快照(2026-08-
|
|
5
|
-
*
|
|
4
|
+
* DeepSeek 官方价格快照(2026-08-21 起 V4 系列峰谷定价,北京时间):
|
|
5
|
+
* 高峰时段为周一至周五 9:00–12:00 与 14:00–18:00(北京时间),
|
|
6
|
+
* 周六周日与其余时间均为空闲时段(空闲=高峰半价)。
|
|
6
7
|
* 缓存写暂不计费(cacheWrite = 0);未知模型回退 chat 档,并通过 unitAt().known
|
|
7
8
|
* 与 isKnownModel() 让调用方提示用户,而不是静默算错。
|
|
8
9
|
* 价格调整时只需改 PRICE_TABLE 与 PEAK_WINDOWS。
|
|
9
10
|
*
|
|
10
11
|
* 本文件用于卡片"当前档单价"展示与峰谷指示灯。
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* 时区:峰谷判定按北京时间(Asia/Shanghai,固定 UTC+8,无夏令时)计算,
|
|
14
|
+
* 不随服务器本地时区变化——在任何时区部署的 DSH 上显示一致。
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
/** 北京时间固定偏移(上海无夏令时)。 */
|
|
@@ -28,20 +29,27 @@ const PRICE_TABLE = {
|
|
|
28
29
|
/** 默认模型(当 agentDefaultModel 不可用时的展示默认)。 */
|
|
29
30
|
export const DEFAULT_MODEL = 'deepseek-v4-flash';
|
|
30
31
|
|
|
31
|
-
/**
|
|
32
|
+
/** 高峰时段窗口(北京时间,含起点不含终点;仅周一至周五生效)。 */
|
|
32
33
|
export const PEAK_WINDOWS = [[9, 12], [14, 18]];
|
|
33
34
|
/** 高峰时段展示文案(中文)。 */
|
|
34
|
-
export const PEAK_HOURS_TEXT = '9:00–12:00、14:00–18:00(北京时间)';
|
|
35
|
+
export const PEAK_HOURS_TEXT = '周一至周五 9:00–12:00、14:00–18:00(北京时间)';
|
|
35
36
|
/** 高峰时段展示文案(英文)。 */
|
|
36
|
-
export const PEAK_HOURS_TEXT_EN = '9:00–12:00, 14:00–18:00 (Beijing Time)';
|
|
37
|
+
export const PEAK_HOURS_TEXT_EN = 'Mon–Fri 9:00–12:00, 14:00–18:00 (Beijing Time)';
|
|
37
38
|
|
|
38
39
|
/** 某时刻的北京时间小时(0–23)。 */
|
|
39
40
|
export function shanghaiHour(ms) {
|
|
40
41
|
return new Date(ms + SHANGHAI_OFFSET_MS).getUTCHours();
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
/**
|
|
44
|
+
/** 某时刻是否为北京时间的工作日(周一至周五,0=周日,6=周六)。 */
|
|
45
|
+
export function isWeekday(ms) {
|
|
46
|
+
const day = new Date(ms + SHANGHAI_OFFSET_MS).getUTCDay();
|
|
47
|
+
return day >= 1 && day <= 5;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** 某时刻是否为高峰时段(北京时间,周一至周五)。 */
|
|
44
51
|
export function isPeak(ms) {
|
|
52
|
+
if (!isWeekday(ms)) return false;
|
|
45
53
|
const h = shanghaiHour(ms);
|
|
46
54
|
return PEAK_WINDOWS.some(([start, end]) => h >= start && h < end);
|
|
47
55
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dougen/dsh-deepseek-usage",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "DeepSeek 余额侧边栏插件:余额(官方 API)、当前档单价与峰谷时段指示灯,支持中/英文界面。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/dougen/dsh-deepseek-usage.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/dougen/dsh-deepseek-usage",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/dougen/dsh-deepseek-usage/issues"
|
|
14
|
+
},
|
|
7
15
|
"files": [
|
|
8
16
|
"lib",
|
|
9
17
|
"cordis.patch.yml",
|