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 macos_tts_speech merge conflict

Bituq353785d23d4f
diff --git a/scripts/speak.py b/scripts/speak.py
index 8e0fbd9c4d..08b0c1c98e 100644
--- a/scripts/speak.py
+++ b/scripts/speak.py
@@ -20,6 +20,7 @@ mutex_lock = Lock() # Ensure only one sound is played at a time
queue_semaphore = Semaphore(1) # The amount of sounds to queue before blocking the main thread
def eleven_labs_speech(text, voice_index=0):
+ """Speak text using elevenlabs.io's API"""
tts_url = "https://api.elevenlabs.io/v1/text-to-speech/{voice_id}".format(
voice_id=voices[voice_index])
formatted_message = {"text": text}
@@ -45,11 +46,17 @@ def gtts_speech(text):
playsound("speech.mp3", True)
os.remove("speech.mp3")
+def macos_tts_speech(text):
+ os.system(f'say "{text}"')
+
def say_text(text, voice_index=0):
def speak():
if not cfg.elevenlabs_api_key:
- gtts_speech(text)
+ if cfg.use_mac_os_tts == 'True':
+ macos_tts_speech(text)
+ else:
+ gtts_speech(text)
else:
success = eleven_labs_speech(text, voice_index)
if not success: