Reset idle prompt on image input
This commit is contained in:
@@ -6,6 +6,7 @@ from pipecat.frames.frames import (
|
|||||||
Frame,
|
Frame,
|
||||||
InputTransportMessageFrame,
|
InputTransportMessageFrame,
|
||||||
LLMMessagesAppendFrame,
|
LLMMessagesAppendFrame,
|
||||||
|
UserImageRawFrame,
|
||||||
UserStartedSpeakingFrame,
|
UserStartedSpeakingFrame,
|
||||||
UserStoppedSpeakingFrame,
|
UserStoppedSpeakingFrame,
|
||||||
)
|
)
|
||||||
@@ -13,11 +14,17 @@ from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
|
|||||||
|
|
||||||
|
|
||||||
class ProductTextInputProcessor(FrameProcessor):
|
class ProductTextInputProcessor(FrameProcessor):
|
||||||
"""Converts product text-input transport messages into LLM turns."""
|
"""Converts product text-input transport messages and marks image input as user activity."""
|
||||||
|
|
||||||
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||||
await super().process_frame(frame, direction)
|
await super().process_frame(frame, direction)
|
||||||
|
|
||||||
|
if isinstance(frame, UserImageRawFrame):
|
||||||
|
await self.broadcast_frame(UserStartedSpeakingFrame)
|
||||||
|
await self.push_frame(frame, direction)
|
||||||
|
await self.broadcast_frame(UserStoppedSpeakingFrame)
|
||||||
|
return
|
||||||
|
|
||||||
if not isinstance(frame, InputTransportMessageFrame):
|
if not isinstance(frame, InputTransportMessageFrame):
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user