diff --git a/crates/openhuman-tinyhumans/src/inference/backend_error_code.rs b/crates/openhuman-tinyhumans/src/inference/backend_error_code.rs index ce0176538b3..675ebe032be 100644 --- a/crates/openhuman-tinyhumans/src/inference/backend_error_code.rs +++ b/crates/openhuman-tinyhumans/src/inference/backend_error_code.rs @@ -135,12 +135,20 @@ pub fn body_flags_malformed(err: &str) -> bool { after_colon.starts_with("true") } +/// User-facing message for a hosted voice request the backend's own upstream +/// provider refused. Nothing the user can change, so no instruction. The +/// failure behind it was already reported (or demoted as transient) by +/// `authed_json`, so the backend-error classifier marks this message +/// backend-owned and not reportable (no second event at the RPC boundary). +pub const HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE: &str = + "The voice service is temporarily unavailable. Please try again later."; + /// Whether `err` is exactly the neutral hosted-voice copy, bare or behind an /// RPC method name (`voice.reply_synthesize: `). Matching the sentence /// anywhere would also exempt another provider's error that happens to quote /// it, which `authed_json` never reported. fn is_hosted_voice_unavailable_copy(err: &str) -> bool { - let message = crate::voice::reply_speech::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE; + let message = HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE; let err = err.trim(); if err == message { return true; diff --git a/crates/openhuman-tinyhumans/src/inference/backend_error_code_tests.rs b/crates/openhuman-tinyhumans/src/inference/backend_error_code_tests.rs index 7cd3b5dc834..84d04b7b86a 100644 --- a/crates/openhuman-tinyhumans/src/inference/backend_error_code_tests.rs +++ b/crates/openhuman-tinyhumans/src/inference/backend_error_code_tests.rs @@ -292,7 +292,7 @@ fn classification_keeps_provider_ownership_separate_from_raw_token_and_reportabi fn hosted_voice_unavailable_copy_is_backend_owned_and_not_reported_again() { // `authed_json` already reported (or demoted as transient) the failure the // neutral copy replaces; the RPC boundary must not report it a second time. - let message = crate::voice::reply_speech::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE; + let message = super::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE; for err in [ message.to_string(), format!("voice.reply_synthesize: {message}"), diff --git a/crates/openhuman-tinyhumans/src/inference/mod.rs b/crates/openhuman-tinyhumans/src/inference/mod.rs index 48fe9c2f850..020c8e36065 100644 --- a/crates/openhuman-tinyhumans/src/inference/mod.rs +++ b/crates/openhuman-tinyhumans/src/inference/mod.rs @@ -34,6 +34,7 @@ use openhuman_embed::__host::inference_registry::{ }; use tinyinference_llm::model::ChatModel; +pub use backend_error_code::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE; pub use managed_model::ManagedOptions; use crate::install::InstallOptions; diff --git a/crates/openhuman-tinyhumans/src/voice/reply_speech.rs b/crates/openhuman-tinyhumans/src/voice/reply_speech.rs index b377169c216..345ababe6ba 100644 --- a/crates/openhuman-tinyhumans/src/voice/reply_speech.rs +++ b/crates/openhuman-tinyhumans/src/voice/reply_speech.rs @@ -30,13 +30,8 @@ const LOG_PREFIX: &str = "[voice_reply]"; /// The route this module posts to. const SPEECH_PATH: &str = "/openai/v1/audio/speech"; -/// User-facing message for a hosted voice request the backend's own upstream -/// provider refused. Nothing the user can change, so no instruction. The -/// failure behind it was already reported (or demoted as transient) by -/// `authed_json`, so the backend-error classifier marks this message -/// backend-owned and not reportable (no second event at the RPC boundary). -pub const HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE: &str = - "The voice service is temporarily unavailable. Please try again later."; +/// Lives with the backend-error classifier, which is not gated on `voice`. +pub use crate::inference::HOSTED_VOICE_UNAVAILABLE_USER_MESSAGE; /// The backend's wrappings of an upstream ElevenLabs failure /// (`elevenlabsService` in the backend: TTS, streaming TTS, transcription).