feat(transcription): drive live worker with StreamTuning; store only committed segments
This commit is contained in:
@@ -430,6 +430,9 @@ pub async fn start_recording(
|
||||
let language_for_worker = language.clone();
|
||||
let app_for_worker = app.clone();
|
||||
let meeting_id_for_worker = meeting_id.clone();
|
||||
// Live-transcript cadence; the low-overhead preset trades a touch of
|
||||
// immediacy for half the decode load (see StreamTuning).
|
||||
let stream_tuning = crate::transcription::StreamTuning::new(settings.low_overhead);
|
||||
let transcription_worker = std::thread::Builder::new()
|
||||
.name("wa-transcription".into())
|
||||
.spawn(move || {
|
||||
@@ -460,9 +463,19 @@ pub async fn start_recording(
|
||||
if let Ok(mut lang) = language_state_for_worker.lock() {
|
||||
*lang = transcriber.effective_language();
|
||||
}
|
||||
run_streaming_worker(transcriber.as_ref(), frame_rx, |segment| {
|
||||
if let Ok(mut buf) = segments_for_worker.lock() {
|
||||
buf.push(segment.clone());
|
||||
run_streaming_worker(transcriber.as_ref(), frame_rx, stream_tuning, |segment| {
|
||||
// Only committed lines are the real transcript; interim updates
|
||||
// are live-UI only (emitted below). Storing interims would push
|
||||
// a duplicate row per refresh into the buffer stop_recording and
|
||||
// the live-diarization preview both read. A committed line's id
|
||||
// is stable, so replace-in-place guards against any re-commit.
|
||||
if !segment.interim {
|
||||
if let Ok(mut buf) = segments_for_worker.lock() {
|
||||
match buf.iter_mut().find(|s| s.id == segment.id) {
|
||||
Some(existing) => *existing = segment.clone(),
|
||||
None => buf.push(segment.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
let _ = app_for_worker.emit(
|
||||
"transcript://segment",
|
||||
|
||||
Reference in New Issue
Block a user