From 32daf65adcb6393ff8ef757cca0a665204550ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Fri, 16 Aug 2024 23:17:55 -0700 Subject: [PATCH] processors(rtvi): send to the client if errors are fatal --- src/pipecat/processors/frameworks/rtvi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pipecat/processors/frameworks/rtvi.py b/src/pipecat/processors/frameworks/rtvi.py index f26e57ab4..c9a5f357c 100644 --- a/src/pipecat/processors/frameworks/rtvi.py +++ b/src/pipecat/processors/frameworks/rtvi.py @@ -135,6 +135,7 @@ class RTVIErrorResponse(BaseModel): class RTVIErrorData(BaseModel): message: str + fatal: bool class RTVIError(BaseModel): @@ -300,8 +301,8 @@ class RTVIProcessor(FrameProcessor): async def interrupt_bot(self): await self.push_frame(BotInterruptionFrame(), FrameDirection.UPSTREAM) - async def send_error(self, error: str): - message = RTVIError(data=RTVIErrorData(message=error)) + async def send_error(self, frame: ErrorFrame): + message = RTVIError(data=RTVIErrorData(message=frame.error, fatal=frame.fatal)) await self._push_transport_message(message) async def handle_function_call( @@ -337,7 +338,7 @@ class RTVIProcessor(FrameProcessor): await self._cancel(frame) await self.push_frame(frame, direction) elif isinstance(frame, ErrorFrame): - await self.send_error(frame.error) + await self.send_error(frame) await self.push_frame(frame, direction) # All other system frames elif isinstance(frame, SystemFrame):