feat: add 'rate' cache mode to show cache hit percentage (CH%)#4
Open
Ambiel127 wants to merge 3 commits into
Open
feat: add 'rate' cache mode to show cache hit percentage (CH%)#4Ambiel127 wants to merge 3 commits into
Ambiel127 wants to merge 3 commits into
Conversation
Replace R{tokens} display with CH{percent}% in the tokens segment.
The hit rate formula is consistent with Pi's default status bar:
cacheHitRate = cacheRead / (input + cacheRead + cacheWrite) × 100%
Add a new 'rate' option to tokens.cache config:
- auto: show cache details in full width mode (original behavior)
- show: always show cache details (original behavior)
- hide: never show cache details (original behavior)
- rate: show cache hit rate as CH{percent}% (new)
When 'rate' is selected, the tokens segment displays:
↑12.3k ↓4.5k CH65%
The hit rate formula is consistent with Pi's default status bar:
cacheHitRate = cacheRead / (input + cacheRead + cacheWrite) × 100%
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动说明
添加了新的
rate缓存模式,显示缓存命中率 (CH%) 而不是缓存读写 token 数。改动内容
TokensCacheMode的"rate"选项rate模式下计算cacheRead / (input + cacheRead + cacheWrite) * 100CH87%使用场景
缓存命中率比 token 数更直观,方便快速判断缓存效果。
配置方式
{ "tokens": { "cache": "rate" } }