Skip to content

字幕生成全链路:词边界打包 + 字幕面板 + add_captions 工具(1:1 上游)#184

Open
appergb wants to merge 1 commit into
mainfrom
feat/captions-generation
Open

字幕生成全链路:词边界打包 + 字幕面板 + add_captions 工具(1:1 上游)#184
appergb wants to merge 1 commit into
mainfrom
feat/captions-generation

Conversation

@appergb

@appergb appergb commented Jul 2, 2026

Copy link
Copy Markdown
Owner

上游旗舰字幕工作流完整移植:CaptionBuilder 逐字端口(句读优先级断行、缩写保护、字符数分时、0.7s 下限后移防重叠)24 纯测试;EditCommand::AddCaptions 原子建顶轨+captionGroupId(专用命令保单步撤销,AddTexts 无法携带 group id);字幕面板激活(来源自动/轨道/选区、语言、样式、位置预览、需要模型→下载引导);add_captions MCP 解 stub。censorProfanity 全程贯通但 whisper 暂无词表(上游在 ASR 层遮罩,同边界,已文档化)。门禁:workspace 1496(+49)+ web 330 全绿。

…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.
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