From 870eba8a9c347e10af0c742fb8a4dbf42f3b440d Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 4 Jun 2021 02:06:52 -0400 Subject: [PATCH] improvements --- migrations/2021-05-15-071601_assets/up.sql | 7 +++++++ src/http_server/endpoints/tts/get_tts_model.rs | 4 ++++ src/http_server/endpoints/tts/get_tts_result.rs | 14 ++++++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/migrations/2021-05-15-071601_assets/up.sql b/migrations/2021-05-15-071601_assets/up.sql index cd33366697..143d92895a 100644 --- a/migrations/2021-05-15-071601_assets/up.sql +++ b/migrations/2021-05-15-071601_assets/up.sql @@ -18,6 +18,13 @@ CREATE TABLE tts_models ( 'glowtts-vocodes' ) NOT NULL DEFAULT 'not-set', + -- NB: DO NOT CHANGE ORDER; APPEND ONLY! + -- How text should be handled. + text_preprocessing_algorithm ENUM( + 'basic-preprocess', + 'arpabet-preprocess' + ) NOT NULL DEFAULT 'basic-preprocess', + -- Optional Pointer to a newer version of the voice -- If there's a newer version, we can disable this one. maybe_updated_model_token VARCHAR(32) DEFAULT NULL, diff --git a/src/http_server/endpoints/tts/get_tts_model.rs b/src/http_server/endpoints/tts/get_tts_model.rs index 0e048d0b2f..9cffbab77f 100644 --- a/src/http_server/endpoints/tts/get_tts_model.rs +++ b/src/http_server/endpoints/tts/get_tts_model.rs @@ -36,6 +36,7 @@ pub struct GetTtsModelPathInfo { pub struct TtsModelRecordForResponse { pub model_token: String, pub tts_model_type: String, + pub text_preprocessing_algorithm: String, pub creator_user_token: String, pub creator_username: String, @@ -69,6 +70,7 @@ pub enum GetTtsModelError { pub struct TtsModelRecord { pub model_token: String, pub tts_model_type: String, + pub text_preprocessing_algorithm: String, pub creator_user_token: String, pub creator_username: String, @@ -122,6 +124,7 @@ pub async fn get_tts_model_handler( SELECT tts.token as model_token, tts.tts_model_type, + tts.text_preprocessing_algorithm, tts.creator_user_token, users.username as creator_username, @@ -161,6 +164,7 @@ AND tts.deleted_at IS NULL let model_for_response = TtsModelRecordForResponse { model_token: template.model_token.clone(), tts_model_type: template.tts_model_type.clone(), + text_preprocessing_algorithm: template.text_preprocessing_algorithm.clone(), creator_user_token: template.creator_user_token.clone(), creator_username: template.creator_username.clone(), creator_display_name: template.creator_display_name.clone(), diff --git a/src/http_server/endpoints/tts/get_tts_result.rs b/src/http_server/endpoints/tts/get_tts_result.rs index 977ac26623..c2ec9c531e 100644 --- a/src/http_server/endpoints/tts/get_tts_result.rs +++ b/src/http_server/endpoints/tts/get_tts_result.rs @@ -35,9 +35,10 @@ pub struct GetTtsResultPathInfo { #[derive(Serialize)] pub struct TtsResultRecordForResponse { pub tts_result_token: String, + pub inference_text: String, pub tts_model_token: String, - pub inference_text: String, + pub tts_model_title: Option, // TODO: Shouldn't be Option. pub maybe_creator_user_token: Option, pub maybe_creator_username: Option, @@ -82,9 +83,10 @@ pub enum GetTtsResultError { pub struct RawTtsResultRecord { pub tts_result_token: String, // from field `tts_results.token` + pub inference_text: String, pub tts_model_token: String, - pub inference_text: String, + pub tts_model_title: Option, pub maybe_creator_user_token: Option, pub maybe_creator_username: Option, @@ -151,9 +153,11 @@ pub async fn get_tts_inference_result_handler( SELECT tts_results.token as tts_result_token, - tts_results.model_token as tts_model_token, tts_results.inference_text, + tts_results.model_token as tts_model_token, + tts_models.title as tts_model_title, + users.token as maybe_creator_user_token, users.username as maybe_creator_username, users.display_name as maybe_creator_display_name, @@ -206,9 +210,11 @@ WHERE let result_for_response = TtsResultRecordForResponse { tts_result_token: ir.tts_result_token.clone(), - tts_model_token: ir.tts_model_token.clone(), inference_text: ir.inference_text.clone(), + tts_model_token: ir.tts_model_token.clone(), + tts_model_title: ir.tts_model_title.clone(), + maybe_creator_user_token: ir.maybe_creator_user_token.clone(), maybe_creator_username: ir.maybe_creator_username.clone(), maybe_creator_display_name: ir.maybe_creator_display_name.clone(),