mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 23:14:25 +01:00
Fixed formatting issues
This commit is contained in:
@@ -72,13 +72,11 @@ class Config(metaclass=Singleton):
|
|||||||
|
|
||||||
# User agent headers to use when browsing web
|
# User agent headers to use when browsing web
|
||||||
# Some websites might just completely deny request with an error code if no user agent was found.
|
# Some websites might just completely deny request with an error code if no user agent was found.
|
||||||
self.user_agent_header = {
|
self.user_agent_header = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"}
|
||||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"}
|
|
||||||
self.redis_host = os.getenv("REDIS_HOST", "localhost")
|
self.redis_host = os.getenv("REDIS_HOST", "localhost")
|
||||||
self.redis_port = os.getenv("REDIS_PORT", "6379")
|
self.redis_port = os.getenv("REDIS_PORT", "6379")
|
||||||
self.redis_password = os.getenv("REDIS_PASSWORD", "")
|
self.redis_password = os.getenv("REDIS_PASSWORD", "")
|
||||||
self.wipe_redis_on_start = os.getenv(
|
self.wipe_redis_on_start = os.getenv("WIPE_REDIS_ON_START", "True") == 'True'
|
||||||
"WIPE_REDIS_ON_START", "True") == 'True'
|
|
||||||
self.memory_index = os.getenv("MEMORY_INDEX", 'auto-gpt')
|
self.memory_index = os.getenv("MEMORY_INDEX", 'auto-gpt')
|
||||||
# Note that indexes must be created on db 0 in redis, this is not configureable.
|
# Note that indexes must be created on db 0 in redis, this is not configureable.
|
||||||
|
|
||||||
@@ -139,4 +137,4 @@ class Config(metaclass=Singleton):
|
|||||||
|
|
||||||
def set_debug_mode(self, value: bool):
|
def set_debug_mode(self, value: bool):
|
||||||
"""Set the debug mode value."""
|
"""Set the debug mode value."""
|
||||||
self.debug = value
|
self.debug = value
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import gtts
|
|
||||||
import os
|
import os
|
||||||
from playsound import playsound
|
from playsound import playsound
|
||||||
import requests
|
import requests
|
||||||
from config import Config
|
from config import Config
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
|
import gtts
|
||||||
|
|
||||||
|
|
||||||
# TODO: Nicer names for these ids
|
# TODO: Nicer names for these ids
|
||||||
@@ -14,7 +14,6 @@ tts_headers = {
|
|||||||
"xi-api-key": cfg.elevenlabs_api_key
|
"xi-api-key": cfg.elevenlabs_api_key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def eleven_labs_speech(text, voice_index=0):
|
def eleven_labs_speech(text, voice_index=0):
|
||||||
"""Speak text using elevenlabs.io's API"""
|
"""Speak text using elevenlabs.io's API"""
|
||||||
tts_url = "https://api.elevenlabs.io/v1/text-to-speech/{voice_id}".format(
|
tts_url = "https://api.elevenlabs.io/v1/text-to-speech/{voice_id}".format(
|
||||||
@@ -34,7 +33,6 @@ def eleven_labs_speech(text, voice_index=0):
|
|||||||
print("Response content:", response.content)
|
print("Response content:", response.content)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def brian_speech(text):
|
def brian_speech(text):
|
||||||
"""Speak text using Brian with the streamelements API"""
|
"""Speak text using Brian with the streamelements API"""
|
||||||
tts_url = f"https://api.streamelements.com/kappa/v2/speech?voice=Brian&text={text}"
|
tts_url = f"https://api.streamelements.com/kappa/v2/speech?voice=Brian&text={text}"
|
||||||
@@ -51,18 +49,15 @@ def brian_speech(text):
|
|||||||
print("Response content:", response.content)
|
print("Response content:", response.content)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def gtts_speech(text):
|
def gtts_speech(text):
|
||||||
tts = gtts.gTTS(text)
|
tts = gtts.gTTS(text)
|
||||||
tts.save("speech.mp3")
|
tts.save("speech.mp3")
|
||||||
playsound("speech.mp3")
|
playsound("speech.mp3")
|
||||||
os.remove("speech.mp3")
|
os.remove("speech.mp3")
|
||||||
|
|
||||||
|
|
||||||
def macos_tts_speech(text):
|
def macos_tts_speech(text):
|
||||||
os.system(f'say "{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':
|
if cfg.use_mac_os_tts == 'True':
|
||||||
@@ -76,4 +71,4 @@ def say_text(text, voice_index=0):
|
|||||||
else:
|
else:
|
||||||
success = eleven_labs_speech(text, voice_index)
|
success = eleven_labs_speech(text, voice_index)
|
||||||
if not success:
|
if not success:
|
||||||
gtts_speech(text)
|
gtts_speech(text)
|
||||||
Reference in New Issue
Block a user