dsh-desktop-statusbar 2.2.2 → 3.0.0
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 +3 -3
- package/README.md +3 -3
- package/cordis.patch.yml +10 -1
- package/docs/settings.en.png +0 -0
- package/docs/settings.png +0 -0
- package/docs/statusbar.en.png +0 -0
- package/docs/statusbar.png +0 -0
- package/lib/balance-api.js +23 -1
- package/lib/client.js +2864 -204
- package/lib/index.js +5622 -4218
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
- package/tools/shot.cjs +28 -10
package/README.en.md
CHANGED
|
@@ -22,7 +22,7 @@ Replaces the stats line under the message input in the DSH desktop app with a co
|
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
|
-
- **
|
|
25
|
+
- **9 optional fields plus the context ring**: context occupancy (the ring at the head of the bar), peak / off-peak check, turns & steps, cache hit rate, output speed, TTFT, run time, this turn cost, session cost, balance
|
|
26
26
|
- **Click a field for details**:
|
|
27
27
|
|
|
28
28
|
| Field | Content |
|
|
@@ -78,10 +78,10 @@ npm view dsh-desktop-statusbar version
|
|
|
78
78
|
The one-click update button inside the plugin can fail on some desktop builds — it either does nothing or reports a failure. Do not keep clicking it. Use the official install entry instead and **append `@version` to the package name** to pin the exact version:
|
|
79
79
|
|
|
80
80
|
```powershell
|
|
81
|
-
dsh plugin --profile desktop add dsh-desktop-statusbar@
|
|
81
|
+
dsh plugin --profile desktop add dsh-desktop-statusbar@3.0.0
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
The same string works in the plugin panel — type `dsh-desktop-statusbar@
|
|
84
|
+
The same string works in the plugin panel — type `dsh-desktop-statusbar@3.0.0` into the **Add plugin** field.
|
|
85
85
|
|
|
86
86
|
Use whatever version you see (the version on the release page, or the output of the `npm view` command above). Pinning the version has a second benefit: **you get exactly the build you asked for**, with no chance of a stale cached package.
|
|
87
87
|
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
## 功能
|
|
24
24
|
|
|
25
|
-
- **
|
|
25
|
+
- **9 个可选字段 + 栏首上下文圆环**:上下文占用(栏首圆环)、峰谷判断、轮次&步数、缓存命中率、输出速度、首字平均、运行用时、本轮费用、总计费用、余额
|
|
26
26
|
- **点击字段可查看详情**:
|
|
27
27
|
|
|
28
28
|
| 字段 | 内容 |
|
|
@@ -78,10 +78,10 @@ npm view dsh-desktop-statusbar version
|
|
|
78
78
|
插件里那个一键更新按钮,在某些桌面端版本上会失败(点了没反应、或者直接显示失败)。这时不要反复点,改用官方安装入口、**在包名后面加上 `@版本号`** 指定到具体版本,就能精确装上:
|
|
79
79
|
|
|
80
80
|
```powershell
|
|
81
|
-
dsh plugin --profile desktop add dsh-desktop-statusbar@
|
|
81
|
+
dsh plugin --profile desktop add dsh-desktop-statusbar@3.0.0
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
插件面板里同样可以这样填 —— 在「添加插件」的输入框里写 `dsh-desktop-statusbar@
|
|
84
|
+
插件面板里同样可以这样填 —— 在「添加插件」的输入框里写 `dsh-desktop-statusbar@3.0.0`。
|
|
85
85
|
|
|
86
86
|
版本号填你看到的最新版本即可(发布页右侧的版本号,或上面那条 `npm view` 命令的输出)。带上版本号还有一个好处:**装上的就是你想要的那一版**,不会因为缓存拿到旧包。
|
|
87
87
|
|
package/cordis.patch.yml
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# dsh-desktop-statusbar bundle 层
|
|
2
|
+
#
|
|
3
|
+
# 一个包一个组件。开发模式是主插件的一部分,**没有独立开关** ——
|
|
4
|
+
# 它只是作者调试用的入口(底栏吃假数据 + 连点版本号进出),日常不出现,
|
|
5
|
+
# 也不会在界面上多出任何可见控件。
|
|
6
|
+
#
|
|
7
|
+
# 曾经拆成过第二个组件(插件管理页单独开关),已经回退。原因:单包只能声明
|
|
8
|
+
# 一份客户端入口、client.js 是单份打包的,关掉组件**不会**卸载那部分代码 ——
|
|
9
|
+
# 于是"关掉"只能靠客户端运行时探测/轮询去管控,名不副实。
|
|
10
|
+
# 拆成多个 npm 包才能真正隔离,但那个代价不值得。
|
|
2
11
|
- insert:
|
|
3
12
|
- id: dsh-desktop-statusbar
|
|
4
13
|
name: 'dsh-desktop-statusbar'
|
|
5
|
-
config: {}
|
|
14
|
+
config: {}
|
package/docs/settings.en.png
CHANGED
|
Binary file
|
package/docs/settings.png
CHANGED
|
Binary file
|
package/docs/statusbar.en.png
CHANGED
|
Binary file
|
package/docs/statusbar.png
CHANGED
|
Binary file
|
package/lib/balance-api.js
CHANGED
|
@@ -55,7 +55,29 @@ const adapters = [
|
|
|
55
55
|
const parts = [];
|
|
56
56
|
if (typeof one.topped_up_balance === 'string') parts.push({ label: 'toppedUp', amount: one.topped_up_balance });
|
|
57
57
|
if (typeof one.granted_balance === 'string') parts.push({ label: 'granted', amount: one.granted_balance });
|
|
58
|
-
|
|
58
|
+
/* **额外**返回一份分币种余额:DeepSeek 的 balance_infos 里可能同时有 CNY 和 USD 两笔,
|
|
59
|
+
而上面那段(取 infos[0])是历史逻辑,老调用方还在用,语义一个字不能动。
|
|
60
|
+
这里遍历**全部**条目,让底栏能显示成「余额 ¥14.12+$3.17」。
|
|
61
|
+
只收 total > 0 的:0 与负数都不进(用户拍板「负数也不显示」,与 0 同样处理)。
|
|
62
|
+
币种只认 USD / CNY 两种,其余一律按 CNY(与文件其它地方口径一致),
|
|
63
|
+
这样上层不用再猜符号。 */
|
|
64
|
+
const balances = [];
|
|
65
|
+
for (const info of infos) {
|
|
66
|
+
if (info === null || info === undefined || typeof info !== 'object') continue;
|
|
67
|
+
const amount = typeof info.total_balance === 'string' ? Number(info.total_balance) : Number.NaN;
|
|
68
|
+
if (!Number.isFinite(amount) || amount <= 0) continue;
|
|
69
|
+
balances.push({
|
|
70
|
+
currency: info.currency === 'USD' ? 'USD' : 'CNY',
|
|
71
|
+
total: info.total_balance,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
currency: typeof one.currency === 'string' ? one.currency : 'CNY',
|
|
76
|
+
total,
|
|
77
|
+
parts,
|
|
78
|
+
/* 老调用方不看这个字段;上层拿到就用,拿不到(没有 balances 键)就退回单币种 */
|
|
79
|
+
balances: balances.length === 0 ? undefined : balances,
|
|
80
|
+
};
|
|
59
81
|
}
|
|
60
82
|
},
|
|
61
83
|
{
|