From 05920b5233199f7a19c8a433f0ea82da1ae92a77 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Wed, 2 Oct 2024 06:47:24 -0400 Subject: [PATCH] Interrupt stream if user provides feedback --- src/core/ClaudeDev.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/ClaudeDev.ts b/src/core/ClaudeDev.ts index 0938c30..5505616 100644 --- a/src/core/ClaudeDev.ts +++ b/src/core/ClaudeDev.ts @@ -1754,6 +1754,13 @@ export class ClaudeDev { await abortStream("user_cancelled") break // aborts the stream } + + if (this.didRejectTool) { + // userContent has a tool rejection, so interrupt the assistant's response to present the user's feedback + assistantMessage += "\n\n[Response interrupted by user feedback]" + this.userMessageContentReady = true + break + } } } catch (error) { this.abortTask() // if the stream failed, there's various states the task could be in (i.e. could have streamed some tools the user may have executed), so we just resort to replicating a cancel task