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 = '' } }