feat: display progress for finalising audio and summarising

This commit is contained in:
2026-01-29 12:34:25 -08:00
parent a6843cb3f1
commit 43a544a886
7 changed files with 540 additions and 63 deletions
+18 -3
View File
@@ -371,6 +371,7 @@ async fn stop_recording_batch(
// Transcribe the audio
emit_log(&app_handle, &logs, "[Transcribe] Starting transcription...");
let app_handle_clone = app_handle.clone();
let mut segments = {
let transcriber = state.transcriber.lock();
if !transcriber.is_loaded() {
@@ -378,7 +379,10 @@ async fn stop_recording_batch(
return Err("Whisper model not loaded. Please ensure the model is downloaded.".to_string());
}
transcriber.transcribe(&audio_samples)
transcriber.transcribe_with_progress(&audio_samples, move |progress| {
// Emit progress event to frontend
let _ = app_handle_clone.emit("transcription-progress", progress);
})
.map_err(|e| format!("Transcription failed: {}", e))?
};
@@ -399,6 +403,7 @@ async fn stop_recording_batch(
async fn transcribe_chunk(
state: State<'_, AppState>,
audio_data: Vec<f32>,
app_handle: tauri::AppHandle,
) -> Result<Vec<TranscriptSegment>, String> {
let transcriber = state.transcriber.lock();
@@ -406,7 +411,13 @@ async fn transcribe_chunk(
return Err("Whisper model not loaded".to_string());
}
let segments = transcriber.transcribe(&audio_data)
// Clone the app handle for the closure
let app_handle_clone = app_handle.clone();
let segments = transcriber.transcribe_with_progress(&audio_data, move |progress| {
// Emit progress event to frontend
let _ = app_handle_clone.emit("transcription-progress", progress);
})
.map_err(|e| format!("Transcription failed: {}", e))?;
Ok(segments)
@@ -460,7 +471,11 @@ async fn summarize(
return Err("LLaMA model not loaded".to_string());
}
let summary = summarizer.summarize(&transcript)
let app_handle_clone = app_handle.clone();
let summary = summarizer.summarize_with_progress(&transcript, move |progress| {
// Emit progress event to frontend
let _ = app_handle_clone.emit("summary-progress", progress);
})
.map_err(|e| format!("Summarization failed: {}", e))?;
emit_log(&app_handle, &logs, &format!("[Summary] Generated {} character summary", summary.len()));