mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Merge pull request #637 from Wladastic/use-macos-tts-instead-of-gtts
add config to use mac os tts instead of elevenlabs or gtts
This commit is contained in:
@@ -55,6 +55,9 @@ class Config(metaclass=Singleton):
|
||||
|
||||
self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY")
|
||||
|
||||
self.use_mac_os_tts = False
|
||||
self.use_mac_os_tts = os.getenv("USE_MAC_OS_TTS")
|
||||
|
||||
self.google_api_key = os.getenv("GOOGLE_API_KEY")
|
||||
self.custom_search_engine_id = os.getenv("CUSTOM_SEARCH_ENGINE_ID")
|
||||
|
||||
|
||||
@@ -39,9 +39,15 @@ def gtts_speech(text):
|
||||
playsound("speech.mp3")
|
||||
os.remove("speech.mp3")
|
||||
|
||||
def macos_tts_speech(text):
|
||||
os.system(f'say "{text}"')
|
||||
|
||||
def say_text(text, voice_index=0):
|
||||
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