fix(cartesia): guard HTTP session before use
Pyright flagged the .post() call on a possibly-None _session. Raise a clear RuntimeError if start() wasn't called instead of crashing on the attribute access.
This commit is contained in:
@@ -42,7 +42,6 @@
|
|||||||
"src/pipecat/services/azure/stt.py",
|
"src/pipecat/services/azure/stt.py",
|
||||||
"src/pipecat/services/azure/tts.py",
|
"src/pipecat/services/azure/tts.py",
|
||||||
"src/pipecat/services/cartesia/stt.py",
|
"src/pipecat/services/cartesia/stt.py",
|
||||||
"src/pipecat/services/cartesia/tts.py",
|
|
||||||
"src/pipecat/services/deepgram/flux/base.py",
|
"src/pipecat/services/deepgram/flux/base.py",
|
||||||
"src/pipecat/services/deepgram/flux/sagemaker/stt.py",
|
"src/pipecat/services/deepgram/flux/sagemaker/stt.py",
|
||||||
"src/pipecat/services/deepgram/flux/stt.py",
|
"src/pipecat/services/deepgram/flux/stt.py",
|
||||||
|
|||||||
@@ -916,6 +916,9 @@ class CartesiaHttpTTSService(TTSService):
|
|||||||
logger.debug(f"{self}: Generating TTS [{text}]")
|
logger.debug(f"{self}: Generating TTS [{text}]")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if self._session is None:
|
||||||
|
raise RuntimeError("HTTP session is not initialized; call start() before run_tts()")
|
||||||
|
|
||||||
voice_config = {"mode": "id", "id": self._settings.voice}
|
voice_config = {"mode": "id", "id": self._settings.voice}
|
||||||
|
|
||||||
output_format = {
|
output_format = {
|
||||||
|
|||||||
Reference in New Issue
Block a user