Fix idle and text input race bug

This commit is contained in:
Xin Wang
2026-05-29 16:05:23 +08:00
parent 15c98f21fe
commit 050ecc7a2d

View File

@@ -2,7 +2,13 @@ from __future__ import annotations
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
@@ -25,6 +31,8 @@ class ProductTextInputProcessor(FrameProcessor):
if not text:
return
await self.broadcast_frame(UserStartedSpeakingFrame)
if message.get("interrupt", True):
logger.info("Text input interrupting current response")
await self.broadcast_interruption()
@@ -36,4 +44,4 @@ class ProductTextInputProcessor(FrameProcessor):
),
FrameDirection.DOWNSTREAM,
)
await self.broadcast_frame(UserStoppedSpeakingFrame)