mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-02 16:38:14 +00:00
disable tts edit/delete when migrated
This commit is contained in:
1 parent
c7bc5e3686
commit
cb6feaaa46
3 files changed
+13
-2
No files matched your search
@@ -222,7 +222,6 @@ impl TtsModelInfoMigration {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn text_preprocessing_algorithm(&self) -> &str {
|
||||
match self {
|
||||
Self::LegacyTts(ref model) => &model.text_preprocessing_algorithm,
|
||||
|
||||
@@ -76,6 +76,12 @@ pub async fn delete_tts_model_handler(
|
||||
request: web::Json<DeleteTtsModelRequest>,
|
||||
server_state: web::Data<Arc<ServerState>>
|
||||
) -> Result<HttpResponse, DeleteTtsModelError> {
|
||||
// NB: Disable if we've migrated to model_weights
|
||||
if server_state.flags.switch_tts_to_model_weights {
|
||||
warn!("Migration to model_weights for tts. Cannot delete old model.");
|
||||
return Err(DeleteTtsModelError::ServerError);
|
||||
}
|
||||
|
||||
let maybe_user_session = server_state
|
||||
.session_checker
|
||||
.maybe_get_user_session(&http_request, &server_state.mysql_pool)
|
||||
|
||||
@@ -132,9 +132,15 @@ impl fmt::Display for EditTtsModelError {
|
||||
pub async fn edit_tts_model_handler(
|
||||
http_request: HttpRequest,
|
||||
path: Path<EditTtsModelPathInfo>,
|
||||
request: web::Json<EditTtsModelRequest>,
|
||||
request: Json<EditTtsModelRequest>,
|
||||
server_state: web::Data<Arc<ServerState>>) -> Result<HttpResponse, EditTtsModelError>
|
||||
{
|
||||
// NB: Disable if we've migrated to model_weights
|
||||
if server_state.flags.switch_tts_to_model_weights {
|
||||
warn!("Migration to model_weights for tts. Cannot delete old model.");
|
||||
return Err(EditTtsModelError::ServerError);
|
||||
}
|
||||
|
||||
let maybe_user_session = server_state
|
||||
.session_checker
|
||||
.maybe_get_user_session(&http_request, &server_state.mysql_pool)
|
||||
|
||||
Reference in new issue
Block a user