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; the previous build issue is fixed and no new actionable issues were found.

Summary

Adds a saved segmentWords setting and a GPUI slider for choosing 1–8 words per generated caption.

  • Editors can choose how many words each new caption segment holds.

Reviews (2) · Last reviewed commit: "fix: address review notes on the segment..." · Reviewed by Greptile

Adds a segmentWords caption setting (1-8, default 6) that controls how many
words a generated caption segment holds, threaded from the captions panels
through both transcription pipelines into the shared chunker.

At 1 the chunker switches to the one word on screen at a time style: every
word becomes its own segment and the multi-word rules (weak boundary
extension, short tail merge) are bypassed. Above 1 the existing rules apply
relative to the chosen size, so the default of 6 reproduces current behavior
exactly.

Settings surface: cap_project::CaptionSettings.segmentWords (JSON
segmentWords), a Words Per Caption slider in the Tauri editor's captions tab
and in the gpui captions sidebar, and the tauri transcribe_audio command
gains an optional segmentWords argument.
@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

)

Drop the apps/desktop (Tauri) feature changes, the app no longer ships.
Fix the GPUI test targets: verify_tests and the parakeet benchmark now
pass a segment size to the reshaped functions. Gate the caption_word_chunks
and MAX_CAPTION_WORD_DURATION imports behind cfg(test), only the tests use
them. The Words Per Caption slider now seeds the captions block when the
project has none, so the size can be picked before the first
transcription.

cap-desktop keeps building: its CaptionSettings initializer fills
segment_words from the settings object, and the legacy serializer keeps
the key on round-trip.
@Ker102
Ker102 force-pushed the feat/configurable-caption-segment-words branch from 8eebbed to c4a62c7 Compare October 26, 2026 09:28
@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

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

1 participant