字幕生成全链路:词边界打包 + 字幕面板 + add_captions 工具(1:1 上游)#184
Open
appergb wants to merge 1 commit into
Open
Conversation
…ab, add_captions tool
Port upstream's flagship caption workflow end to end on the freshly wired
transcription stack:
- transcribe/captions.rs (pure, 24 tests): verbatim CaptionBuilder port — break
priority sentence(.!?) -> clause(,;:) -> midpoint word; delimiters only break
when followed by a space/end so "U.S."/"3.14" stay intact; time shared across
pieces by CHARACTER COUNT back-to-back; 0.7s min-duration floor that SHIFTS
later phrases (never overlaps); style/placement defaults 48pt, (0.5, 0.9).
transcribe/languages.rs: whisper's 100-code table + match_language (4 tests).
- EditCommand::AddCaptions { entries } (4 tests): inserts a fresh top Video
track and places every caption clip (caption_group_id set) in ONE transact =
one undo step, exactly upstream placeCaptionTrack. A dedicated command instead
of InsertTrack+AddTexts composition because (a) upstream is a single undo
swap, (b) TextEntry cannot carry caption_group_id, which subtitle export and
caption-group style sync require. camelCase DTO + serde round-trip test.
- Captions tab (字幕 tab enabled): source auto/track/clips (auto = dominant
speech track in Rust), language auto/manual, font size/color/background/case/
censor toggle, placement preview with 0.5-snap, Generate with needs-model ->
download prompt (reuses transcribe model commands + progress), transcribing/
placing states, result notes. zh/en i18n. Desktop-only (browser fallback shows
a clear note). Driven by new generate_captions command (7 tests).
- add_captions MCP tool un-stubbed (9 tests): params/validation/result strings
per ToolDefinitions.swift:340-354 via MediaBridge (TranscriptSource gains
language + cache-bypass hint).
Documented no-op: censorProfanity threads end-to-end but whisper has no
etiquette word-list yet (upstream masks in the ASR, not CaptionBuilder — same
boundary). Deferred: the tab's Agent-mode section (needs agent chat).
Gates: fmt/clippy -D warnings clean; cargo test --workspace 1496 (+49 caption
tests); pnpm build clean; pnpm test 330.
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.
上游旗舰字幕工作流完整移植:CaptionBuilder 逐字端口(句读优先级断行、缩写保护、字符数分时、0.7s 下限后移防重叠)24 纯测试;EditCommand::AddCaptions 原子建顶轨+captionGroupId(专用命令保单步撤销,AddTexts 无法携带 group id);字幕面板激活(来源自动/轨道/选区、语言、样式、位置预览、需要模型→下载引导);add_captions MCP 解 stub。censorProfanity 全程贯通但 whisper 暂无词表(上游在 ASR 层遮罩,同边界,已文档化)。门禁:workspace 1496(+49)+ web 330 全绿。