← 返回列表
未验证
在模型选择器旁常显账户余额,点击查看明细
尚未跑自动兼容性验证,可查看页面内的依赖与入口分析。 · 最近上游提交 2026/8/15 · 已提供中文文档
DSH Web 插件:模型选择器旁显示 DeepSeek 账户余额徽章(点击查看明细)。DSH web plugin: DeepSeek account balance badge next to the model picker.
综合分
27.5
GitHub 分
27.5
用户评分
—
★ Stars
1
周下载量
—
安装插件(需先安装 dsh CLI 引擎:npm install -g @deepseek-ai/dsh)
dsh plugin --profile web add HOFO-GYG/dsh-balance-watch该插件未发布到 npm,走 GitHub 源安装(pnpm 若拦截 prepare 脚本,按其提示在 pnpm-workspace.yaml 的 allowBuilds 中放行后重跑)
数据截至 2026/9/16(元数据每日更新 · 实装验证按队列轮转,单条结论的验证时间见上方)
用户评分
还没有人投票,来当第一个
订阅周报,不错过优质插件更新
每周一封 · 高评分插件 + 新用户活动
README
dsh-balance-watch
DSH Web 插件:在模型选择器旁显示 DeepSeek 账户余额徽章。
A DSH web plugin that puts a DeepSeek account-balance badge right next to the model picker.
功能 / Features
- 徽章常显 Balance,点击后向上弹出明细面板:总余额 / 赠送余额 / 充值余额、多币种、更新时间、手动刷新
- 数据经插件自带的本地路由 GET /api/dsh-balance 获取:服务端解析 DEEPSEEK_API_KEY 并缓存(60 秒),API key 永不进入浏览器
- 每 2 分钟自动轮询,打开面板时即时刷新;provider 故障时降级显示 5 分钟内的最近数据并标注错误
- 余额低于 ¥5 时徽章变红,悬停提示"余额偏低"
- 排版与官方模型选择器一致(字号/字重/颜色层级)
架构 / Architecture
| 文件 | 说明 |
|---|---|
| lib/index.js | host 半部(Node,ESM,零依赖):ctx.webServer.register 挂载 /api/dsh-balance 路由,ctx.credentials.resolve('DEEPSEEK_API_KEY') 在服务端取密钥;单飞(single-flight)缓存 + 失败降级;仅接受回环 Host 与 GET/HEAD |
| lib/client.js | 浏览器半部(DSH client-bundle 格式):注册 conversation.input.right 槽位(模型选择器左侧),React 徽章 + 弹窗,zh/en 双语 |
| test-host.mjs | host 半部单元测试(mock ctx / fetch / 时钟,15 项断言),node test-host.mjs 运行 |
数据流:浏览器 fetch('/api/dsh-balance') → 本地 dsh web 服务(插件路由)→ 服务端用密钥查询 DeepSeek /user/balance → 只把余额 JSON 返回浏览器。
安装 / Install(无需 pnpm / no pnpm required)
1. 把本仓库复制到 /profiles/web/node_modules/dsh-balance-watch(Windows 默认 C:\Users\\.dsh\profiles\web\node_modules\;注意是 web profile 自己的 node_modules,不是上一级 profiles\node_modules —— 后者在全新启动时 host 半部可能不被加载):
Copy-Item -Recurse "$env:USERPROFILE\.dsh\profiles\web\node_modules\dsh-balance-watch"
2. 在 /profiles/web/cordis.patch.yml 末尾追加:
- insert:
- id: balance-watch
name: 'dsh-balance-watch'
3. 重启 dsh web,刷新浏览器页面。
或者使用官方插件管理命令(需先安装 pnpm):
dsh plugin --profile web add
测试 / Test
node test-host.mjs
依赖 / Dependencies
- 运行时:仅使用 DSH 内置服务(webServer、credentials)与全局 fetch,无第三方依赖
- 客户端 bundle 通过 dsh.client.inject 复用 DSH 已提供的 dsh-client-runtime、dsh-client-locale、dsh-client-ui-conversation
License
MIT同作者(HOFO-GYG)的其他插件
扫码进群