processors(rtvi): send to the client if errors are fatal
This commit is contained in:
@@ -135,6 +135,7 @@ class RTVIErrorResponse(BaseModel):
|
|||||||
|
|
||||||
class RTVIErrorData(BaseModel):
|
class RTVIErrorData(BaseModel):
|
||||||
message: str
|
message: str
|
||||||
|
fatal: bool
|
||||||
|
|
||||||
|
|
||||||
class RTVIError(BaseModel):
|
class RTVIError(BaseModel):
|
||||||
@@ -300,8 +301,8 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
async def interrupt_bot(self):
|
async def interrupt_bot(self):
|
||||||
await self.push_frame(BotInterruptionFrame(), FrameDirection.UPSTREAM)
|
await self.push_frame(BotInterruptionFrame(), FrameDirection.UPSTREAM)
|
||||||
|
|
||||||
async def send_error(self, error: str):
|
async def send_error(self, frame: ErrorFrame):
|
||||||
message = RTVIError(data=RTVIErrorData(message=error))
|
message = RTVIError(data=RTVIErrorData(message=frame.error, fatal=frame.fatal))
|
||||||
await self._push_transport_message(message)
|
await self._push_transport_message(message)
|
||||||
|
|
||||||
async def handle_function_call(
|
async def handle_function_call(
|
||||||
@@ -337,7 +338,7 @@ class RTVIProcessor(FrameProcessor):
|
|||||||
await self._cancel(frame)
|
await self._cancel(frame)
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
elif isinstance(frame, ErrorFrame):
|
elif isinstance(frame, ErrorFrame):
|
||||||
await self.send_error(frame.error)
|
await self.send_error(frame)
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
# All other system frames
|
# All other system frames
|
||||||
elif isinstance(frame, SystemFrame):
|
elif isinstance(frame, SystemFrame):
|
||||||
|
|||||||
Reference in New Issue
Block a user