Skip to content

feat: 本机录音缓存与重新识别,可更改本机模型的保存位置 - #194

Merged
sunerpy merged 1 commit into
mainfrom
feat/audio-cache
Oct 26, 2026
Merged

sunerpy merged 1 commit into
mainfrom
feat/audio-cache

Conversation

@sunerpy

@sunerpy sunerpy commented Oct 26, 2026

Copy link
Copy Markdown
Owner

改动

这一个 PR 合并为补丁版本 0.1.9(用户 2026-10-26 要求),并关闭 #192。

  • 录音缓存(dictation.md §26;crates/voltip-core/src/audio_cache.rs、dictation/archive.rs、ogg.rs、runtime/audio.rs):电脑端默认在本机保留最近 20 条、最多 200 MB 的录音(设置 › 隐私与历史 › 录音缓存,可关闭、调整和清理;只存在这台电脑上,不同步到手机,也不进备份)。2 分钟以内的录音保存为 WAV;更长的录音在录制时每 30 秒写一段 Ogg Opus(每段单独编码,写入临时文件、同步到磁盘后再改名)并记在 manifest.json 里,Voltip 意外退出后,下次启动会找回已录下的部分,标记为「录制或处理时 Voltip 已关闭」。在历史记录里可以「重新识别」或「重新润色」,重新识别的结果作为新记录保存并复制到剪贴板。
  • 重新识别时换模型(§26.4):audio_retake 可以带上这一次使用的语音模型和 AI 润色,不修改设置;首页「最近的结果」上方列出未识别的录音(最多 3 条,可一键清理)。
  • 历史记录页:默认每页 10 条,列表和详情占满窗口高度。
  • 额度池(§3.5):「添加」与服务商、模型在同一行,有数据时每一项都显示「移除」。
  • 模型保存位置(§10.9,模型下载,不能设置保存路径?C 盘满了 #192):「语音模型 › 本机」的模型列表上方新增「保存位置」。更改位置时,已下载的模型会一起移过去:在同一块磁盘上直接改名;换到另一块磁盘时,先复制到 <id>.moving 并检查,全部完成后写入 models-location.json 并切换,再删除旧文件。移动可以取消,取消或失败时全部撤销;暂时删不掉的旧文件夹在下次启动时删除。移动期间不能下载、导入或删除模型,下载期间不能移动。在不区分大小写的文件系统上,用带标记的探测文件识别同一个文件夹的不同写法,避免把模型当成旧副本删除(回归测试)。桌面应用、命令行和本机语音服务读同一个位置;手机端的同名命令直接拒绝。
  • 文档:dictation.md(§3.5、§4.4、§10.9、§22.3、§26)、frontend.md、acceptance.md,文档站的历史记录、隐私、本机识别、云端服务、润色和更新页(中英文),重拍 history-fix-*、local-* 截图。

验证

  • make verify(toolchain 1.98.0)在这个提交上全部通过:Rust 行覆盖率 92.97%(门槛 90%),clippy、cargo-deny、IPC e2e、web lint/typecheck/coverage/build、验收台账、主机名扫描、发布脚本与自建网关测试。
  • 新测试:录音缓存(tests/audio_cache.rs、dictation/archive.rs 的 9 个单元测试、tests/long.rs 中 2 小时录音保存为 240 段、取消不超过 2 分钟的录音不保留)、重新识别换模型(core + RetakeModels.test.ts、Recordings.test.tsx)、模型移动(voltip-asr-local/tests/relocate.rs 9 个、voltip-core/tests/models.rs 5 个、ModelsLocation.test.tsx 4 个)、IPC 契约样例重新生成。
  • 依赖时间的长录音测试:5 个测试各运行 100 次,32 个核心满载,全部通过。
  • Linux 真实应用(Xvfb):129.5 s 的录音保存为 5 段 Opus 并识别成功;录到约 68 s 时 kill -9,下次启动找回 67.7 s 的录音并标记为中断。桌面 smoke 新增检查:粘贴的那次听写的录音已保留,并对应到它的历史记录。
  • Windows 原生(用户的测试机):cargo test -p voltip-asr-local -p voltip-core 全部通过(包括 NTFS 上的大小写回归测试);用户在这台电脑上用测试构建验收了全部改动。

未验证

  • Windows 上模型正在使用时移动,旧文件能否立刻删除(删不掉时在下次启动删除,界面会说明)。
  • macOS 任务不在 PR 上运行,会在分支上手动触发一次。
  • 这些设计没有经过 Codex 评审。

Closes #192

- 电脑端在本机保留最近的录音(条数和占用空间可设置,可清理);识别或润色失败后可以重新识别,不必再说一遍。长录音按段写成 Opus,应用异常退出后下次启动可以找回。
- 重新识别时可以临时换用其他语音模型和 AI 模型;首页显示未识别的录音。
- 历史记录默认每页 10 条,列表和详情占满窗口高度;额度池的「添加」与服务商、模型在同一行,每项都有「移除」。
- 本机模型可以更改保存位置,已下载的模型会一起移过去(#192)。
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.30051% with 326 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/shared/src/mock-backend.ts 63.18% 60 Missing and 21 partials ⚠️
crates/voltip-core/src/audio_cache.rs 94.57% 33 Missing ⚠️
crates/voltip-core/src/runtime/audio.rs 82.81% 33 Missing ⚠️
crates/voltip-core/src/dictation/engine.rs 94.07% 31 Missing ⚠️
apps/desktop/src-tauri/src/lib.rs 25.64% 29 Missing ⚠️
crates/voltip-asr-local/src/relocate.rs 89.71% 25 Missing ⚠️
crates/voltip-core/src/dictation/archive.rs 95.87% 23 Missing ⚠️
apps/desktop/src/features/history/RetakeModels.tsx 83.33% 4 Missing and 5 partials ⚠️
crates/voltip-core/src/runtime/models_move.rs 93.49% 8 Missing ⚠️
packages/shared/src/audio-cache.ts 75.00% 6 Missing and 2 partials ⚠️
... and 13 more

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #194      +/-   ##
==========================================
- Coverage   93.84%   93.65%   -0.19%     
==========================================
  Files         390      403      +13     
  Lines       56009    59272    +3263     
  Branches     3765     3922     +157     
==========================================
+ Hits        52559    55514    +2955     
- Misses       2947     3217     +270     
- Partials      503      541      +38     
Flag Coverage Δ
rust 93.92% <92.73%> (-0.06%) ⬇️
web 92.58% <77.63%> (-0.70%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
apps/desktop/src-tauri/src/dictation.rs 94.17% <100.00%> (+0.01%) ⬆️
apps/desktop/src/features/history/RefineNote.tsx 77.77% <100.00%> (+11.11%) ⬆️
apps/desktop/src/pages/History.tsx 94.26% <100.00%> (+0.04%) ⬆️
apps/desktop/src/pages/Home.tsx 91.54% <ø> (ø)
apps/desktop/src/pages/Overlay.tsx 92.10% <100.00%> (+0.43%) ⬆️
apps/desktop/src/pages/history-list/page-size.ts 100.00% <100.00%> (ø)
apps/desktop/src/pages/settings/PrivacyPane.tsx 90.47% <ø> (ø)
...s/desktop/src/pages/settings/RecordingsSection.tsx 100.00% <100.00%> (ø)
...desktop/src/pages/settings/engines/LocalModels.tsx 94.36% <100.00%> (+0.24%) ⬆️
apps/mobile/src-tauri/src/lib.rs 77.42% <100.00%> (+0.37%) ⬆️
... and 39 more

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sunerpy
sunerpy merged commit 98e12c8 into main Oct 26, 2026
42 of 44 checks passed
@sunerpy
sunerpy deleted the feat/audio-cache branch October 26, 2026 16:31
@github-actions github-actions Bot mentioned this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

模型下载,不能设置保存路径?C 盘满了

1 participant