Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(voice): add speech provider abstraction

Steven Enamakel5770459117d7
diff --git a/crates/openhuman-tinyhumans/src/voice/speech_providers.rs b/crates/openhuman-tinyhumans/src/voice/speech_providers.rs
index b502c5d27b..00db9644af 100644
--- a/crates/openhuman-tinyhumans/src/voice/speech_providers.rs
+++ b/crates/openhuman-tinyhumans/src/voice/speech_providers.rs
@@ -119,10 +119,6 @@ impl TtsProvider for CloudTtsProvider {
};
synthesize_reply(config, text, &opts).await
}
-
- fn configured_voice(&self) -> Option<&str> {
- self.voice.as_deref()
- }
}
/// Registers the hosted STT and TTS providers under their slugs.
diff --git a/crates/openhuman-tinyhumans/src/voice/speech_providers_tests.rs b/crates/openhuman-tinyhumans/src/voice/speech_providers_tests.rs
new file mode 100644
index 0000000000..eaa5ba0b18
--- /dev/null
+++ b/crates/openhuman-tinyhumans/src/voice/speech_providers_tests.rs
@@ -0,0 +1,33 @@
+use super::*;
+use openhuman_embed::__host::voice_registry::{
+ unregister_stt_provider, unregister_tts_provider,
+};
+
+#[test]
+fn registration_covers_every_historical_cloud_slug() {
+ register();
+ let config = Config::default();
+ for slug in STT_SLUGS {
+ let factory = lookup_stt(slug);
+ assert_eq!(factory("ignored", &config).unwrap().name(), "cloud", "{slug}");
+ }
+ for slug in TTS_SLUGS {
+ let factory = lookup_tts(slug);
+ assert_eq!(factory(None, &config).unwrap().name(), "cloud", "{slug}");
+ }
+ for slug in STT_SLUGS {
+ unregister_stt_provider(slug);
+ }
+ for slug in TTS_SLUGS {
+ unregister_tts_provider(slug);
+ }
+}
+
+#[test]
+fn cloud_tts_without_a_voice_carries_none_so_the_backend_default_applies() {
+ // #5355: a Piper voice id must never reach the hosted proxy as `voice_id`.
+ let provider = CloudTtsProvider::new(None);
+ assert_eq!(provider.voice, None);
+ let provider = CloudTtsProvider::new(Some("JBFqnCBsd6RMkjVDRZzb".into()));
+ assert_eq!(provider.voice.as_deref(), Some("JBFqnCBsd6RMkjVDRZzb"));
+}