From c949dbff0ad364249cc05df1f7b6391eb3974512 Mon Sep 17 00:00:00 2001 From: Josh XT Date: Thu, 12 Oct 2023 12:02:05 -0400 Subject: [PATCH] Fix #1048 --- agixt/extensions/voice_chat.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/agixt/extensions/voice_chat.py b/agixt/extensions/voice_chat.py index 52a189b6bcd8..006d94835dbf 100644 --- a/agixt/extensions/voice_chat.py +++ b/agixt/extensions/voice_chat.py @@ -29,12 +29,17 @@ def __init__(self, **kwargs): if kwargs["USE_GTTS"].lower() == "true": self.tts_command = "Speak with GTTS" if "USE_HUGGINGFACE_TTS" in kwargs: - if ( - kwargs["USE_HUGGINGFACE_TTS"].lower() == "true" - and "HUGGINGFACE_API_KEY" in kwargs - ): - if kwargs["HUGGINGFACE_API_KEY"] != "": - self.tts_command = "Read Audio with Huggingface" + if isinstance(kwargs["USE_HUGGINGFACE_TTS"], bool): + if kwargs["USE_HUGGINGFACE_TTS"] and "HUGGINGFACE_API_KEY" in kwargs: + if kwargs["ELEVENLABS_API_KEY"] != "": + self.tts_command = "Read Audio with Huggingface" + else: + if ( + kwargs["USE_HUGGINGFACE_TTS"].lower() == "true" + and "HUGGINGFACE_API_KEY" in kwargs + ): + if kwargs["HUGGINGFACE_API_KEY"] != "": + self.tts_command = "Read Audio with Huggingface" if "ELEVENLABS_API_KEY" in kwargs: if kwargs["ELEVENLABS_API_KEY"] != "": self.tts_command = "Speak with TTS Using Elevenlabs"