examples: make sure unhandled frames are always pushed
This commit is contained in:
@@ -117,12 +117,15 @@ class CompletenessCheck(FrameProcessor):
|
||||
|
||||
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||
await super().process_frame(frame, direction)
|
||||
|
||||
if isinstance(frame, TextFrame) and frame.text == "YES":
|
||||
logger.debug("Completeness check YES")
|
||||
await self.push_frame(UserStoppedSpeakingFrame())
|
||||
await self._notifier.notify()
|
||||
elif isinstance(frame, TextFrame) and frame.text == "NO":
|
||||
logger.debug("Completeness check NO")
|
||||
else:
|
||||
await self.push_frame(frame, direction)
|
||||
|
||||
|
||||
class OutputGate(FrameProcessor):
|
||||
|
||||
@@ -328,6 +328,8 @@ class CompletenessCheck(FrameProcessor):
|
||||
await self._notifier.notify()
|
||||
elif isinstance(frame, TextFrame) and frame.text == "NO":
|
||||
logger.debug("!!! Completeness check NO")
|
||||
else:
|
||||
await self.push_frame(frame, direction)
|
||||
|
||||
|
||||
class OutputGate(FrameProcessor):
|
||||
|
||||
@@ -456,6 +456,8 @@ class CompletenessCheck(FrameProcessor):
|
||||
# logger.debug("!!! CompletenessCheck idle wait START")
|
||||
self._wakeup_time = time.time() + self.wait_time
|
||||
self._idle_task = self.create_task(self._idle_task_handler())
|
||||
else:
|
||||
await self.push_frame(frame, direction)
|
||||
|
||||
async def _idle_task_handler(self):
|
||||
try:
|
||||
|
||||
@@ -212,7 +212,7 @@ class InputTranscriptionFrameEmitter(FrameProcessor):
|
||||
elif isinstance(frame, LLMFullResponseEndFrame):
|
||||
await self.push_frame(LLMDemoTranscriptionFrame(text=self._aggregation.strip()))
|
||||
self._aggregation = ""
|
||||
elif isinstance(frame, MetricsFrame):
|
||||
else:
|
||||
await self.push_frame(frame, direction)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user