Pass entire transcription message on queue; don't respond to yourself in 06-
This commit is contained in:
@@ -259,10 +259,8 @@ class DailyTransportService(EventHandler):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def on_transcription_message(self, message):
|
def on_transcription_message(self, message):
|
||||||
print("got transcription", message)
|
|
||||||
if self.loop:
|
if self.loop:
|
||||||
asyncio.run_coroutine_threadsafe(self.transcription_queue.put(message["text"]), self.loop)
|
asyncio.run_coroutine_threadsafe(self.transcription_queue.put(message), self.loop)
|
||||||
print("put transcription in queue", message)
|
|
||||||
|
|
||||||
def on_transcription_stopped(self, stopped_by, stopped_by_error):
|
def on_transcription_stopped(self, stopped_by, stopped_by_error):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ async def main(room_url:str, token):
|
|||||||
|
|
||||||
sentence = ""
|
sentence = ""
|
||||||
async for message in transport.get_transcriptions():
|
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((".", "?", "!")):
|
if sentence.endswith((".", "?", "!")):
|
||||||
messages.append({"role": "user", "content": sentence})
|
messages.append({"role": "user", "content": sentence})
|
||||||
sentence = ''
|
sentence = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user