mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-14 07:54:36 +01:00
Wait for request to be handled before disposing chat model (#296421)
This commit is contained in:
@@ -576,8 +576,16 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
|
||||
if (chatOptions) {
|
||||
const resource = URI.revive(chatOptions.resource);
|
||||
const ref = await chatService.loadSessionForResource(resource, ChatAgentLocation.Chat, CancellationToken.None);
|
||||
await chatService.sendRequest(resource, chatOptions.prompt, { agentIdSilent: type, attachedContext: chatOptions.attachedContext });
|
||||
ref?.dispose();
|
||||
try {
|
||||
const result = await chatService.sendRequest(resource, chatOptions.prompt, { agentIdSilent: type, attachedContext: chatOptions.attachedContext });
|
||||
if (result.kind === 'queued') {
|
||||
await result.deferred;
|
||||
} else if (result.kind === 'sent') {
|
||||
await result.data.responseCompletePromise;
|
||||
}
|
||||
} finally {
|
||||
ref?.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user