Enable chat "move" commands on empty sessions (#183895)

* Enable chat "move" commands on empty sessions
and also imported sessions

* Fix command name
This commit is contained in:
Rob Lourens 2023-05-30 23:54:05 -07:00 committed by GitHub
parent f6758dfc33
commit 7b87b701eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -73,7 +73,7 @@ export function registerChatExportActions() {
id: 'workbench.action.chat.import',
title: {
value: localize('chat.import.label', "Import Session") + '...',
original: 'Export Session...'
original: 'Import Session...'
},
category: CHAT_CATEGORY,
precondition: CONTEXT_PROVIDER_EXISTS,

View file

@ -218,11 +218,13 @@ export class ChatService extends Disposable implements IChatService {
}
getHistory(): IChatDetail[] {
const sessions = Object.values(this._persistedSessions);
const sessions = Object.values(this._persistedSessions)
.filter(session => session.requests.length > 0);
sessions.sort((a, b) => (b.creationDate ?? 0) - (a.creationDate ?? 0));
return sessions
.filter(session => !this._sessionModels.has(session.sessionId))
.filter(session => !session.isImported)
.map(item => {
return <IChatDetail>{
sessionId: item.sessionId,
@ -547,9 +549,7 @@ export class ChatService extends Disposable implements IChatService {
throw new Error(`Unknown session: ${sessionId}`);
}
if (model.getRequests().length && !model.isImported) {
this._persistedSessions[sessionId] = model.toJSON();
}
this._persistedSessions[sessionId] = model.toJSON();
model.dispose();
this._sessionModels.delete(sessionId);