Fix progress feedback, diarization fallback, and dropdown readability
- Stream pipeline progress to frontend via Tauri events so the progress overlay updates in real time during transcription/diarization - Gracefully fall back to transcription-only when diarization fails (e.g. pyannote not installed) instead of erroring the whole pipeline - Add color-scheme: dark to fix native select/option elements rendering with unreadable white backgrounds Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use serde_json::{json, Value};
|
||||
use tauri::{AppHandle, Emitter};
|
||||
|
||||
use crate::sidecar::messages::IPCMessage;
|
||||
use crate::sidecar::sidecar;
|
||||
@@ -42,6 +43,7 @@ pub fn transcribe_file(
|
||||
/// Run the full transcription + diarization pipeline via the Python sidecar.
|
||||
#[tauri::command]
|
||||
pub fn run_pipeline(
|
||||
app: AppHandle,
|
||||
file_path: String,
|
||||
model: Option<String>,
|
||||
device: Option<String>,
|
||||
@@ -71,7 +73,9 @@ pub fn run_pipeline(
|
||||
}),
|
||||
);
|
||||
|
||||
let response = manager.send_and_receive(&msg)?;
|
||||
let response = manager.send_and_receive_with_progress(&msg, |progress| {
|
||||
let _ = app.emit("pipeline-progress", &progress.payload);
|
||||
})?;
|
||||
|
||||
if response.msg_type == "error" {
|
||||
return Err(format!(
|
||||
|
||||
@@ -115,8 +115,17 @@ impl SidecarManager {
|
||||
}
|
||||
|
||||
/// Send a message to the sidecar and read the response.
|
||||
/// This is a blocking call.
|
||||
/// This is a blocking call. Progress messages are skipped.
|
||||
pub fn send_and_receive(&self, msg: &IPCMessage) -> Result<IPCMessage, String> {
|
||||
self.send_and_receive_with_progress(msg, |_| {})
|
||||
}
|
||||
|
||||
/// Send a message and read the response, calling on_progress for each progress message.
|
||||
pub fn send_and_receive_with_progress(
|
||||
&self,
|
||||
msg: &IPCMessage,
|
||||
on_progress: impl Fn(&IPCMessage),
|
||||
) -> Result<IPCMessage, String> {
|
||||
// Write to stdin
|
||||
{
|
||||
let mut stdin_guard = self.stdin.lock().map_err(|e| e.to_string())?;
|
||||
@@ -154,10 +163,11 @@ impl SidecarManager {
|
||||
let response: IPCMessage = serde_json::from_str(trimmed)
|
||||
.map_err(|e| format!("Parse error: {e}"))?;
|
||||
|
||||
// Skip progress messages, return the final result/error
|
||||
if response.msg_type != "progress" {
|
||||
return Ok(response);
|
||||
if response.msg_type == "progress" {
|
||||
on_progress(&response);
|
||||
continue;
|
||||
}
|
||||
return Ok(response);
|
||||
}
|
||||
} else {
|
||||
Err("Sidecar stdout not available".to_string())
|
||||
|
||||
Reference in New Issue
Block a user