Skip to content

fix(media): 载入旧转写缓存时清洗非语音标记——#198 的读取侧防线#207

Merged
appergb merged 1 commit into
betafrom
fix/198-cache-sanitize
Jul 6, 2026
Merged

fix(media): 载入旧转写缓存时清洗非语音标记——#198 的读取侧防线#207
appergb merged 1 commit into
betafrom
fix/198-cache-sanitize

Conversation

@appergb

@appergb appergb commented Jul 6, 2026

Copy link
Copy Markdown
Owner

真机复现(修复版 1.0.0 回归测试中发现)

#198 的 whisper 层过滤(PR #204)只作用于新转写;磁盘转写缓存(media-cache/Transcripts/<key>.json)命中时短路重转写,修复前写入的旧缓存永远复活 '[BLANK_AUDIO]' 字幕。真机验证:同一素材 add_captions,删缓存后干净、缓存存在时垃圾字幕重现。

修复

  • sanitize_transcription(transcribe/mod.rs):滤除 marker 行(segments+words),有剥除时用幸存 segments 重建 text,干净结果原样直通(幂等)
  • 接线两个磁盘读取点:cached_on_disk + TranscriptCache::cached(memory-then-disk 路径)

测试

  • cached_on_disk_scrubs_pre_filter_marker_rows:构造含 [BLANK_AUDIO] 的旧格式缓存文件,两条读取路径载入均断言已清洗
  • sanitize_strips_marker_rows_and_rebuilds_text / sanitize_passes_clean_results_through_untouched

cargo test -p opentake-media 全绿,clippy -D warnings 零告警。

Fixes #198(读取侧补全)

…pt caches (#198)

The #198 whisper-layer filter only runs on NEW transcriptions; the on-disk
transcript cache short-circuits re-transcription, so a cache written before
the filter existed kept resurrecting '[BLANK_AUDIO]' captions forever
(reproduced on-device after the filter shipped). Add sanitize_transcription
and apply it at both disk-read points (cached_on_disk + TranscriptCache's
memory-then-disk path); rebuilds text from surviving segments when anything
was stripped, passes clean results through untouched.
@appergb appergb merged commit 5bdbade into beta Jul 6, 2026
2 checks passed
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.

1 participant