fix: 避免每日用量入口重叠#33
Open
kts-kris wants to merge 2 commits into
Open
Conversation
cf76d7c to
4b53f76
Compare
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.
变更说明
修复
Codex Daily Token Usage在 Codex++ 顶栏控件较多、窗口较窄或 Codex++ 版本入口占位时,右上角入口与现有控件重叠的问题。本次将脚本更新到1.4.7。主要优化:
#codex-plus-menu,将Codex Daily Token Usage放在 Codex++ 版本入口左侧,并保留安全间距。left/top/height计算同一顶栏行位置。Σ的 compact icon,降低占用宽度。Codex Token Usage数据无可靠时间戳时被归入“今天”的问题:不再用Date.now()兜底,避免首次打开时把历史用量错误累计到今日。index.json中的 version、updated_at 和 sha256。根因
之前的版本主要依赖固定
right: 280px和碰撞扫描。这个方式能避开部分重叠,但没有利用 Codex++ 自身已经计算好的版本入口位置,也没有以右侧原生 toolbar button 作为稳定锚点,因此在某些顶栏布局下仍可能和Codex++ 1.x入口或原生按钮区域距离不稳定。另外,外部用量源的历史 turn 如果缺少可靠时间戳,旧逻辑会用当前时间兜底,导致历史 tokens 在首次打开时被错误计入今天。
验证
jq empty index.jsonnode --check scripts/codex-daily-token-usage.jsnode --check outputs/codex-daily-token-usage.jsCODEX_DAILY_TOKEN_USAGE_SCRIPT=scripts/codex-daily-token-usage.js node ../test-codex-daily-token-usage.jsnode work/test-codex-daily-token-usage.jsindex.json一致:660499e55ac2f4b6cafd32403a584d9a8b0b6d761c5e68d27d793611df4af3b7