Townrain/dsh-precise-cache
Five-decimal cache-hit readout beside the chat stats line for the DeepSeek Harness Web GUI (dsh-plugin)
项目介绍Project Overview
dsh-precise-cache 是 DeepSeek Harness 的 Web UI 插件,在聊天输入框下方的统计栏旁新增一行显示,输出精确到小数点后五位的缓存命中率。核心能力是读取官方同一份 tokenUsage 投影数据,跳过内置的四舍五入处理。当需要查看真实命中率(例如判断 99.5% 究竟是多少)时使用。注意:只有在产生过输入计费后该行才会出现,未产生数据时自动隐藏。
dsh-precise-cache is a web UI plugin for DeepSeek Harness that adds a new line beside the chat input stats bar, displaying cache hit rate to five decimal places. Its core capability is reading the same official tokenUsage projection data while skipping the built-in rounding. Use it when you need to see the real hit rate, for example to distinguish values around 99.5%. Note: the line only appears after input-billing data exists, and stays hidden when no data is present.
请帮我了解并安装插件:【dsh-precise-cache】【https://github.com/Townrain/dsh-precise-cache】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add github:Townrain/dsh-precise-cache
把 Townrain/dsh-precise-cache 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-precise-cache
简体中文 | English
给 DeepSeek Harness 加一个小功能:在聊天输入框下方的统计栏旁边,多显示一行精确到小数点后五位的缓存命中率,长这样:
精确命中 99.87654%

有什么用?
Harness 自带的统计栏里,缓存命中率是四舍五入到整数的:真实命中率只要达到 99.5%,它就会显示成 100%。
这个插件用的是和官方一模一样的数据,只是不做四舍五入,把真实的数字直接显示出来。
安装(三步)
Windows:PowerShell 一行命令(不需要 npx,不需要装任何东西)
打开 PowerShell,粘贴运行:
irm https://raw.githubusercontent.com/Townrain/dsh-precise-cache/main/scripts/install.ps1 | iex
脚本会自动下载插件、放进 dsh 的插件目录、登记到你的配置里(重复运行不会重复登记)。然后:
- 重启 dsh
- 刷新浏览器页面
完成,统计栏旁边就会出现 精确命中 …%。
想装到别的 profile 或强制覆盖,先下载脚本再带参数运行:
pwsh -File scripts/install.ps1 -Profile headless/-Force
其他方式
- 装了 npm:
npx dsh-precise-cache install - 下载本仓库后用 Node:
node scripts/install.js install --from . --force
卸载
irm https://raw.githubusercontent.com/Townrain/dsh-precise-cache/main/scripts/install.ps1 -OutFile "$env:TEMP\dsh-precise-cache-install.ps1"
& "$env:TEMP\dsh-precise-cache-install.ps1" -Uninstall
然后重启 dsh。装了 npm 也可以直接 npx dsh-precise-cache uninstall。
常见问题
装好了但看不到那一行? 这一行只有在「产生过输入计费」之后才会显示,没有数据时它会自动隐藏。随便发一条消息再回来看就有了。
会拖慢 dsh 或影响计费吗? 都不会。它只读取 dsh 本来就在计算的统计数据,不发起任何请求、不改任何数字。
为什么是五位小数? 这是本插件最初的诉求:位数越少越容易重新掉进四舍五入的假象里。
技术细节(开发者)
工作原理
lib/index.js 宿主半:空实现(读数纯属浏览器呈现)
lib/client.js 浏览器半:模块表格式 bundle,无需构建步骤
scripts/install.js Node 一键安装器
scripts/install.ps1 PowerShell 一键安装器(下载 zip + 写入组合行)
- 数据来源:Harness 的
tokenUsage投影(provider 上报值,宿主折叠、全日志累计),通过 dock 槽位的标准useProjection座席读取,无任何自建 RPC。分母与内置统计行完全一致:uncachedInputTokens + cacheReadTokens + cacheWriteTokens。 - 插件装载契约:
package.json声明dsh.client.platform = "web"及inject依赖,宿主扫描器据此生成window.__DSH_BOOT__图行并挂载/plugins/dsh-precise-cache/client.js路由;浏览器半以window.__ModuleLoader__.load({ id, factory })注册交接,id即包名,工厂返回{ apply, inject }。 - UI 入口:通过
ctx.slots.inject('conversation.composer.dock', …)注册为新 id 的列表条目(排在内置stats行之后),文案走locale: 'preciseCache'座席,样式标签带data-plugin归属、卸载时由模块加载器回收。 - 热更新边界:
lib/client.js内容变化刷新页面即生效;dsh.client声明变化需要重启 dsh。
开发
npm run check # node --check 语法校验
npm run install:local # 本地安装验证
许可
MIT © 2026 Townrain。欢迎按 dsh-plugin 生态习惯提 PR 与 Issue。
nexu-io/open-design
freestylefly/awesome-gpt-image-2
anywhere-labs/dsh-desktop
walkinglabs/learn-harness-engineering
awesome-dsh-plugin/awesome-dsh-plugin
MemTensor/MemOS