Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Fix configuring TTS engine (#5005)

Reinier van der Leer0c94bb5f2510
diff --git a/autogpt/config/config.py b/autogpt/config/config.py
index cb3f26d3e2..b6773511d5 100644
--- a/autogpt/config/config.py
+++ b/autogpt/config/config.py
@@ -277,16 +277,16 @@ class ConfigBuilder(Configurable[Config]):
config_dict["elevenlabs_voice_id"] = os.getenv(
"ELEVENLABS_VOICE_ID", os.getenv("ELEVENLABS_VOICE_1_ID")
)
- elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY")
- if os.getenv("USE_MAC_OS_TTS"):
- default_tts_provider = "macos"
- elif elevenlabs_api_key:
- default_tts_provider = "elevenlabs"
- elif os.getenv("USE_BRIAN_TTS"):
- default_tts_provider = "streamelements"
- else:
- default_tts_provider = "gtts"
- config_dict["text_to_speech_provider"] = default_tts_provider
+ if not config_dict["text_to_speech_provider"]:
+ if os.getenv("USE_MAC_OS_TTS"):
+ default_tts_provider = "macos"
+ elif config_dict["elevenlabs_api_key"]:
+ default_tts_provider = "elevenlabs"
+ elif os.getenv("USE_BRIAN_TTS"):
+ default_tts_provider = "streamelements"
+ else:
+ default_tts_provider = "gtts"
+ config_dict["text_to_speech_provider"] = default_tts_provider
config_dict["plugins_allowlist"] = _safe_split(os.getenv("ALLOWLISTED_PLUGINS"))
config_dict["plugins_denylist"] = _safe_split(os.getenv("DENYLISTED_PLUGINS"))