From e6549995418895ee93a095e0ec8eef89afecddc5 Mon Sep 17 00:00:00 2001 From: Jax Date: Tue, 24 Sep 2024 18:05:26 +0800 Subject: [PATCH 1/3] Fix the problem of infinite loop when agent speech is interrupted --- .../livekit/agents/voice_assistant/voice_assistant.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/livekit-agents/livekit/agents/voice_assistant/voice_assistant.py b/livekit-agents/livekit/agents/voice_assistant/voice_assistant.py index a92565405..c0dd229b2 100644 --- a/livekit-agents/livekit/agents/voice_assistant/voice_assistant.py +++ b/livekit-agents/livekit/agents/voice_assistant/voice_assistant.py @@ -640,6 +640,10 @@ def _commit_user_question_if_needed() -> None: ) _commit_user_question_if_needed() + + if speech_handle.interrupted: + logger.warning(f"speech interrupted, quit loop") + break _commit_user_question_if_needed() From 1f75d862a12b32b2c30381e6d229a09de4c300d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Tue, 24 Sep 2024 11:11:15 -0700 Subject: [PATCH 2/3] Create moody-doors-poke.md --- .changeset/moody-doors-poke.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/moody-doors-poke.md diff --git a/.changeset/moody-doors-poke.md b/.changeset/moody-doors-poke.md new file mode 100644 index 000000000..ca70304ed --- /dev/null +++ b/.changeset/moody-doors-poke.md @@ -0,0 +1,5 @@ +--- +"livekit-agents": patch +--- + +fix VoiceAssisstant being stuck when interrupting before user speech is committed From c612febf66b3f5ef646e4d20ff5df84efbe6529c Mon Sep 17 00:00:00 2001 From: Jax Date: Wed, 25 Sep 2024 14:17:03 +0800 Subject: [PATCH 3/3] Update livekit-agents/livekit/agents/voice_assistant/voice_assistant.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Théo Monnom --- livekit-agents/livekit/agents/voice_assistant/voice_assistant.py | 1 - 1 file changed, 1 deletion(-) diff --git a/livekit-agents/livekit/agents/voice_assistant/voice_assistant.py b/livekit-agents/livekit/agents/voice_assistant/voice_assistant.py index c0dd229b2..a1c7e465e 100644 --- a/livekit-agents/livekit/agents/voice_assistant/voice_assistant.py +++ b/livekit-agents/livekit/agents/voice_assistant/voice_assistant.py @@ -642,7 +642,6 @@ def _commit_user_question_if_needed() -> None: _commit_user_question_if_needed() if speech_handle.interrupted: - logger.warning(f"speech interrupted, quit loop") break _commit_user_question_if_needed()