|
|
@ -93,21 +93,19 @@ def queue_listener():
|
|
|
|
to_user.put(chunk)
|
|
|
|
to_user.put(chunk)
|
|
|
|
|
|
|
|
|
|
|
|
# Speak full sentences out loud
|
|
|
|
# Speak full sentences out loud
|
|
|
|
accumulated_text += chunk["content"]
|
|
|
|
if chunk["type"] == "assistant":
|
|
|
|
sentences = split_into_sentences(accumulated_text)
|
|
|
|
accumulated_text += chunk["content"]
|
|
|
|
if is_full_sentence(sentences[-1]):
|
|
|
|
sentences = split_into_sentences(accumulated_text)
|
|
|
|
for sentence in sentences:
|
|
|
|
if is_full_sentence(sentences[-1]):
|
|
|
|
for audio_chunk in tts(sentence):
|
|
|
|
for sentence in sentences:
|
|
|
|
to_user.put(audio_chunk)
|
|
|
|
for audio_chunk in tts(sentence):
|
|
|
|
accumulated_text = ""
|
|
|
|
to_user.put(audio_chunk)
|
|
|
|
else:
|
|
|
|
accumulated_text = ""
|
|
|
|
for sentence in sentences[:-1]:
|
|
|
|
else:
|
|
|
|
for audio_chunk in tts(sentence):
|
|
|
|
for sentence in sentences[:-1]:
|
|
|
|
to_user.put(audio_chunk)
|
|
|
|
for audio_chunk in tts(sentence):
|
|
|
|
accumulated_text = sentences[-1]
|
|
|
|
to_user.put(audio_chunk)
|
|
|
|
|
|
|
|
accumulated_text = sentences[-1]
|
|
|
|
if chunk["type"] == "message" and "content" in sentence:
|
|
|
|
|
|
|
|
sentence += chunk.get("content")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If we have a new message, save our progress and go back to the top
|
|
|
|
# If we have a new message, save our progress and go back to the top
|
|
|
|
if not to_assistant.empty():
|
|
|
|
if not to_assistant.empty():
|
|
|
|