Fix idle and text input race bug
This commit is contained in:
@@ -2,7 +2,13 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from pipecat.frames.frames import Frame, InputTransportMessageFrame, LLMMessagesAppendFrame
|
from pipecat.frames.frames import (
|
||||||
|
Frame,
|
||||||
|
InputTransportMessageFrame,
|
||||||
|
LLMMessagesAppendFrame,
|
||||||
|
UserStartedSpeakingFrame,
|
||||||
|
UserStoppedSpeakingFrame,
|
||||||
|
)
|
||||||
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
||||||
|
|
||||||
|
|
||||||
@@ -25,6 +31,8 @@ class ProductTextInputProcessor(FrameProcessor):
|
|||||||
if not text:
|
if not text:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
await self.broadcast_frame(UserStartedSpeakingFrame)
|
||||||
|
|
||||||
if message.get("interrupt", True):
|
if message.get("interrupt", True):
|
||||||
logger.info("Text input interrupting current response")
|
logger.info("Text input interrupting current response")
|
||||||
await self.broadcast_interruption()
|
await self.broadcast_interruption()
|
||||||
@@ -36,4 +44,4 @@ class ProductTextInputProcessor(FrameProcessor):
|
|||||||
),
|
),
|
||||||
FrameDirection.DOWNSTREAM,
|
FrameDirection.DOWNSTREAM,
|
||||||
)
|
)
|
||||||
|
await self.broadcast_frame(UserStoppedSpeakingFrame)
|
||||||
|
|||||||
Reference in New Issue
Block a user