[WIP] AWS Nova Sonic service - added stubs for handling interruption and user-started-speaking frames

This commit is contained in:
Paul Kompfner
2025-04-27 06:50:28 -04:00
parent 0c255d2618
commit 1f9baefba8

View File

@@ -30,11 +30,15 @@ from pipecat.frames.frames import (
LLMFullResponseStartFrame, LLMFullResponseStartFrame,
LLMTextFrame, LLMTextFrame,
StartFrame, StartFrame,
StartInterruptionFrame,
StopInterruptionFrame,
TranscriptionFrame, TranscriptionFrame,
TTSAudioRawFrame, TTSAudioRawFrame,
TTSStartedFrame, TTSStartedFrame,
TTSStoppedFrame, TTSStoppedFrame,
TTSTextFrame, TTSTextFrame,
UserStartedSpeakingFrame,
UserStoppedSpeakingFrame,
) )
from pipecat.processors.frame_processor import FrameDirection from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import LLMService from pipecat.services.llm_service import LLMService
@@ -131,6 +135,15 @@ class AWSNovaSonicService(LLMService):
if isinstance(frame, InputAudioRawFrame): if isinstance(frame, InputAudioRawFrame):
# TODO: check if _audio_input_paused? what causes that? # TODO: check if _audio_input_paused? what causes that?
await self._send_user_audio_event(frame) await self._send_user_audio_event(frame)
# TODO: do we need to do anything for these?
elif isinstance(frame, StartInterruptionFrame):
print("[pk] StartInterruptionFrame")
elif isinstance(frame, UserStartedSpeakingFrame):
print("[pk] UserStartedSpeakingFrame")
elif isinstance(frame, StopInterruptionFrame):
print("[pk] StopInterruptionFrame")
elif isinstance(frame, UserStoppedSpeakingFrame):
print("[pk] UserStoppedSpeakingFrame")
await self.push_frame(frame, direction) await self.push_frame(frame, direction)