From 69ba0c833e266d5962483e8125bf1f5c67da449b Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:36:45 -0500 Subject: [PATCH] Interrupt API request if user executes tool --- src/core/Cline.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 0bb5c5cec0..a587dd90a8 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1910,13 +1910,13 @@ export class Cline { break } - // we need to let the request finish for openrouter to get generation details - // if (this.didAlreadyUseTool) { - // // a tool has been called, so interrupt the assistant's response to present the user's feedback - // assistantMessage += - // "\n\n[Response interrupted by a tool use. Only one tool may be used per message.]" - // break - // } + // PREV: we need to let the request finish for openrouter to get generation details + // UPDATE: it's better UX to interrupt the request at the cost of the api cost not being retrieved + if (this.didAlreadyUseTool) { + assistantMessage += + "\n\n[Response interrupted by a tool use result. Only one tool may be used at a time and should be placed at the end of the message.]" + break + } } } catch (error) { // abandoned happens when extension is no longer waiting for the cline instance to finish aborting (error is thrown here when any function in the for loop throws due to this.abort)