diff --git a/src/dailyai/services/daily_transport_service.py b/src/dailyai/services/daily_transport_service.py index 1f1fe483b..89cb66046 100644 --- a/src/dailyai/services/daily_transport_service.py +++ b/src/dailyai/services/daily_transport_service.py @@ -259,10 +259,8 @@ class DailyTransportService(EventHandler): pass def on_transcription_message(self, message): - print("got transcription", message) if self.loop: - asyncio.run_coroutine_threadsafe(self.transcription_queue.put(message["text"]), self.loop) - print("put transcription in queue", message) + asyncio.run_coroutine_threadsafe(self.transcription_queue.put(message), self.loop) def on_transcription_stopped(self, stopped_by, stopped_by_error): pass diff --git a/src/samples/theoretical-to-real/06-listen-and-respond.py b/src/samples/theoretical-to-real/06-listen-and-respond.py index 034e608f0..6cdac1491 100644 --- a/src/samples/theoretical-to-real/06-listen-and-respond.py +++ b/src/samples/theoretical-to-real/06-listen-and-respond.py @@ -33,7 +33,11 @@ async def main(room_url:str, token): sentence = "" async for message in transport.get_transcriptions(): - sentence += message + if message["session_id"] == transport.my_participant_id: + continue + + # todo: we could differentiate between transcriptions from different participants + sentence += message["text"] if sentence.endswith((".", "?", "!")): messages.append({"role": "user", "content": sentence}) sentence = ''