dsh-web-ui
zhu1090093659
Plugin and skin collection for DeepSeek Harness (DSH) Web UI - task board, git graph, right-side panel, remote mobile UI, pet, live token stats, and skin center.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:HaoyueQin/dsh-usage-statistics-panel
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
DSH web 插件的用量统计面板:按天 Token 趋势、GitHub 风格活跃热力图、缓存命中率曲线、按模型用量拆分(环形图 + 列表),在设置页新增一个"使用统计"页面。
所有图表均为手绘 SVG,不依赖图表库;配色使用 GitHub Primer 的 data-viz 双套色板(前 5 名模型各取一个等级色,其余归入灰色 "Other" 桶),并随 DSH 主题自适应。
$DSH_HOME/storages/usage_history.json(storage-domain),纯本地、无外部依赖dsh plugin --profile <name> add dsh-usage-statistics-panel@latest
装完硬刷新浏览器(Cmd/Ctrl+Shift+R):client 半的改动 DSH 会热加载,无需重启;仅 host 半(采集/存储/路由)更新时需要重启 DSH。
插件挂载后,在 Web UI 的设置页左侧导航会出现"使用统计"页面。
面板的数据采集是观测式的:插件订阅会话事件流(session/event)中的 assistant/message 与 assistant/chunk,提取 provider 上报的 token 用量(输入 / 输出 / 缓存读 / 缓存写),按 (turn, step) 去重(同一调用的流式采样与最终上报取后者),并按 request/context 中的 provider/model 归因。首次启用时还会回扫既有会话日志补齐历史。
提示:Token 用量从插件启用(含回扫)之日起累计;更早的会话日志若无 provider 上报的用量数据,则无法回溯。
pnpm install
pnpm typecheck # tsc --noEmit
pnpm test # vitest
pnpm build # tsc declarations + tsdown (host ESM + 双通道 client bundle)
src/):collector(事件订阅 + 回扫折叠)、store(usage_history storage-domain)、query(范围聚合,翻译自 reasonix 的 query.go)、routes(/usage/api fenced JSON 路由,信任围栏与 /api 网关一致)src/client/):UsageStatsPanel.tsx(手绘 SVG 图表,移植自 reasonix 面板 + Primer 配色)、locales(en / zh / zh-TW)、api(/usage/api fetch 封装)lib/client.js(官方 profile 通道,bundle id = 包名)与 lib/client-registry.js(插件注册表通道,bundle id = manifest id)本面板是对 reasonix 用量统计功能的复刻移植:作者曾为 DeepSeek-Reasonix 实现并贡献了该功能(PR #7238、#7503),本插件按 DSH 的插件规范将其移植到 DeepSeek Harness,前端图表大比例复用原实现,数据层则基于 DSH 的会话日志与 storage-domain 重新实现。
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: data-visualization、token-usage、usage-statistics。