READMESource: main@38207aea
dsh-token-meter-mood
DeepSeek Harness Web GUI 插件:在每条助手回复下方显示该次交互的 token 消耗明细与心情表情。
😄 · 输入 106万6204 · 命中 100万 · 未命中 6万6204 · 输出 3万5000 · 命中率 95%
- 每次回复(每个回合)单独统计:输入 / 缓存命中 / 未命中 / 输出(中文单位,4 位分组精确显示:
190万2900、1亿2900万3999) - 表情只按该次回复的输出 token 分级:< 5 万 🥳,510 万 😄,1020 万 🙂,2040 万 😐,4060 万 😕,6080 万 😟,80100 万 😠,> 100 万 😡(红温)
- 有产物(编辑/写入文件)的回合保留「产物」行,文件可点击打开
- 有推理 token 时悬停显示「输出 X (含推理 Y)」
安装
前提:本机已运行过 dsh --profile web(profile 目录 ~/.dsh/profiles/web/ 已初始化)。
# 一条命令:安装为 profile 依赖,并自动激活为 profile 图层(host 服务 + 浏览器端一起挂载)
pnpm dsh plugin --profile web add "github:firekula/dsh-token-meter-mood"
# 装过旧版本后更新:
pnpm dsh plugin --profile web update dsh-token-meter-mood
然后重启 dsh --profile web(或刷新页面)。
旧版本(≤0.2.1)缺少
dsh.bundle.patch声明,安装命令只会把它装成普通依赖、不挂载,需要手工在~/.dsh/profiles/web/cordis.patch.yml里加一行:- insert: - id: token-meter-mood name: 'dsh-token-meter-mood'0.2.2 起不再需要这一步。
刷新页面后,每条已完成的助手回复下方就会出现 token 行。
工作原理
- Host 半(
lib/index.js):一个TypertRemoteService,通过@Remote('turnUsage')暴露按回合折叠用量(与 token-meter 相同的「每步后采样替换」语义),优先读实时会话日志,冷会话回退到sessionQuery。安装后由 typert-loader 自动注册到网关。 - 浏览器半(
lib/client.js,经dsh.client声明被 Web 应用扫描并注入):挂载本包自带的/remote贡献,接管conversation.chat.turnTail槽位(单赢家链槽,以更高优先级先行接管,并复刻官方「产物」行保证共存)。 - peerDependencies 全部从本机 DSH 安装解析(profile 的 healed node_modules 兜底),不依赖 npm 发布。
调整表情阈值
修改 src/client/TokenMeterTail.tsx 中 emojiOfOutput 的分档后重新打包提交即可。
重新构建
lib/ 下已提交构建产物,GitHub 安装不需要构建步骤。如需修改后重建:把本仓库放进 deepseek-harness monorepo 的 packages/client/ 下,参照其构建流程执行 tsc(host/client 两个 tsconfig)、typert 生成(package 模式)与 clientBundle 打包,再将产物提交。
No comments yet. Be the first to write one.