feat: configurable clip length in UI#9
Open
KrOnAsK wants to merge 1 commit into
Open
Conversation
Add a "Clip Length (seconds)" setting (default 60, clamped 10-600, persisted to localStorage) that flows through generate_candidates as target_seconds. The backend derives a +/-25% tolerance band and injects it into all three LLM prompts (Claude, DeepSeek, Ollama) and the candidate min-duration filter, replacing the hardcoded 30-90s range.
There was a problem hiding this comment.
Pull request overview
Adds a user-configurable target clip length to replace the previously hardcoded 30–90s moment-detection window, passing the value from the UI into the Tauri backend to influence both LLM prompting and candidate filtering.
Changes:
- Add a persisted “Clip Length (seconds)” setting in the UI and pass it into
generate_candidatesastargetSeconds. - Compute a ±25% tolerance band in the Tauri command and forward it into all three LLM provider prompt builders.
- Introduce
min_clip_durationto relax minimum-duration filtering for short transcripts.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/main.tsx | Adds clip length setting (localStorage + UI input) and sends it to generate_candidates. |
| src-tauri/src/llm.rs | Threads min/max duration band into prompts and introduces min_clip_duration for filtering. |
| src-tauri/src/lib.rs | Extends generate_candidates to accept target_seconds, compute band, and pass it into LLM detection functions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+649
to
+652
| value={clipLength} | ||
| onChange={(event) => setClipLength(Number(event.target.value) || 0)} | ||
| onBlur={() => setClipLength((v) => Math.min(600, Math.max(10, v || 60)))} | ||
| type="number" |
| max_seconds: f64, | ||
| ) -> Result<Vec<CandidateDraft>> { | ||
| let segments = compact_segments(&transcript.segments); | ||
| let dur = format!("{:.0}-{:.0}", min_seconds, max_seconds); |
| max_seconds: f64, | ||
| ) -> Result<Vec<CandidateDraft>> { | ||
| let segments = compact_segments(&transcript.segments); | ||
| let dur = format!("{:.0}-{:.0}", min_seconds, max_seconds); |
Comment on lines
+170
to
+172
| {min_seconds:.0}-{max_seconds:.0} seconds long, and cut at clean sentence/thought boundaries. \ | ||
| CRITICAL: Each clip candidate MUST have a duration between {min_seconds:.0} and {max_seconds:.0} seconds (i.e. 'end' minus 'start' must be between {min_seconds:.1} and {max_seconds:.1}). \ | ||
| Do NOT return short clips of less than {min_seconds:.0} seconds. Combine multiple adjacent sentences to build a meaningful segment of {min_seconds:.0}-{max_seconds:.0} seconds. \ |
Comment on lines
+237
to
+241
| fn min_clip_duration(transcript_duration: f64, min_seconds: f64) -> f64 { | ||
| if transcript_duration < min_seconds * 2.0 { | ||
| (transcript_duration * 0.5).max(5.0) | ||
| } else { | ||
| min_seconds |
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.
Summary
Adds a user-configurable target clip length, replacing the hardcoded 30-90s range used for viral-moment detection.
generate_candidatesTauri command astarget_seconds.min = target*0.75,max = target*1.25) and injects it into all three LLM prompts (Claude, DeepSeek, Ollama) plus the candidate min-duration filter.min_clip_durationhelper (sources shorter than 2× the target fall back to half their length).Test plan
cargo checkpassesnpm run build(tsc + vite) passes