From b905b57dfc34d1bfd3c2f1696daa8015c240359e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 24 Oct 2024 17:42:16 -0700 Subject: [PATCH 1/2] transports(daily): allow updating subscriptions before join --- src/pipecat/transports/services/daily.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pipecat/transports/services/daily.py b/src/pipecat/transports/services/daily.py index 5717e9ab1..ba0da8754 100644 --- a/src/pipecat/transports/services/daily.py +++ b/src/pipecat/transports/services/daily.py @@ -500,9 +500,6 @@ class DailyTransportClient(EventHandler): self._client.update_transcription(participants, instance_id) async def update_subscriptions(self, participant_settings=None, profile_settings=None): - if not self._joined or self._leaving: - return - future = self._loop.create_future() self._client.update_subscriptions( participant_settings=participant_settings, From a6dd2600d20ca234818b0ca6c5c378aa289f13fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Fri, 25 Oct 2024 14:46:45 -0700 Subject: [PATCH 2/2] examples(tavus): await update_subscriptions --- examples/foundational/21-tavus-layer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/foundational/21-tavus-layer.py b/examples/foundational/21-tavus-layer.py index 06cfe8dd8..61705b28a 100644 --- a/examples/foundational/21-tavus-layer.py +++ b/examples/foundational/21-tavus-layer.py @@ -6,10 +6,11 @@ import asyncio import aiohttp -from typing import Any import os import sys +from typing import Any, Mapping + from pipecat.frames.frames import LLMMessagesFrame from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner @@ -103,12 +104,12 @@ async def main(): @transport.event_handler("on_participant_joined") async def on_participant_joined( - transport: DailyTransport, participant: dict[str, Any] + transport: DailyTransport, participant: Mapping[str, Any] ) -> None: # Ignore the Tavus replica's microphone if participant.get("info", {}).get("userName", "") == persona_name: logger.debug(f"Ignoring {participant['id']}'s microphone") - transport.update_subscriptions( + await transport.update_subscriptions( participant_settings={ participant["id"]: { "media": {"microphone": "unsubscribed"},