commit
429317e6b2
|
@ -2,6 +2,8 @@ PINECONE_API_KEY=your-pinecone-api-key
|
|||
PINECONE_ENV=your-pinecone-region
|
||||
OPENAI_API_KEY=your-openai-api-key
|
||||
ELEVENLABS_API_KEY=your-elevenlabs-api-key
|
||||
ELEVENLABS_VOICE_1_ID=your-voice-id
|
||||
ELEVENLABS_VOICE_2_ID=your-voice-id
|
||||
SMART_LLM_MODEL=gpt-4
|
||||
FAST_LLM_MODEL=gpt-3.5-turbo
|
||||
GOOGLE_API_KEY=
|
||||
|
|
|
@ -54,6 +54,8 @@ class Config(metaclass=Singleton):
|
|||
openai.api_version = self.openai_api_version
|
||||
|
||||
self.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY")
|
||||
self.elevenlabs_voice_1_id = os.getenv("ELEVENLABS_VOICE_1_ID")
|
||||
self.elevenlabs_voice_2_id = os.getenv("ELEVENLABS_VOICE_2_ID")
|
||||
|
||||
self.use_mac_os_tts = False
|
||||
self.use_mac_os_tts = os.getenv("USE_MAC_OS_TTS")
|
||||
|
@ -113,6 +115,14 @@ class Config(metaclass=Singleton):
|
|||
"""Set the ElevenLabs API key value."""
|
||||
self.elevenlabs_api_key = value
|
||||
|
||||
def set_elevenlabs_voice_1_id(self, value: str):
|
||||
"""Set the ElevenLabs Voice 1 ID value."""
|
||||
self.elevenlabs_voice_1_id = value
|
||||
|
||||
def set_elevenlabs_voice_2_id(self, value: str):
|
||||
"""Set the ElevenLabs Voice 2 ID value."""
|
||||
self.elevenlabs_voice_2_id = value
|
||||
|
||||
def set_google_api_key(self, value: str):
|
||||
"""Set the Google API key value."""
|
||||
self.google_api_key = value
|
||||
|
|
|
@ -7,9 +7,21 @@ import gtts
|
|||
import threading
|
||||
from threading import Lock, Semaphore
|
||||
|
||||
# Default voice IDs
|
||||
default_voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"]
|
||||
|
||||
# TODO: Nicer names for these ids
|
||||
voices = ["ErXwobaYiN019PkySvjV", "EXAVITQu4vr4xnSDxMaL"]
|
||||
# Retrieve custom voice IDs from the Config class
|
||||
custom_voice_1 = cfg.elevenlabs_voice_1_id
|
||||
custom_voice_2 = cfg.elevenlabs_voice_2_id
|
||||
|
||||
# Placeholder values that should be treated as empty
|
||||
placeholders = {"your-voice-id"}
|
||||
|
||||
# Use custom voice IDs if provided and not placeholders, otherwise use default voice IDs
|
||||
voices = [
|
||||
custom_voice_1 if custom_voice_1 and custom_voice_1 not in placeholders else default_voices[0],
|
||||
custom_voice_2 if custom_voice_2 and custom_voice_2 not in placeholders else default_voices[1]
|
||||
]
|
||||
|
||||
tts_headers = {
|
||||
"Content-Type": "application/json",
|
||||
|
|
Loading…
Reference in New Issue