From 5b4061b0d5df20fd4a041c7e6e5147f7587e6f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Fri, 16 Aug 2024 23:46:57 -0700 Subject: [PATCH] processors(rtvi): fix send_error() --- src/pipecat/processors/frameworks/rtvi.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pipecat/processors/frameworks/rtvi.py b/src/pipecat/processors/frameworks/rtvi.py index 15798f1e0..797ef288f 100644 --- a/src/pipecat/processors/frameworks/rtvi.py +++ b/src/pipecat/processors/frameworks/rtvi.py @@ -301,8 +301,8 @@ class RTVIProcessor(FrameProcessor): async def interrupt_bot(self): await self.push_frame(BotInterruptionFrame(), FrameDirection.UPSTREAM) - async def send_error(self, frame: ErrorFrame): - message = RTVIError(data=RTVIErrorData(message=frame.error, fatal=frame.fatal)) + async def send_error(self, error: str): + message = RTVIError(data=RTVIErrorData(error=error, fatal=False)) await self._push_transport_message(message) async def handle_function_call( @@ -338,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) + await self._send_error_frame(frame) await self.push_frame(frame, direction) # All other system frames elif isinstance(frame, SystemFrame): @@ -586,6 +586,10 @@ class RTVIProcessor(FrameProcessor): config=self._config.config)) await self._push_transport_message(message) + async def _send_error_frame(self, frame: ErrorFrame): + message = RTVIError(data=RTVIErrorData(error=frame.error, fatal=frame.fatal)) + await self._push_transport_message(message) + async def _send_error_response(self, id: str, error: str): message = RTVIErrorResponse(id=id, data=RTVIErrorResponseData(error=error)) await self._push_transport_message(message)