From bbe6b1f626847e9b323edc6e0747e93e6656dd91 Mon Sep 17 00:00:00 2001 From: Dill <4053467+dillweed@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:27:37 -0700 Subject: [PATCH 1/3] 'Config' object has no attribute 'debug' --- scripts/chat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/chat.py b/scripts/chat.py index 23e5b50149..30f7603c76 100644 --- a/scripts/chat.py +++ b/scripts/chat.py @@ -64,14 +64,14 @@ def chat_with_ai( model = cfg.fast_llm_model # TODO: Change model from hardcode to argument # Reserve 1000 tokens for the response - if cfg.debug: + if cfg.debug_mode: print(f"Token limit: {token_limit}") send_token_limit = token_limit - 1000 relevant_memory = permanent_memory.get_relevant(str(full_message_history[-5:]), 10) - if cfg.debug: + if cfg.debug_mode: print('Memory Stats: ', permanent_memory.get_stats()) next_message_to_add_index, current_tokens_used, insertion_index, current_context = generate_context( @@ -110,7 +110,7 @@ def chat_with_ai( # assert tokens_remaining >= 0, "Tokens remaining is negative. This should never happen, please submit a bug report at https://www.github.com/Torantulino/Auto-GPT" # Debug print the current context - if cfg.debug: + if cfg.debug_mode: print(f"Token limit: {token_limit}") print(f"Send Token Count: {current_tokens_used}") print(f"Tokens remaining for response: {tokens_remaining}") From f8438aabc2122f6774b1f5a7d7b9ed17f36ae4ca Mon Sep 17 00:00:00 2001 From: Dill <4053467+dillweed@users.noreply.github.com> Date: Tue, 11 Apr 2023 21:37:03 -0700 Subject: [PATCH 2/3] Added option for custom elevenlabs voice IDs. --- .env.template | 4 +++- scripts/config.py | 10 ++++++++++ scripts/speak.py | 16 ++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.env.template b/.env.template index 01735615ca..b4cde93896 100644 --- a/.env.template +++ b/.env.template @@ -2,6 +2,8 @@ PINECONE_API_KEY=your-pinecone-api-key PINECONE_ENV=your-pinecone-region OPENAI_API_KEY=your-openai-api-key ELEVENLABS_API_KEY=your-elevenlabs-api-key +ELEVENLABS_VOICE_1_ID=your-voice-id +ELEVENLABS_VOICE_2_ID=your-voice-id SMART_LLM_MODEL=gpt-4 FAST_LLM_MODEL=gpt-3.5-turbo GOOGLE_API_KEY= @@ -12,4 +14,4 @@ OPENAI_AZURE_API_VERSION=api-version-for-azure OPENAI_AZURE_DEPLOYMENT_ID=deployment-id-for-azure IMAGE_PROVIDER=dalle HUGGINGFACE_API_TOKEN= -USE_MAC_OS_TTS=False +USE_MAC_OS_TTS=False \ No newline at end of file diff --git a/scripts/config.py b/scripts/config.py index 24911bce93..1dd9c8808d 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -54,6 +54,8 @@ class Config(metaclass=Singleton): openai.api_version = self.openai_api_version self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY") + self.elevenlabs_voice_1_id = os.getenv("ELEVENLABS_VOICE_1_ID") + self.elevenlabs_voice_2_id = os.getenv("ELEVENLABS_VOICE_2_ID") self.use_mac_os_tts = False self.use_mac_os_tts = os.getenv("USE_MAC_OS_TTS") @@ -113,6 +115,14 @@ class Config(metaclass=Singleton): """Set the ElevenLabs API key value.""" self.elevenlabs_api_key = value + def set_elevenlabs_voice_1_id(self, value: str): + """Set the ElevenLabs Voice 1 ID value.""" + self.elevenlabs_voice_1_id = value + + def set_elevenlabs_voice_2_id(self, value: str): + """Set the ElevenLabs Voice 2 ID value.""" + self.elevenlabs_voice_2_id = value + def set_google_api_key(self, value: str): """Set the Google API key value.""" self.google_api_key = value diff --git a/scripts/speak.py b/scripts/speak.py index 08b0c1c98e..5eed28d438 100644 --- a/scripts/speak.py +++ b/scripts/speak.py @@ -7,9 +7,21 @@ import gtts import threading from threading import Lock, Semaphore +# Default voice IDs +default_voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"] -# TODO: Nicer names for these ids -voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"] +# Retrieve custom voice IDs from the Config class +custom_voice_1 = cfg.elevenlabs_voice_1_id +custom_voice_2 = cfg.elevenlabs_voice_2_id + +# Placeholder values that should be treated as empty +placeholders = {"your-voice-id"} + +# Use custom voice IDs if provided and not placeholders, otherwise use default voice IDs +voices = [ + custom_voice_1 if custom_voice_1 and custom_voice_1 not in placeholders else default_voices[0], + custom_voice_2 if custom_voice_2 and custom_voice_2 not in placeholders else default_voices[1] +] tts_headers = { "Content-Type": "application/json", From 15ee80e87d5b4a28c9a5390a23156c975b8544c5 Mon Sep 17 00:00:00 2001 From: Dill <4053467+dillweed@users.noreply.github.com> Date: Tue, 11 Apr 2023 22:05:07 -0700 Subject: [PATCH 3/3] Newline at end of file --- .env.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.template b/.env.template index b4cde93896..6fbc84243b 100644 --- a/.env.template +++ b/.env.template @@ -14,4 +14,4 @@ OPENAI_AZURE_API_VERSION=api-version-for-azure OPENAI_AZURE_DEPLOYMENT_ID=deployment-id-for-azure IMAGE_PROVIDER=dalle HUGGINGFACE_API_TOKEN= -USE_MAC_OS_TTS=False \ No newline at end of file +USE_MAC_OS_TTS=False