Emit a transcription callback when receiving a CancelFrame, update examples accordingly

This commit is contained in:
Mark Backman
2025-01-22 14:55:15 -05:00
parent e1430be9f9
commit 7167719761
4 changed files with 12 additions and 19 deletions

View File

@@ -16,8 +16,7 @@ from runner import configure
from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.frames.frames import (
EndFrame,
StartInterruptionFrame,
CancelFrame,
TranscriptionMessage,
TranscriptionUpdateFrame,
)
@@ -170,10 +169,8 @@ async def main():
@transport.event_handler("on_participant_left")
async def on_participant_left(transport, participant, reason):
# Interrupt the TTS to stop the TTS generation
await task.queue_frame(StartInterruptionFrame())
# Stop the gracefully stop the pipeline
await task.queue_frame(EndFrame())
# Stop the pipeline immediately when the participant leaves
await task.queue_frame(CancelFrame())
runner = PipelineRunner()