inline chat: also migrate lastInput and exchanges from old session to new session of the migrated inline chat

This commit is contained in:
Ulugbek Abdullaev
2024-08-15 12:53:47 +02:00
parent 8eb2665b22
commit adc3fe4984
4 changed files with 25 additions and 11 deletions

View File

@@ -27,7 +27,7 @@ import { IChatService } from 'vs/workbench/contrib/chat/common/chatService';
import { CTX_INLINE_CHAT_HAS_AGENT, EditMode } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { EmptyResponse, ErrorResponse, HunkData, ReplyResponse, Session, SessionExchange, SessionWholeRange, StashedSession, TelemetryData, TelemetryDataClassification } from './inlineChatSession';
import { EmptyResponse, ErrorResponse, HunkData, ReplyResponse, Session, SessionExchange, SessionPrompt, SessionWholeRange, StashedSession, TelemetryData, TelemetryDataClassification } from './inlineChatSession';
import { IInlineChatSessionEndEvent, IInlineChatSessionEvent, IInlineChatSessionService, ISessionKeyComputer, Recording } from './inlineChatSessionService';
@@ -87,7 +87,7 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
this._sessions.clear();
}
async createSession(editor: IActiveCodeEditor, options: { editMode: EditMode; wholeRange?: Range; chatModel?: ChatModel }, token: CancellationToken): Promise<Session | undefined> {
async createSession(editor: IActiveCodeEditor, options: { editMode: EditMode; wholeRange?: Range; chatModel?: ChatModel; exchanges?: SessionExchange[]; lastInput?: SessionPrompt }, token: CancellationToken): Promise<Session | undefined> {
const agent = this._chatAgentService.getDefaultAgent(ChatAgentLocation.Editor);
@@ -96,7 +96,6 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
return undefined;
}
this._onWillStartSession.fire(editor);
const textModel = editor.getModel();
@@ -215,7 +214,9 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
agent,
store.add(new SessionWholeRange(textModelN, wholeRange)),
store.add(new HunkData(this._editorWorkerService, textModel0, textModelN)),
chatModel
chatModel,
options.exchanges,
options.lastInput
);
// store: key -> session