mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Fix macos_tts_speech merge conflict
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user