Repository navigation
Replies: 2 comments
|
round没问题,是显示精度不够。 |
0 replies
|
让DSH写了个插件 dsh-stats-decimal,把缓存命中率改成两位小数显示(99% → 99.20%),同时优化了输入/输出 token 的格式(40.90M、78.60K)。 README.md 里有完整的安装和使用说明,欢迎尝试。 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
TL;DR
The cache-hit percentage shown in the session stats line is
Math.round(hit / billed * 100), so anything ≥ 99.5% displays as100%. SuggestMath.floor(or one decimal place) so100%only means truly 100%.现状
dsh-client-ui-conversation的 StatsLine(lib/client.js)中:统计行渲染为
缓存命中 {percent}%,例如缓存命中 100%。问题
Math.round会把真实命中率 ≥ 99.5%(如 99.6%)显示为100%。而 100% 在语义上是"全程零未命中、零缓存写入"的满分结论(分母为uncachedInputTokens + cacheReadTokens + cacheWriteTokens三个桶,其中缓存写入计入分母但不计入分子)。四舍五入上取整会产生误导:建议
方案 A(改动最小):
Math.round→Math.floor,显示值永不高估,只有真实命中率恰好 100% 时才显示 100%。方案 B(更推荐):保留一位小数(如
99.6%),100% 需要真实值 ≥ 99.95%,几乎不会误报,信息量也更高。另注:
contextOccupancy同样使用Math.round(...)后clamp(100)(99.6% 占用率会显示 100%),建议一并考虑,保持两个百分比指标的显示语义一致。All reactions