dsh-deepseek-balance-widget 2.0.0 → 2.2.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.md +62 -37
- package/README_EN.md +32 -7
- package/lib/client.js +536 -147
- package/lib/index.js +40 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,37 +1,62 @@
|
|
|
1
|
-
# dsh-deepseek-balance-widget
|
|
2
|
-
|
|
3
|
-
[English](README_EN.md) | 中文
|
|
4
|
-
|
|
5
|
-
在 dsh Web 侧边栏显示 AI
|
|
6
|
-
|
|
7
|
-
## 功能
|
|
8
|
-
|
|
9
|
-

|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
# dsh-deepseek-balance-widget
|
|
2
|
+
|
|
3
|
+
[English](README_EN.md) | 中文
|
|
4
|
+
|
|
5
|
+
在 dsh Web 侧边栏显示 AI 余额的多平台插件:内置 **DeepSeek**,可添加 **MiMo(小米)**,每 30 秒自动刷新。
|
|
6
|
+
|
|
7
|
+
## 功能
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
- 侧边栏实时显示余额 / 今日消费 / 今日 Token,30 秒自动刷新,并随当前平台切换
|
|
12
|
+
- 弹窗顶部显示当前平台标题:点「**更换**」在已添加的平台间切换,点「**×**」可移除该平台
|
|
13
|
+
- 弹窗右上角「**+ 添加**」:加入 MiMo
|
|
14
|
+
- 详情字段:余额、累计消费、今日消费、今日 Token、本月消耗(本月消费 / Tokens)
|
|
15
|
+
- 「**AI 帮我配置**」:复制提示语发给智能体,AI 会一步步指导你抓取凭证并完成配置。
|
|
16
|
+
- 弹窗底部显示版本号,有新版时一键自动更新
|
|
17
|
+
|
|
18
|
+
## 安装
|
|
19
|
+
|
|
20
|
+
需要:已安装 dsh(可用 `dsh web`)。
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
dsh plugin --profile web add dsh-deepseek-balance-widget
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
从 npm 拉取安装,dsh 自动注册到 `dsh.profile.bundles`,完成后**重启 `dsh web`** 即可。
|
|
27
|
+
|
|
28
|
+
也可以直接对 AI 说:
|
|
29
|
+
|
|
30
|
+
> 帮我用 npm 安装 dsh-deepseek-balance-widget 插件。
|
|
31
|
+
|
|
32
|
+
## 配置
|
|
33
|
+
|
|
34
|
+
插件首次使用会自动创建 DeepSeek 条目,读取你本机的 `DEEPSEEK_API_KEY`。
|
|
35
|
+
|
|
36
|
+
要加入 MiMo,打开弹窗点右上角「+ 添加」,再点「AI 帮我配置」,把提示语发给智能体;也可以直接对 AI 说:
|
|
37
|
+
|
|
38
|
+
> 帮我配置 dsh-deepseek-balance-widget。
|
|
39
|
+
|
|
40
|
+
AI 会接管全部:问 API Key / 引导获取平台 Cookie → 写入本机 → 提醒重启 `dsh web`。
|
|
41
|
+
|
|
42
|
+
| 平台 | 凭据 | 备注 |
|
|
43
|
+
| ----------- | ------------------------- | ------------------- |
|
|
44
|
+
| DeepSeek | `DEEPSEEK_API_KEY` | 必填,余额 |
|
|
45
|
+
| DeepSeek 用量 | `DEEPSEEK_PLATFORM_TOKEN` | 可选,统计累计消费 / 本月 / 今日 |
|
|
46
|
+
| MiMo(小米) | 登录 Cookie | AI 引导获取 |
|
|
47
|
+
|
|
48
|
+
凭据保存在你本机的 `~/.dsh/ai-balances.json`,不随插件分发、不上传。
|
|
49
|
+
|
|
50
|
+
## 卸载
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
dsh plugin --profile web rm dsh-deepseek-balance-widget
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
或者直接对 AI 说:
|
|
57
|
+
|
|
58
|
+
> 帮我用 npm 卸载 dsh-deepseek-balance-widget 插件。
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
[MIT](LICENSE)
|
package/README_EN.md
CHANGED
|
@@ -2,29 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.md)
|
|
4
4
|
|
|
5
|
-
A
|
|
5
|
+
A multi-provider AI balance widget for the dsh web sidebar. **DeepSeek** is built in; add **MiMo (Xiaomi)** from the popover. Auto-refreshes every 30 seconds.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-

|
|
9
|
+

|
|
10
10
|
|
|
11
|
-
- Sidebar
|
|
12
|
-
-
|
|
13
|
-
-
|
|
11
|
+
- Sidebar shows Balance / Today spend / Today tokens, auto-refresh every 30 s; values follow the selected provider
|
|
12
|
+
- Popover header shows the current provider: a "**Switch**" menu changes to another added provider, and "**×**" removes it
|
|
13
|
+
- "**+ Add**" button (top right): add **MiMo**
|
|
14
|
+
- Details: balance, cumulative spend, today spend, today tokens, monthly usage (monthly spend / tokens)
|
|
15
|
+
- "**AI 帮我配置**": one click copies a prompt; send it to your AI and it guides you through fetching credentials and writing them locally — no digging through cookies by hand
|
|
16
|
+
- Version shown in the popover footer; one-click auto-update when a new version is available
|
|
14
17
|
|
|
15
18
|
## Install
|
|
16
19
|
|
|
20
|
+
Requires: dsh installed (with `dsh web` working).
|
|
21
|
+
|
|
17
22
|
```bash
|
|
18
23
|
dsh plugin --profile web add dsh-deepseek-balance-widget
|
|
19
24
|
```
|
|
20
25
|
|
|
21
26
|
Installed from npm and auto-registered by dsh. **Restart `dsh web`** and the balance button appears in the sidebar.
|
|
22
27
|
|
|
23
|
-
Or just tell your AI:
|
|
28
|
+
Or just tell your AI:
|
|
29
|
+
|
|
30
|
+
> Install the dsh-deepseek-balance-widget plugin for me via npm.
|
|
24
31
|
|
|
25
32
|
## Configuration
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
On first use the plugin creates a DeepSeek entry and reads your local `DEEPSEEK_API_KEY`.
|
|
35
|
+
|
|
36
|
+
To add MiMo, open the popover, click "+ Add", then "AI 帮我配置", and send the copied prompt to your AI. Or just tell your AI:
|
|
37
|
+
|
|
38
|
+
> Configure dsh-deepseek-balance-widget for me.
|
|
39
|
+
|
|
40
|
+
The AI takes care of everything: asks for your API key / guides you through getting the platform cookie → writes the local config → reminds you to **restart `dsh web`**.
|
|
41
|
+
|
|
42
|
+
| Provider | Credential | Notes |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| DeepSeek | `DEEPSEEK_API_KEY` | Required, balance |
|
|
45
|
+
| DeepSeek usage | `DEEPSEEK_PLATFORM_TOKEN` | Optional, cumulative / monthly / today stats |
|
|
46
|
+
| MiMo (Xiaomi) | Login cookie | Guided by your AI |
|
|
47
|
+
|
|
48
|
+
Credentials are stored locally in `~/.dsh/ai-balances.json`; nothing is shipped with the plugin and nothing is uploaded.
|
|
28
49
|
|
|
29
50
|
## Uninstall
|
|
30
51
|
|
|
@@ -32,6 +53,10 @@ Open the popover → "+ Add" → pick a provider → "AI 帮我配置" → sen
|
|
|
32
53
|
dsh plugin --profile web rm dsh-deepseek-balance-widget
|
|
33
54
|
```
|
|
34
55
|
|
|
56
|
+
Or just tell your AI:
|
|
57
|
+
|
|
58
|
+
> Uninstall the dsh-deepseek-balance-widget plugin for me via npm.
|
|
59
|
+
|
|
35
60
|
## License
|
|
36
61
|
|
|
37
62
|
[MIT](LICENSE)
|