Skip to content

feat: configurable clip length in UI#9

Open
KrOnAsK wants to merge 1 commit into
JayWebtech:mainfrom
KrOnAsK:feat/configurable-clip-length
Open

feat: configurable clip length in UI#9
KrOnAsK wants to merge 1 commit into
JayWebtech:mainfrom
KrOnAsK:feat/configurable-clip-length

Conversation

@KrOnAsK

@KrOnAsK KrOnAsK commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a user-configurable target clip length, replacing the hardcoded 30-90s range used for viral-moment detection.

  • New Clip Length (seconds) field in Settings (default 60, clamped 10-600, persisted to localStorage).
  • Value flows through the generate_candidates Tauri command as target_seconds.
  • Backend derives a ±25% tolerance band (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.
  • Short-transcript relaxation preserved via a new min_clip_duration helper (sources shorter than 2× the target fall back to half their length).

Test plan

  • cargo check passes
  • npm run build (tsc + vite) passes
  • Manual: set Clip Length, run moment detection per provider, confirm candidate durations track the target

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.
Copilot AI review requested due to automatic review settings June 26, 2026 08:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_candidates as targetSeconds.
  • Compute a ±25% tolerance band in the Tauri command and forward it into all three LLM provider prompt builders.
  • Introduce min_clip_duration to 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 thread src/main.tsx
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"
Comment thread src-tauri/src/llm.rs
max_seconds: f64,
) -> Result<Vec<CandidateDraft>> {
let segments = compact_segments(&transcript.segments);
let dur = format!("{:.0}-{:.0}", min_seconds, max_seconds);
Comment thread src-tauri/src/llm.rs
max_seconds: f64,
) -> Result<Vec<CandidateDraft>> {
let segments = compact_segments(&transcript.segments);
let dur = format!("{:.0}-{:.0}", min_seconds, max_seconds);
Comment thread src-tauri/src/llm.rs
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 thread src-tauri/src/llm.rs
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
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.

2 participants