From aab26e9a386d5465bf4d833d29e66e34776d5be2 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Sun, 16 Feb 2025 15:38:06 -0800 Subject: [PATCH] Fix empty message bubble after switching plan/act with a message --- src/core/Cline.ts | 9 +++++++-- src/core/webview/ClineProvider.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 3632f25c1b..4bfcf59520 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -2712,9 +2712,14 @@ export class Cline { // } this.isAwaitingPlanResponse = true - const { text, images } = await this.ask("plan_mode_response", response, false) + let { text, images } = await this.ask("plan_mode_response", response, false) this.isAwaitingPlanResponse = false + // webview invoke sendMessage will send this marker in order to put webview into the proper state (responding to an ask) and as a flag to extension that the user switched to ACT mode. + if (text === "PLAN_MODE_TOGGLE_RESPONSE") { + text = "" + } + if (this.didRespondToPlanAskBySwitchingMode) { pushToolResult( formatResponse.toolResult( @@ -2730,7 +2735,7 @@ export class Cline { pushToolResult(formatResponse.toolResult(`\n${text}\n`, images)) } - if (text || images) { + if (text || images?.length) { await this.say("user_feedback", text ?? "", images) } diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index 09a735ae1c..8ef786f4dc 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -627,7 +627,7 @@ export class ClineProvider implements vscode.WebviewViewProvider { await this.postMessageToWebview({ type: "invoke", invoke: "sendMessage", - text: message.chatContent?.message || "[Proceeding with the task...]", + text: message.chatContent?.message || "PLAN_MODE_TOGGLE_RESPONSE", images: message.chatContent?.images, }) } else {