Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions packages/core/src/codewhispererChat/controllers/chat/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1286,20 +1286,24 @@ 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)
// If there's an existing conversation, ensure we dispose the previous token
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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,9 @@ export class Messenger {
]
header = {
buttons,
body: message,
}
message = ''
}
}

Expand Down