From 1d3c6b02a52ccaac750472aba311bc100d796fcf Mon Sep 17 00:00:00 2001 From: laileni Date: Tue, 15 Apr 2025 12:40:20 -0700 Subject: [PATCH] Fixing bug in read files and in accepting permissions --- .../controllers/chat/controller.ts | 18 +++++++++++------- .../controllers/chat/messenger/messenger.ts | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/core/src/codewhispererChat/controllers/chat/controller.ts b/packages/core/src/codewhispererChat/controllers/chat/controller.ts index 3df6b981fc2..bd9c6a642a3 100644 --- a/packages/core/src/codewhispererChat/controllers/chat/controller.ts +++ b/packages/core/src/codewhispererChat/controllers/chat/controller.ts @@ -1286,6 +1286,16 @@ export class ChatController { this.processException(e, message.tabID) } } + private sessionCleanUp(session: ChatSession) { + // Create a fresh token for this new conversation + session.createNewTokenSource() + session.setAgenticLoopInProgress(true) + session.clearListOfReadFiles() + session.clearListOfReadFolders() + session.setShowDiffOnFileWrite(false) + session.setMessageIdToUpdate(undefined) + session.setMessageIdToUpdateListDirectory(undefined) + } private async processPromptMessageAsNewThread(message: PromptMessage) { const session = this.sessionStorage.getSession(message.tabID) @@ -1293,13 +1303,7 @@ export class ChatController { if (session.agenticLoopInProgress) { session.disposeTokenSource() } - - // Create a fresh token for this new conversation - session.createNewTokenSource() - session.setAgenticLoopInProgress(true) - session.clearListOfReadFiles() - session.clearListOfReadFolders() - session.setShowDiffOnFileWrite(false) + this.sessionCleanUp(session) this.editorContextExtractor .extractContextForTrigger('ChatMessage') .then(async (context) => { diff --git a/packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts b/packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts index 2296377922e..6505e8ec451 100644 --- a/packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts +++ b/packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts @@ -844,7 +844,9 @@ export class Messenger { ] header = { buttons, + body: message, } + message = '' } }