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
feat(channels): add host adapter for web chat task runs
Steven Enamakel1e0f68eb038e
diff --git a/crates/openhuman-core/src/channels/host/adapters.rs b/crates/openhuman-core/src/channels/host/adapters.rsindex ac5b8cbeba..a7dbe35444 100644--- a/crates/openhuman-core/src/channels/host/adapters.rs+++ b/crates/openhuman-core/src/channels/host/adapters.rs@@ -120,10 +120,10 @@ impl Transcriber for VoiceTranscriber {}// ----------------------------------------------------------------------------// SpeechSynthesizer → voice reply_speech+// SpeechSynthesizer → the registered `cloud` TTS provider// ----------------------------------------------------------------------------/// Text-to-speech backed by the hosted reply-speech synthesizer.+/// Text-to-speech backed by the registered hosted TTS provider.#[cfg(test)]pub struct VoiceSynthesizer {pub config: Arc<Config>,@@ -138,23 +138,29 @@ impl SpeechSynthesizer for VoiceSynthesizer {request.text.len(),request.voice);- let opts = crate::voice::reply_speech::ReplySpeechOptions {- voice_id: request.voice,- model_id: None,- output_format: request.format,- voice_settings: None,- };- let outcome =- crate::voice::reply_speech::synthesize_reply(&self.config, &request.text, &opts)+ // The hosted speech provider is registered by the hosted-backend layer+ // under the `cloud` slug; with none registered this is an error.+ #[cfg(feature = "voice")]+ {+ let voice = request.voice.as_deref().unwrap_or_default();+ let provider = crate::voice::create_tts_provider("cloud", voice, &self.config)?;+ let outcome = provider+ .synthesize(&self.config, &request.text, request.voice.as_deref()).await.map_err(|e| anyhow::anyhow!(e))?;- let value = outcome.value;- let visemes = serde_json::to_value(&value.visemes).ok();- Ok(SpeechResult {- audio_base64: value.audio_base64,- mime_type: value.audio_mime,- visemes,- })+ let value = outcome.value;+ let visemes = serde_json::to_value(&value.visemes).ok();+ Ok(SpeechResult {+ audio_base64: value.audio_base64,+ mime_type: value.audio_mime,+ visemes,+ })+ }+ #[cfg(not(feature = "voice"))]+ {+ let _ = request;+ Err(anyhow::anyhow!("voice feature disabled at compile time"))+ }}}diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rsindex 6f37fa2469..bb11ba65c3 100644--- a/crates/openhuman-core/src/web_chat/run_task.rs+++ b/crates/openhuman-core/src/web_chat/run_task.rs@@ -292,15 +292,22 @@ pub(crate) async fn run_chat_task(let speak_reply = matches!(metadata.speak_reply, Some(true));let trimmed_response = task_result.full_response.trim();if speak_reply && !trimmed_response.is_empty() {- let opts = crate::voice::reply_speech::ReplySpeechOptions::default();- match crate::voice::reply_speech::synthesize_reply(- &config,- &task_result.full_response,- &opts,- )- .await- {- Ok(_) => log::debug!(+ // Resolved through the voice registry by the hosted slug: the+ // provider is registered by the hosted-backend layer, so a core+ // with none registered logs the error and skips the spoken reply.+ #[cfg(feature = "voice")]+ let speech = match crate::voice::create_tts_provider("cloud", "", &config) {+ Ok(provider) => provider+ .synthesize(&config, &task_result.full_response, None)+ .await+ .map(|_| ()),+ Err(err) => Err(err.to_string()),+ };+ #[cfg(not(feature = "voice"))]+ let speech: Result<(), String> =+ Err("voice feature disabled at compile time".to_string());+ match speech {+ Ok(()) => log::debug!("[web_channel] reply_speech dispatched chars={} client_id={} thread_id={} request_id={}",task_result.full_response.len(),client_id,