Skip to content

Commit

Permalink
processors(rtvi): fix send_error()
Browse files Browse the repository at this point in the history
  • Loading branch information
aconchillo committed Aug 17, 2024
1 parent 6ce0227 commit 5b4061b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pipecat/processors/frameworks/rtvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ def register_service(self, service: RTVIService):
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(
Expand Down Expand Up @@ -338,7 +338,7 @@ async def process_frame(self, frame: Frame, direction: FrameDirection):
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):
Expand Down Expand Up @@ -586,6 +586,10 @@ async def _send_bot_ready(self):
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)
Expand Down

0 comments on commit 5b4061b

Please sign in to comment.