Skip to content

Commit

Permalink
Adding fixing save chat session overwriting
Browse files Browse the repository at this point in the history
  • Loading branch information
arafatkatze committed Dec 24, 2024
1 parent 4742f6c commit fcc1c2d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions vscode/src/chat/chat-view/ChatsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,10 @@ export class ChatsController implements vscode.Disposable {
return
}

// For single chat deletion
await chatHistory.deleteChat(authStatus, chatID)
this.disposeChat(chatID, true)
// Don't save the session when disposing after delete
this.disposeChat(chatID, true, { skipSave: true })
}

/**
Expand Down Expand Up @@ -535,7 +537,11 @@ export class ChatsController implements vscode.Disposable {
})
}

private disposeChat(chatID: string, includePanel: boolean): void {
private disposeChat(
chatID: string,
includePanel: boolean,
options: { skipSave?: boolean } = {}
): void {
if (chatID === this.activeEditor?.sessionID) {
this.activeEditor = undefined
}
Expand All @@ -549,7 +555,7 @@ export class ChatsController implements vscode.Disposable {
removedProvider.dispose()
}

if (includePanel && chatID === this.panel?.sessionID) {
if (includePanel && chatID === this.panel?.sessionID && !options.skipSave) {
this.panel.clearAndRestartSession()
}
}
Expand Down

0 comments on commit fcc1c2d

Please sign in to comment.