perf/pipeline-improvements #2

Merged
jknapp merged 11 commits from perf/pipeline-improvements into main 2026-03-21 05:29:36 +00:00
Showing only changes of commit 727107323c - Show all commits

View File

@@ -60,12 +60,25 @@
function finishEditing(segmentId: string) { function finishEditing(segmentId: string) {
const trimmed = editText.trim(); const trimmed = editText.trim();
if (trimmed) { if (trimmed) {
// Update the segment text in the store // Update the segment text and rebuild words from the edited text.
// The display renders segment.words, so we must update them too.
segments.update(segs => segs.map(s => { segments.update(segs => segs.map(s => {
if (s.id !== segmentId) return s; if (s.id !== segmentId) return s;
// Rebuild words from the edited text, preserving timing from the
// original segment boundaries (individual word timing is lost on edit)
const newWords = trimmed.split(/\s+/).map((word, widx) => ({
id: `${s.id}-word-${widx}`,
segment_id: s.id,
word,
start_ms: s.start_ms,
end_ms: s.end_ms,
confidence: 1.0,
word_index: widx,
}));
return { return {
...s, ...s,
text: trimmed, text: trimmed,
words: newWords,
original_text: s.original_text ?? s.text, original_text: s.original_text ?? s.text,
is_edited: true, is_edited: true,
edited_at: new Date().toISOString(), edited_at: new Date().toISOString(),