dsh-cache-precision

by Cheng-cheng9669

UI 增强github 检测到 manifest package.json#dsh 社区精选 收录于 08-16

把内置缓存命中率原位显示为 3 位小数,并加宽底部统计行避免内容被截断。

Renders the built-in cache-hit percentage with three decimals and widens the composer stats line to prevent truncation.

安装

dsh plugin --profile web add github:Cheng-cheng9669/dsh-cache-precision

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗

安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。

README

对 DSH Web 底部 composer dock 做两个原位优化:

  1. 把内置的缓存命中率从整数百分比原位替换为 3 位小数 (缓存命中 12% → 缓存命中 12.345%)。
  2. 加宽内置统计行(max-width 在聊天内容宽度基础上增加 260px, 并以视口宽度为上限),避免更长的读数和其它 dock 条目被 ... 截断。

两个优化都读取同一个 tokenUsage 投影,并在 React 重新渲染后自动重新应用。

安装

dsh plugin --profile web add D:\Dsh\tools\dsh-cache-precision

安装后重启 dsh web。

原理

  • 内置 StatsLine 用 Math.round() 显示缓存命中率,本插件通过 MutationObserver 找到原文案节点并原位改写。
  • 缓存命中率口径与 DSH 一致: cacheReadTokens / (uncachedInputTokens + cacheReadTokens + cacheWriteTokens)。
  • 不新增任何可见条目;其它统计信息(轮次、耗时、速度、tokens)保持不变。
  • 不请求网络,不上传任何数据。

测试

npm test

原始 README: https://github.com/Cheng-cheng9669/dsh-cache-precision/blob/main/README.zh.md ↗