processors(rtvi): handle ErrorFrames

This commit is contained in:
Aleix Conchillo Flaqué
2024-08-15 15:23:31 -07:00
parent 5d71c50080
commit 31577252f3

View File

@@ -15,6 +15,7 @@ from pipecat.frames.frames import (
BotStoppedSpeakingFrame, BotStoppedSpeakingFrame,
CancelFrame, CancelFrame,
EndFrame, EndFrame,
ErrorFrame,
Frame, Frame,
InterimTranscriptionFrame, InterimTranscriptionFrame,
StartFrame, StartFrame,
@@ -333,6 +334,9 @@ class RTVIProcessor(FrameProcessor):
if isinstance(frame, CancelFrame): if isinstance(frame, CancelFrame):
await self._cancel(frame) await self._cancel(frame)
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
elif isinstance(frame, ErrorFrame):
await self.send_error(frame.error)
await self.push_frame(frame, direction)
# All other system frames # All other system frames
elif isinstance(frame, SystemFrame): elif isinstance(frame, SystemFrame):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)