Repository navigation
feat: 重新转录 — last-N recording history + replay through the live pipeline - #47
Merged
Merged
Conversation
…o limit) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- RecordingEnvironment gains makeReplayBackend/copyToClipboard/saveHistory/ updateHistory closures (3a). - New isReplay + replayHistoryId state (3b); start() resets both (3c) and delegates its stream loop to a shared consume() (3d), reused by the new retranscribe()/canRetranscribe (3e). - handleFinal now saves history on every live final (success/empty/error-tail) and updates the replay's history entry in place instead (3f). - injectAndFinish copies to clipboard instead of ⌘V-injecting during replay (3g). Also wires AppDelegate's single RecordingEnvironment call site (the only other caller) with real implementations of the 4 new closures using the already-merged Task 1-3 infra (MultiEngineBackend.forReplay, RecordingHistoryStore, NSPasteboard) -- required to keep the app target compiling; not in the original task-4 file list but mechanically forced by the struct change.
Final-review fixes for feat/retranscribe: - gate canRetranscribe on the trailing .final that archives a failed live session, so a rescue retranscribe can't destroy its own audio or get dropped by the 3s error auto-reset (RecordingController) - missing-file retranscribe now removes the dead history entry instead of surfacing a repeated error (AppDelegate) - fix a 1-byte heap overflow in int16Buffer's memcpy on odd-length chunks (MultiEngineBackend) - log (not silently swallow) a failed sharedWAV replay copy, pin the history id formatter to UTC, recover an orphaned sidecar on updateTranscript, and refresh a stale wantsWAV doc comment
Replay stops microseconds after openStream, hitting paths live recording never exercises: Soniox's stop() flushed nothing (canSendAudio still false) and sent end-of-audio ahead of the buffered PCM — the server answered 'No audio received' on every replay. stop() now waits (bounded 3 s) on a per-session configSent channel, mirroring DoubaoASR's startup grace. The settings history pane rendered its retranscribe buttons while the controller was still .transcribing (the history-changed notification fires at save time) and nothing re-rendered on return to idle — buttons stuck grey. The enabled state is now a @State mirror refreshed by a new .doushaRecordingStatusChanged post from the applyStatusToHUD closure. Evidence: ~/Library/Logs/Dousha/dousha.log 21:15:10Z / 21:16:51Z replay attempts — 'config sent pcmBufferBytes=129562' → 'sent end-of-audio marker' → 'server error: No audio received', picked=doubao len=0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Caches/Dousha/history/(保留最近 N 条,设置里可调 1–50,默认 5;转录失败也归档并标红——救援场景)MultiEngineBackend的 hub-less 回放模式(突发推送 PCM)走完整现有管线(多引擎路由 → 格式化 → 本地纠错 → 可选润色),结果只进剪贴板,不 ⌘V 注入Key changes
RecordingHistoryStore:wav + sidecar JSON,自愈式列表(丢文件不列、孤儿 wav 容错)、按上限裁剪MultiEngineBackend:replayWAV参数 +forReplay工厂;stop()先await startTask(含回放推送)保证音频完整送达引擎RecordingController.retranscribe(id:url:):从.transcribing直接复用状态机;isReplay只在注入一步分叉;pendingErrorMessage门闩防止失败录音在归档完成前被重转毁掉SonioxASR:修复 EOS-before-audio 竞态(stop 追上 openStream 时等 config 上线,镜像 DoubaoASR 的 startup grace)——回放路径 100% 命中的 bug.transcribing渲染后卡灰)Testing
SessionFailed 50700000(现场会话正常),router 兜底 Soniox 文本,跟进见 录音鲁棒性:断网/引擎断连时音频持续录制 + 自动救援 #46🤖 Generated with Claude Code