From 767a767989c1c662ca519ce1b6759f015ba22967 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 21 May 2023 14:11:46 -0300 Subject: [PATCH] Fix elevenlabs_tts too --- extensions/elevenlabs_tts/script.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/extensions/elevenlabs_tts/script.py b/extensions/elevenlabs_tts/script.py index 327a9a11..abdeb051 100644 --- a/extensions/elevenlabs_tts/script.py +++ b/extensions/elevenlabs_tts/script.py @@ -71,17 +71,21 @@ def input_modifier(string): This function is applied to your text inputs before they are fed into the model. """ + + shared.processing_message = "*Is recording a voice message...*" + return string + + +def history_modifier(history): + # Remove autoplay from the last reply - if shared.is_chat() and len(shared.history['internal']) > 0: - shared.history['visible'][-1] = [ - shared.history['visible'][-1][0], - shared.history['visible'][-1][1].replace('controls autoplay>', 'controls>') + if len(history['internal']) > 0: + history['visible'][-1] = [ + history['visible'][-1][0], + history['visible'][-1][1].replace('controls autoplay>', 'controls>') ] - if params['activate']: - shared.processing_message = "*Is recording a voice message...*" - - return string + return history def output_modifier(string): @@ -104,7 +108,7 @@ def output_modifier(string): string = 'empty reply, try regenerating' output_file = Path(f'extensions/elevenlabs_tts/outputs/{wav_idx:06d}.mp3'.format(wav_idx)) - print(f'Outputing audio to {str(output_file)}') + print(f'Outputting audio to {str(output_file)}') try: audio = elevenlabs.generate(text=string, voice=params['selected_voice'], model="eleven_monolingual_v1") elevenlabs.save(audio, str(output_file))