Merge pull request #202 from dheavy/feat/tts-openai-gracefull-error-shutdown

Shutdown gracefully if OpenAI key missing for default TTS
pull/206/head
Ty Fiero 9 months ago committed by GitHub
commit 30774b30d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,6 +5,18 @@ import os
import subprocess import subprocess
import tempfile import tempfile
from source.server.utils.logs import logger
from source.server.utils.logs import setup_logging
setup_logging()
# If this TTS service is used, the OPENAI_API_KEY environment variable must be set
if not os.getenv('OPENAI_API_KEY'):
logger.error("")
logger.error(f"OpenAI API key not found. Please set the OPENAI_API_KEY environment variable, or run 01 with the --local option.")
logger.error("Aborting...")
logger.error("")
os._exit(1)
client = OpenAI() client = OpenAI()
class Tts: class Tts:

Loading…
Cancel
Save