Repository navigation
fix: 内置服务统计期间的今日用量只显示已用量,不再写「暂不限量」 - #225
Merged
Merged
Conversation
服务端只统计、不设上限时,电脑与手机上显示内置服务用量的地方
(侧栏卡片、「用量」页、首页、语音模型与 AI 模型页的服务商卡片、
内置服务的抽屉、对话页与悬浮球的提示、手机的设置行)只写已用的量,
例如「今日已用 12 分钟」;不再出现「暂不限量」「统计期间不设上限」
及对应英文。服务端设了上限后照旧显示「已用 x / y」。
界面一直随回答里的用量头和每 10 分钟的用量查询整体替换,计数与限额
之间来回切换无需重启或更新应用;新增测试覆盖两个方向。
删除不再使用的 i18n 键 usage.unlimited、usage.unlimitedNote、
usage.unlimitedShort、usage.inline.unlimited;英文 usage.todayUsed
改为 "Used today: {amount}"。docs/site 的云端识别页中英文同步更新。
用户决定(2026-11-07):「今日用量 无需展示为暂不限量」。
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #225 +/- ##
==========================================
+ Coverage 93.51% 93.53% +0.02%
==========================================
Files 482 482
Lines 83966 83995 +29
Branches 4902 4899 -3
==========================================
+ Hits 78518 78562 +44
+ Misses 4776 4764 -12
+ Partials 672 669 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 9 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
内置服务在只统计用量、不设上限的阶段(服务端
mode=count),电脑和手机上原来写「暂不限量」「统计期间不设上限」。按 2026-11-07 用户的决定(「今日用量 无需展示为暂不限量」),这一阶段改为只显示已用的量,例如「今日已用 12 分钟」;服务端设了上限后照旧显示「已用 x / y」,不需要更新应用。每一处的改动(统计期)
限额模式(「已用 x / y」、剩余量、进度条、80% 变黄、已用完、无法获取、重置时刻)不变。
packages/ui)packages/shared/src/usage.ts,三个前端共用;改动在packages/ui/src/features/usage/Usage.tsx、apps/desktop/src/features/usage/SidebarUsage.tsx、apps/desktop/src/pages/Usage.tsx、apps/mobile-rn/src/features/Usage.tsx。usage.unlimited、usage.unlimitedNote、usage.unlimitedShort、usage.inline.unlimited;两种语言的键集一致。英文usage.todayUsed由「{amount} used today」改为「Used today: {amount}」,与中文「今日已用 {amount}」语序一致。服务端切换时自动更新
服务端从统计期改为限额,或从限额改回统计期,界面会自己跟着变,不用重启或更新应用:每个回答里的
X-Voltip-Quota用量头(Metering::report)和每 10 分钟的用量查询(UsageProbe)都进入UsageRuntime::reported,整份替换核心里的回报,随后CoreEvent::Usage整份替换界面的UiState.usage(crates/voltip-core/src/ui.rs、packages/shared/src/schema.ts的applyEvent,电脑和两个手机端都用它),界面按新的模式和上限重新显示。这条路径原来就是这样,本 PR 没有改 Rust 产品代码,加了测试把两个方向固定下来:runtime::usage::tests::the_view_follows_the_service_from_counting_to_limits_and_back(回答的头与用量查询各一次,计数 → 限额 → 计数 → 限额 → 计数)packages/shared/src/usage.test.ts、packages/ui/src/features/usage/Usage.test.tsx(含英文和模型页卡片、抽屉)、apps/desktop/src/features/usage/usage.test.tsx(侧栏卡片和首页)、apps/mobile-rn/src/features/Usage.test.tsx(说话页、设置行、用量页)、apps/mobile/src/screens/SpeechModels.test.tsx(Tauri 手机壳,新文件)文档:
docs/site的「云端识别」页中英文同步(统计期只显示已用量,开始限量后下一次使用内置服务或 10 分钟内的用量查询改为「已用 12 / 60 分钟」,无需更新 Voltip);docs/dictation.md§27.5、§27.7、§27.8 与docs/acceptance.md同步。截图没有重拍:站点里显示用量的 24 张截图都是限额模式或本机统计,没有统计期的画面。验证
make verify(干净的 HEAD):首行verify-all: 2026-11-07T08:32:55Z host=Linux 7.0.0-1014-aws x86_64,commit=3b28255059e92379da4dce0a3acf29b10e6f29a6 dirty_paths=0 gates=all,末行verify-all: overall_exit=0 commit=3b28255059e92379da4dce0a3acf29b10e6f29a6。覆盖率(行):Rust 92.91%,packages/shared95.6%,packages/ui97.9%,apps/desktop97.52%,apps/mobile97.69%,apps/mobile-rn97.32%。f909b335的内容、保留本 PR 的测试,5 个测试文件共 17 个失败(packages/shared4、packages/ui4、apps/desktop4、apps/mobile1、apps/mobile-rn4),收到的都是旧写法「暂不限量」「统计期间不设上限」「No limit yet」;恢复后全部通过。17 个里 11 个是新测试;6 个是已有测试,只把它们统计期的期望值改成新写法,限额模式的断言没有改。没有删除、跳过或放宽测试。reported改成保留第一次回报的模式与上限时,它失败(left: (Count, 120, None, None),right: (Limit, 120, Some(3600), Some(100))),恢复后通过。scripts/windows-remote.sh,3b282550):gate clippy通过;gate test只有基线就有的两个失败(voltip-relay --test socket、voltip-transport --test link),新 Rust 测试通过。UPDATE_IPC_FIXTURES=1 cargo test -p voltip-tauri-bridge --test contract通过,夹具没有变化。sync-voltip-docs.sh内容检查通过。?usage=count)手动看过侧栏卡片、首页、用量页、模型页卡片、抽屉、收起后的圆环提示。需要在真机上确认
风险与回退
只改显示文字、i18n 键和测试,不改数据、协议或安全边界。回退即还原这个提交。