Skip to content

feat: configurable words per caption segment - #3296

Open
Ker102 wants to merge 2 commits into
CapSoftware:mainfrom
Ker102:feat/configurable-caption-segment-words
Open

Ker102 wants to merge 2 commits into
CapSoftware:mainfrom
Ker102:feat/configurable-caption-segment-words

Conversation

@Ker102

@Ker102 Ker102 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Sorry for the noise, I put the first version of this up from the wrong account (#3284), it was supposed to go here.

Adds a segmentWords caption setting, 1 to 8, default 6, so words on screen at once is configurable instead of the hardcoded constants. Covers #3291.

How it behaves: at 1 you get the one word at a time style, every word its own segment, and the multi-word rules (weak boundary extension, short tail merge) are bypassed. Above 1 the same rules apply relative to the size you pick, and the default of 6 reproduces today's behavior exactly.

What changed since the review on #3284:

  • the GPUI test targets compile again, verify_tests and the parakeet benchmark pass a segment size now
  • caption_word_chunks and MAX_CAPTION_WORD_DURATION imports are gated behind cfg(test), only the tests use them
  • the Words Per Caption slider seeds the captions block when the project has none, so the size can be picked before the first transcription
  • no apps/desktop changes at all, the setting lives in cap_project::CaptionSettings and the gpui captions sidebar

Presets instead of a free number is still open for discussion in #3291, this just exposes the raw knob.

Tested:

  • cargo test -p cap-project: 197 passed (includes the new chunker tests for the 1-word bypass and custom sizes)
  • cargo clippy -p cap-project --all-features -- -D warnings, cargo fmt --check
  • cargo check -p cap-rendering -p cap-verify --tests: compiles
  • cargo test --no-run for the gpui app and all its test targets (unit tests, camera_convert, editor_frame0): compiles and links

everything ran in an ubuntu 24.04 container with the repo's toolchain.

Stacked on #3295. Closes #3291

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no blocking issues remain.

Summary

Adds a configurable caption segment size, with a default of six words.

  • Caption generation follows the chosen words-per-caption setting.

All three previous findings are addressed or obsolete. No new actionable issues were found.

Reviews (5) · Last reviewed commit: "fix: one word per caption keeps fillers ..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@Ker102 is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Comment on lines +2358 to +2359
#[serde(alias = "segmentWords")]
pub segment_words: u32,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Desktop build fails

Adding segment_words breaks the cap-desktop build. The CaptionSettings initializer in apps/desktop/src-tauri/src/captions.rs:1844–1867 lists every field explicitly but omits this new field, so Rust rejects it. That crate remains a workspace member. Update its initializer alongside this shared type, even though the new slider is GPUI-only.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/project/src/configuration.rs
Line: 2358-2359

Comment:
**Desktop build fails**

Adding `segment_words` breaks the `cap-desktop` build. The `CaptionSettings` initializer in `apps/desktop/src-tauri/src/captions.rs:1844–1867` lists every field explicitly but omits this new field, so Rust rejects it. That crate remains a workspace member. Update its initializer alongside this shared type, even though the new slider is GPUI-only.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trigger again

@Ker102

Ker102 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

good catch, that initializer was covered in the first version of this and got dropped with the rest of the Tauri changes. fixed now: the initializer fills segment_words from the settings object and the legacy serializer keeps the key on round-trip, so the shared type change doesn't cost the old app any saved settings. cargo check -p cap-desktop is green for me locally.

ready for another look.

@Ker102

Ker102 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

greptile re-review

@Ker102

Ker102 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

@greptile review

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks! Can you get Greptile to 5/5 on the latest commit and get CI green? Then we'll take a look.

@Ker102

Ker102 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@greptile review

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks! Can you rebase on main to clear the conflicts and resolve the open review threads? Then we'll take a look.

Adds a segmentWords caption setting (1 to 8, default 6) and a Words Per
Caption slider in the GPUI captions sidebar. 1 is one word on screen at a
time; above 1 the existing chunking rules apply relative to the chosen size.
The size is also kept on the refinement request so refined captions are
chunked the same way.
@Ker102
Ker102 force-pushed the feat/configurable-caption-segment-words branch from 6b43aa9 to 68e2c25 Compare November 8, 2026 01:19
@Ker102

Ker102 commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on main, sorry for the delay. The Tauri app this touched was removed upstream, so I re-applied the change on the GPUI side only (the words-per-caption size is also carried on the refinement request so refined captions keep it), and that made the old Tauri build thread obsolete. CI is green apart from the two Vercel checks, which just need a team member to authorize the deploy, and the x86_64 macOS GPUI build is still queued.

@greptile review

Comment on lines +175 to 176
) -> Vec<&[CaptionWord]> {
let spoken: Vec<usize> = words

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 One-word captions show several words

With segment_words = 1, English captions still group fillers with the next spoken word. For example, “I um think” becomes ["I"] and ["um", "think"]. Turning on Show Filler Words then displays two words together, breaking the promised one-word-at-a-time mode. Bypass filler grouping when the requested size is one.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/project/src/caption_words.rs
Line: 175-176

Comment:
**One-word captions show several words**

With `segment_words = 1`, English captions still group fillers with the next spoken word. For example, “I um think” becomes `["I"]` and `["um", "think"]`. Turning on Show Filler Words then displays two words together, breaking the promised one-word-at-a-time mode. Bypass filler grouping when the requested size is one.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +1205 to +1208
let captions = project
.captions
.get_or_insert_with(cap_project::CaptionsData::default);
change(&mut captions.settings);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Saved caption style gets skipped

Changing Words Per Caption before the first transcription creates CaptionsData::default(). That makes seed_default_captions return early when generation finishes, so the user's saved default caption style is never applied. Seed the saved default style before writing the chosen size.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/editor_tabs.rs
Line: 1205-1208

Comment:
**Saved caption style gets skipped**

Changing Words Per Caption before the first transcription creates `CaptionsData::default()`. That makes `seed_default_captions` return early when generation finishes, so the user's saved default caption style is never applied. Seed the saved default style before writing the chosen size.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

…th the size

- At 1 word per caption the filler-skipping chunker no longer groups a
  filler with the word after it.
- Picking Words Per Caption before the first transcription seeds the saved
  default caption style first, so generation does not skip it.
@Ker102

Ker102 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the two open Greptile points in 4c09469: at 1 word per caption fillers are no longer grouped with the next word, and picking the size before the first transcription now seeds the saved default caption style first. The old Tauri thread is obsolete since that app was removed upstream.

@greptile review

This branch has not been deployed

No deployments
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.

configurable words per caption segment, down to 1

2 participants