diff --git a/tts_service/src/endpoints/speak/speak_with_spectrogram.rs b/tts_service/src/endpoints/speak/speak_with_spectrogram.rs index c6b03afaa4..002e9f064f 100644 --- a/tts_service/src/endpoints/speak/speak_with_spectrogram.rs +++ b/tts_service/src/endpoints/speak/speak_with_spectrogram.rs @@ -42,6 +42,13 @@ pub struct SpeakSpectrogramResponse { pub spectrogram: Base64MelSpectrogram, } +#[derive(Serialize,Debug)] +struct RecordRequest { + remote_ip_address: String, + text: String, + speaker: String, +} + pub async fn post_speak_with_spectrogram(request: HttpRequest, query: Json, app_state: Data>) @@ -51,11 +58,6 @@ pub async fn post_speak_with_spectrogram(request: HttpRequest, let client = Client::new(); - let result = client.get("http://localhost:11111/test") - .no_decompress() - .send() - .await; - let ip_address = get_request_ip(&request); if let Err(err) = app_state.rate_limiter.maybe_ratelimit_request(&ip_address, &request.headers()) { @@ -64,6 +66,18 @@ pub async fn post_speak_with_spectrogram(request: HttpRequest, let speaker_slug = query.speaker.to_string(); + let r = RecordRequest { + remote_ip_address: "1.1.1.1".to_string(), + speaker: query.speaker.to_string(), + text: query.text.to_string(), + }; + + let result = client.post("http://localhost:11111/sentence") + .no_decompress() + .header(header::CONTENT_TYPE, "application/json") + .send_json(&r) + .await; + let speaker = match app_state.model_configs.find_speaker_by_slug(&speaker_slug) { Some(speaker) => speaker, None => { diff --git a/tts_service/src/main.rs b/tts_service/src/main.rs index 6cb7a84430..17055901c1 100644 --- a/tts_service/src/main.rs +++ b/tts_service/src/main.rs @@ -74,7 +74,7 @@ const ENV_RUST_LOG : &'static str = "RUST_LOG"; const DEFAULT_ASSET_DIRECTORY : &'static str = "/home/bt/dev/voice/voder/tts_frontend/build"; const DEFAULT_BIND_ADDRESS : &'static str = "0.0.0.0:12345"; -const DEFAULT_DATABASE_ENABLED : bool = true; +const DEFAULT_DATABASE_ENABLED : bool = false; const DEFAULT_DATABASE_URL : &'static str = "mysql://root:root@localhost/mumble"; const DEFAULT_DEFAULT_SAMPLE_RATE_HZ : u32 = 22050; const DEFAULT_MAX_CHAR_LEN : usize = 255;