From e50ade438ae199cd5c379006f8f3cee96717c908 Mon Sep 17 00:00:00 2001 From: Gabriel Terrien Date: Wed, 24 May 2023 15:06:38 +0200 Subject: [PATCH] FIX silero_tts/elevenlabs_tts activation/deactivation (#2313) --- extensions/elevenlabs_tts/script.py | 14 +++++--------- extensions/silero_tts/script.py | 15 +++++---------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/extensions/elevenlabs_tts/script.py b/extensions/elevenlabs_tts/script.py index abdeb051..1a24db1f 100644 --- a/extensions/elevenlabs_tts/script.py +++ b/extensions/elevenlabs_tts/script.py @@ -62,22 +62,22 @@ def remove_surrounded_chars(string): def state_modifier(state): + if not params['activate']: + return state + state['stream'] = False return state def input_modifier(string): - """ - This function is applied to your text inputs before - they are fed into the model. - """ + if not params['activate']: + return string shared.processing_message = "*Is recording a voice message...*" return string def history_modifier(history): - # Remove autoplay from the last reply if len(history['internal']) > 0: history['visible'][-1] = [ @@ -89,10 +89,6 @@ def history_modifier(history): def output_modifier(string): - """ - This function is applied to the model outputs. - """ - global params, wav_idx if not params['activate']: diff --git a/extensions/silero_tts/script.py b/extensions/silero_tts/script.py index c54d9ac5..0d57a90f 100644 --- a/extensions/silero_tts/script.py +++ b/extensions/silero_tts/script.py @@ -73,22 +73,22 @@ def toggle_text_in_history(): def state_modifier(state): + if not params['activate']: + return state + state['stream'] = False return state def input_modifier(string): - """ - This function is applied to your text inputs before - they are fed into the model. - """ + if not params['activate']: + return string shared.processing_message = "*Is recording a voice message...*" return string def history_modifier(history): - # Remove autoplay from the last reply if len(history['internal']) > 0: history['visible'][-1] = [ @@ -100,12 +100,7 @@ def history_modifier(history): def output_modifier(string): - """ - This function is applied to the model outputs. - """ - global model, current_params, streaming_state - for i in params: if params[i] != current_params[i]: model = load_model()