The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(speech): restore host path context in transcription errors
Steven Enamakel0583cad171b6
diff --git a/crates/openhuman-core/src/inference/host_runtime/service/speech.rs b/crates/openhuman-core/src/inference/host_runtime/service/speech.rsindex f4fa7d1a88..0199718a97 100644--- a/crates/openhuman-core/src/inference/host_runtime/service/speech.rs+++ b/crates/openhuman-core/src/inference/host_runtime/service/speech.rs@@ -51,9 +51,9 @@ pub async fn transcribe_with_prompt(let provider_name = effective_stt_provider(config);debug!("{LOG_PREFIX} configured STT dispatch provider={provider_name} path={audio_path}");let provider = selected_stt_provider(config, &provider_name);- let text =- tinyinference_voice::transcription::transcribe_file(Path::new(audio_path), &provider)- .await?;+ let text = tinyinference_voice::transcription::transcribe_file(Path::new(audio_path), &provider)+ .await+ .map_err(|error| restore_host_file_error(error, audio_path))?;debug!("{LOG_PREFIX} configured STT complete (provider={} elapsed_ms={})",provider_name,@@ -66,6 +66,16 @@ pub async fn transcribe_with_prompt(})}+fn restore_host_file_error(error: String, audio_path: &str) -> String {+ if let Some(reason) = error.strip_prefix("[voice-stt] failed to read audio file: ") {+ return format!("failed to read audio file {audio_path}: {reason}");+ }+ if error == "[voice-stt] audio file is empty" {+ return format!("audio file {audio_path} is empty");+ }+ error+}+/// Transcribe audio bytes with the host-selected STT provider.pub async fn transcribe_bytes(service: &LocalAiService,diff --git a/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rs b/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rsindex e34d6240ab..2c257f8915 100644--- a/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rs+++ b/crates/openhuman-core/src/inference/host_runtime/service/speech_tests.rs@@ -5,6 +5,26 @@ use async_trait::async_trait;use base64::{engine::general_purpose::STANDARD as BASE64, Engine};use std::sync::{Arc, Mutex};+#[test]+fn file_transcription_errors_keep_the_host_path_context() {+ let missing = restore_host_file_error(+ "[voice-stt] failed to read audio file: No such file or directory (os error 2)".into(),+ "/tmp/missing.wav",+ );+ assert_eq!(+ missing,+ "failed to read audio file /tmp/missing.wav: No such file or directory (os error 2)"+ );++ let empty = restore_host_file_error("[voice-stt] audio file is empty".into(), "/tmp/empty.wav");+ assert_eq!(empty, "audio file /tmp/empty.wav is empty");++ assert_eq!(+ restore_host_file_error("provider refused audio".into(), "/tmp/audio.wav"),+ "provider refused audio"+ );+}+#[derive(Debug, PartialEq, Eq)]struct CapturedAudio {bytes: Vec<u8>,