processors: add FrameProcessor.push_error

This commit is contained in:
Aleix Conchillo Flaqué
2024-05-13 16:12:35 -07:00
parent 01381f6dcd
commit d28d0fa218

View File

@@ -8,7 +8,7 @@ import asyncio
from asyncio import AbstractEventLoop
from enum import Enum
from pipecat.frames.frames import Frame
from pipecat.frames.frames import ErrorFrame, Frame
from pipecat.utils.utils import obj_count, obj_id
from loguru import logger
@@ -42,6 +42,9 @@ class FrameProcessor:
async def process_frame(self, frame: Frame, direction: FrameDirection):
pass
async def push_error(self, error: ErrorFrame):
await self.push_frame(error, FrameDirection.UPSTREAM)
async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM):
if direction == FrameDirection.DOWNSTREAM and self._next:
logger.trace(f"Pushing {frame} from {self} to {self._next}")