From cea4d1894e485457ef85b77d64c136f973fafd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Mon, 22 Jul 2024 08:47:59 -0700 Subject: [PATCH] processors(rtvi): change voice before LLM updates --- src/pipecat/processors/frameworks/rtvi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pipecat/processors/frameworks/rtvi.py b/src/pipecat/processors/frameworks/rtvi.py index 23acb71bd..ca7995cb5 100644 --- a/src/pipecat/processors/frameworks/rtvi.py +++ b/src/pipecat/processors/frameworks/rtvi.py @@ -429,15 +429,16 @@ class RTVIProcessor(FrameProcessor): await self.push_frame(frame) async def _handle_config_update(self, config: RTVIConfig): + # Change voice before LLM updates, so we can hear the new vocie. + if config.tts and config.tts.voice: + frame = TTSVoiceUpdateFrame(config.tts.voice) + await self.push_frame(frame) if config.llm and config.llm.model: frame = LLMModelUpdateFrame(config.llm.model) await self.push_frame(frame) if config.llm and config.llm.messages: frame = LLMMessagesUpdateFrame(config.llm.messages) await self.push_frame(frame) - if config.tts and config.tts.voice: - frame = TTSVoiceUpdateFrame(config.tts.voice) - await self.push_frame(frame) async def _handle_llm_get_context(self): data = RTVILLMContextMessageData(messages=self._tma_in.messages)