UI Enhancements

dsh-deepseek-balance

wangxiang0605qvq/dsh-deepseek-balance · ★ 0

wangxiang0605qvq

DeepSeek 余额插件:模型工具 + 侧边栏余额胶囊 \| DeepSeek balance plugin for DSH: model tool + sidebar balance pill

An English summary is not available; the Chinese summary is shown.

README body is shown in Chinese.

Repository is no longer available (checked 2026-10-31). This entry is retained for tracking and cannot be installed.

License
MIT
Added
2026-08-23
Maintenance
active
Install kind
github

No manifest check is available; listing does not imply compatibility or security review.

README

Source README · body: zh · Read Chinese README

Table of contents
  1. 功能
  2. 安装
  3. 1. 复制包文件
  4. 2. 注册插件
  5. 3. 重启并刷新
  6. API Key 配置
  7. 配置项
  8. 说明
  9. License

DeepSeek Harness(DSH)余额插件:在 Web 界面侧边栏实时显示 DeepSeek API 账户余额,并注册一个可供模型调用的 deepseek_balance 工具。

功能

  • 模型工具 deepseek_balance:宿主端注册,模型可直接调用查询余额,返回账户可用状态与各币种的总/充值/赠送余额,并渲染为中文文本。
  • 侧边栏余额胶囊:显示在侧边栏底部(sidebar.footer.action 槽位),绿色/红色状态圆点 + 金额;挂载时查询一次,之后每 60 秒自动刷新,点击立即刷新;查询失败显示 ¥—,悬停可见错误详情。
  • 安全的 RPC 通道:胶囊通过独立的 /deepseek-balance 通道(仅 loopback)向宿主端查询,与共享的 /api 通道隔离。
  • 密钥解析链:每次调用按 配置字面量 → credentials 服务 → 启动环境变量 依次解析 API Key,不驻留内存。

安装

1. 复制包文件

将本仓库整体复制到 DSH profile 的 node_modules 下:

# 以 web profile 为例
Copy-Item -Recurse . "$env:USERPROFILE\.dsh\profiles\node_modules\@deepseek-ai\dsh-deepseek-balance"

2. 注册插件

在 profile 的补丁配置(例如 ~/.dsh/profiles/web/cordis.patch.yml)中插入:

- insert:
    - id: deepseek-balance
      name: "@deepseek-ai/dsh-deepseek-balance"
      inject: ["tools", "connection"]
      config: {}

inject 声明 connection 依赖,确保 RPC 通道在 connection 服务就绪后才注册(否则胶囊无数据,工具仍可用)。

3. 重启并刷新

重启 DSH,然后在浏览器中硬刷新(Ctrl+F5)页面。

API Key 配置

按以下任一方式提供 DEEPSEEK_API_KEY:

  1. 在插件 config 中写字面量:config: { apiKey: "sk-..." };
  2. 通过 DSH 的 credentials 服务保存(Web 的 Models 设置页会写入);
  3. 在启动 DSH 的环境变量中导出 DEEPSEEK_API_KEY。

配置项

字段 默认值 说明
apiKey 无 API Key 字面量(secret)
apiKeyEnv DEEPSEEK_API_KEY 凭据/环境变量名
baseURL https://api.deepseek.com API 基址
timeoutMs 30000 查询超时(毫秒)

说明

  • 依赖 DSH 内置包:@deepseek-ai/dsh-credentials、@deepseek-ai/dsh-tools、@deepseek-ai/dsh-launch-environment 等(见 package.json peerDependencies)。
  • 客户端 lib/client.js 是供 DSH web 加载的模块格式,请勿直接用浏览器打开。
  • 无头 / TUI 环境下胶囊不显示,但 deepseek_balance 工具始终可用。

License

MIT