From 2f35c134aa6c62060c7debea688a646ee1c5e26a Mon Sep 17 00:00:00 2001 From: "j.foucher" Date: Mon, 20 Jul 2026 15:58:32 +0200 Subject: [PATCH] ConvAgent: cut BOTH agents' speech when the player interrupts the dialogue On a player barge-in, the engaged agent stops (its mic feeds the player's voice to ElevenLabs, which interrupts it), but the witness agent never hears the player and kept finishing its line (e.g. '...I'll give you the cash...') mid-scene. InterruptForPlayer now calls InterruptAgent() on both CompA and CompB. Conversations stay open; the witness still receives the contextual_updates. Co-Authored-By: Claude Opus 4.8 --- .../Private/PS_AI_ConvAgent_AgentDialogue.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_AgentDialogue.cpp b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_AgentDialogue.cpp index 7d3102e..ceea2cb 100644 --- a/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_AgentDialogue.cpp +++ b/Unreal/PS_AI_Agent/Plugins/PS_AI_ConvAgent/Source/PS_AI_ConvAgent/Private/PS_AI_ConvAgent_AgentDialogue.cpp @@ -255,6 +255,14 @@ void APS_AI_ConvAgent_AgentDialogue::InterruptForPlayer(EFloor Engaged) { W->GetTimerManager().ClearTimer(TurnTimer); } + + // The player barged in — cut BOTH agents' current speech now. The engaged agent + // is already interrupted by the player's mic (ElevenLabs), but the WITNESS agent + // never hears the player, so without this it keeps finishing its dealer<->client + // line ("...I'll give you the cash...") while the player is talking. Interrupting + // leaves the conversations open; the witness still receives the contextual_updates. + if (CompA) { CompA->InterruptAgent(); } + if (CompB) { CompB->InterruptAgent(); } // Keep the agent bindings: in floor mode the text/transcript handlers RELAY to the // witness instead of forwarding (their dialogue logic no-ops while !bRunning).