diff --git a/src/pipecat/services/piper/tts.py b/src/pipecat/services/piper/tts.py index fb7b627cd..53990ff2e 100644 --- a/src/pipecat/services/piper/tts.py +++ b/src/pipecat/services/piper/tts.py @@ -17,6 +17,7 @@ from loguru import logger from pipecat.frames.frames import ( ErrorFrame, Frame, + TTSStoppedFrame, ) from pipecat.services.settings import TTSSettings, _warn_deprecated_param from pipecat.services.tts_service import TTSService @@ -287,6 +288,7 @@ class PiperHttpTTSService(TTSService): yield ErrorFrame( error=f"Error getting audio (status: {response.status}, error: {error})" ) + yield TTSStoppedFrame(context_id=context_id) return await self.start_tts_usage_metrics(text) diff --git a/tests/test_piper_tts.py b/tests/test_piper_tts.py index 2b1dae577..3b822f07c 100644 --- a/tests/test_piper_tts.py +++ b/tests/test_piper_tts.py @@ -136,7 +136,7 @@ async def test_run_piper_tts_error(aiohttp_client): TTSSpeakFrame(text="Error case.", append_to_context=False), ] - expected_down_frames = [AggregatedTextFrame, TTSStartedFrame, TTSTextFrame, TTSStoppedFrame] + expected_down_frames = [AggregatedTextFrame, TTSStartedFrame, TTSStoppedFrame, TTSTextFrame] expected_up_frames = [ErrorFrame]