Merge pull request #661 from pipecat-ai/aleix/allow-updating-subscritption-before

transports(daily): allow updating subscriptions before join
This commit is contained in:
Aleix Conchillo Flaqué
2024-10-25 15:00:34 -07:00
committed by GitHub
2 changed files with 4 additions and 6 deletions

View File

@@ -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"},

View File

@@ -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,