mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 06:54:22 +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:
@@ -12,3 +12,4 @@ OPENAI_API_VERSION=api-version-for-azure
|
|||||||
OPENAI_DEPLOYMENT_ID=deployment-id-for-azure
|
OPENAI_DEPLOYMENT_ID=deployment-id-for-azure
|
||||||
IMAGE_PROVIDER=dalle
|
IMAGE_PROVIDER=dalle
|
||||||
HUGGINGFACE_API_TOKEN=
|
HUGGINGFACE_API_TOKEN=
|
||||||
|
USE_MAC_OS_TTS=False
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ class Config(metaclass=Singleton):
|
|||||||
|
|
||||||
self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY")
|
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.google_api_key = os.getenv("GOOGLE_API_KEY")
|
||||||
self.custom_search_engine_id = os.getenv("CUSTOM_SEARCH_ENGINE_ID")
|
self.custom_search_engine_id = os.getenv("CUSTOM_SEARCH_ENGINE_ID")
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,14 @@ def gtts_speech(text):
|
|||||||
playsound("speech.mp3")
|
playsound("speech.mp3")
|
||||||
os.remove("speech.mp3")
|
os.remove("speech.mp3")
|
||||||
|
|
||||||
|
def macos_tts_speech(text):
|
||||||
|
os.system(f'say "{text}"')
|
||||||
|
|
||||||
def say_text(text, voice_index=0):
|
def say_text(text, voice_index=0):
|
||||||
if not cfg.elevenlabs_api_key:
|
if not cfg.elevenlabs_api_key:
|
||||||
|
if cfg.use_mac_os_tts == 'True':
|
||||||
|
macos_tts_speech(text)
|
||||||
|
else:
|
||||||
gtts_speech(text)
|
gtts_speech(text)
|
||||||
else:
|
else:
|
||||||
success = eleven_labs_speech(text, voice_index)
|
success = eleven_labs_speech(text, voice_index)
|
||||||
|
|||||||
Reference in New Issue
Block a user