@dougen/dsh-deepseek-usage 0.9.0 → 0.9.1

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 CHANGED
@@ -14,6 +14,7 @@ DeepSeek **余额侧边栏插件**(DeepSeek Harness Web UI):在 DSH **网
14
14
  - **Auto price sync**: prices are re-fetched from the official DeepSeek pricing page on first use each day and when you click the card; the result is merged back into the price table (official entries overwrite same-named ones, your own entries are kept). The page is parsed **structurally (HTML table cells)**, not by matching surrounding text, so official layout/rewording changes no longer break it; a plain-text strategy remains as a fallback
15
15
  - **Rename-proof model mapping**: when DeepSeek renames a model (e.g. `deepseek-v4-flash` → `deepseek-flash`) the old id is charged at the current model's price instead of silently showing an outdated price. (The card stays quiet about this — see *FAQ* below.)
16
16
  - **Peak indicator & countdown**: top-right dot — orange during peak hours (Mon–Fri 9:00–12:00, 14:00–18:00 Beijing Time), green otherwise. Beside the dot a countdown shows the time left until the next peak/off-peak switch, in English units (`2d 15h`, `5h 47m`, `23m`).
17
+ - **Collapsed sidebar**: with the sidebar collapsed to the icon rail, this plugin shows the peak/off-peak dot alone (clicking it still refreshes); the full card returns when the sidebar expands.
17
18
  - **Auto refresh**: every 5 minutes; click the card to refresh instantly.
18
19
  - **i18n**: UI copy follows the DSH locale (Chinese / English)
19
20
  - Follows the app light/dark theme
@@ -24,6 +25,7 @@ DeepSeek **余额侧边栏插件**(DeepSeek Harness Web UI):在 DSH **网
24
25
  - **单价自动同步**:每日首次使用或点击卡片时,自动从官方价格页拉取最新档单价,并把结果**合并回写**到价格表(官方条目覆盖同名项,你自己加的条目保留)。页面解析采用**结构化表格解析**(直接读 HTML 表格单元格),不再依赖"正文里某段文字长什么样",官方改版/改文案不会失效;另保留纯文本兜底策略
25
26
  - **抗改名映射**:官方给模型改名(如 `deepseek-v4-flash` → `deepseek-flash`)时,旧名按现名价格计费,不会静默显示旧价(卡片不为此弹提示,见下方 FAQ)
26
27
  - **峰谷指示灯与倒计时**:卡片右上角圆点,高峰(周一至周五 9:00–12:00、14:00–18:00 北京时间)橙色,空闲绿色;圆点旁显示距下次峰谷切换的倒计时,统一英文单位(`2d 15h`、`5h 47m`、`23m`)
28
+ - **侧边栏折叠**:折叠成图标栏时只显示峰谷指示灯(点击它同样可刷新),卡片在侧边栏展开时回来
27
29
  - **自动刷新**:每 5 分钟一次;点击卡片任意位置立即刷新
28
30
  - **多语言**:界面文案跟随 DSH 语言(中文 / English)
29
31
  - 跟随应用明暗主题
package/lib/client.js CHANGED
@@ -4,9 +4,11 @@
4
4
  // Cordis 面板按钮下方)。轮询宿主路由 `/api/deepseek-usage`(见 lib/index.js)
5
5
  // 每 5 分钟一次,点击卡片任意位置可立即刷新;还没拿到余额(宿主刚重启/接口刚起来)
6
6
  // 时按 QUICK_RETRY_MS 阶梯快速补几次请求,卡片几秒内收敛。
7
- // 卡片显示:余额(放大显示,符号随币种 ¥/$)+ 当前模型档单价(输入/输入缓存/
8
- // 输出,图标 + 数字,位于卡片右下角)+ 峰谷指示灯(右上角,只有颜色)+ 距下次
9
- // 峰谷切换的倒计时(`2d 15h` / `5h 47m` / `23m`,与指示灯同行、位于其左侧)。
7
+ // 两种形态:
8
+ // · 侧边栏展开——完整卡片:余额(放大显示,符号随币种 ¥/$)+ 当前模型档单价
9
+ // (输入/输入缓存/输出,图标 + 数字,位于卡片右下角)+ 峰谷指示灯(右上角,
10
+ // 只有颜色)+ 距下次峰谷切换的倒计时(`2d 15h` / `5h 47m` / `23m`,与指示灯同行、位于其左侧)。
11
+ // · 侧边栏折叠——36px 图标栏里只有峰谷指示灯(见下方 `if (!wide)` 分支)。
10
12
  //
11
13
  // 设计约束(用户只关心"我还能花多少、这会儿什么价"):
12
14
  // · 插件的内部信息——计价来源、同步状态、价格表文件名与路径、模型改名——一律
@@ -314,6 +316,8 @@ window.__ModuleLoader__.load({
314
316
  load(true);
315
317
  };
316
318
 
319
+ // 折叠态(图标栏):内容宽 36px(侧边栏 56px − 折叠态左右各 10px 内边距),
320
+ // 只容得下峰谷指示灯。指示灯仍是"点击刷新"的落点。
317
321
  if (!wide) {
318
322
  return h("div", {
319
323
  style: {
@@ -328,15 +332,10 @@ window.__ModuleLoader__.load({
328
332
  display: "flex",
329
333
  flexDirection: "row",
330
334
  alignItems: "center",
331
- gap: 5,
332
335
  userSelect: "none",
333
336
  },
334
337
  onClick: () => load(true),
335
- },
336
- h("span", { style: { display: "inline-flex", alignItems: "baseline", gap: 3 } },
337
- h("span", { style: { fontWeight: 700, fontSize: 13, color: C.label } }, symbol),
338
- h("span", { style: { fontWeight: 700, fontSize: 13, color: C.label } }, money(balance && balance.total))),
339
- h("span", { style: dot }));
338
+ }, h("span", { style: dot }));
340
339
  }
341
340
 
342
341
  // 只有"余额类错误"(未配置 Key / 余额接口或网络失败)才走到这里:卡片置空、
@@ -344,7 +343,7 @@ window.__ModuleLoader__.load({
344
343
  // (CARD_MIN_HEIGHT),侧边栏不跳动;文字多行时卡片自然变高。
345
344
  // 注意:这里不显示任何插件内部信息(来源、同步时间、价格表路径),历史上那批
346
345
  // 良性提示已随"去技术化"一起删除。
347
- // 窄卡片(!wide)没有文字空间:仍显示余额与圆点,错误只写进日志。
346
+ // 折叠态(!wide)早在上面就返回了:它只有峰谷指示灯,没有文字空间。
348
347
  if (blanked) {
349
348
  return h("div", {
350
349
  style: {
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "@dougen/dsh-deepseek-usage",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
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
  "scripts": {
8
16
  "test": "node --test test/",
9
17
  "check:pricing": "node lib/pricing-remote.js --check"