Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

ux: Reorder voice cut actions to lower latency

Clémence Lesnée4a96c3e26e6
diff --git a/app/helpers/call_llm.py b/app/helpers/call_llm.py
index 035b922..677cdfc 100644
--- a/app/helpers/call_llm.py
+++ b/app/helpers/call_llm.py
@@ -161,14 +161,10 @@ async def load_llm_chat( # noqa: PLR0913, PLR0915
if last_chat:
last_chat.cancel()
- # Stop TTS, clear the buffer and send a stop signal
+ # Stop TTS task
tts_client.stop_speaking_async()
- # Reset the recognition
- stt_buffer.clear()
- stt_complete_gate.clear()
-
- # Clear the audio buffer
+ # Clear the out buffer
while not audio_out.empty():
audio_out.get_nowait()
audio_out.task_done()
@@ -176,6 +172,10 @@ async def load_llm_chat( # noqa: PLR0913, PLR0915
# Send a stop signal
await audio_out.put(False)
+ # Reset TTS buffer
+ stt_buffer.clear()
+ stt_complete_gate.clear()
+
async def _commit_answer(
wait: bool,
tool_blacklist: set[str] | None = None,