Skip to content

Commit

Permalink
Get rid of chat progress Task (#202777)
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens authored Jan 18, 2024
1 parent 834e742 commit 3c8e0fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 37 deletions.
15 changes: 1 addition & 14 deletions src/vs/workbench/api/common/extHostChatAgents2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,7 @@ export class ExtHostChatAgents2 implements ExtHostChatAgentsShape2 {
}

if ('placeholder' in progress && 'resolvedContent' in progress) {
const resolvedContent = Promise.all([this._proxy.$handleProgressChunk(request.requestId, convertedProgress), progress.resolvedContent]);
raceCancellation(resolvedContent, token).then(res => {
if (!res) {
return; /* Cancelled */
}
const [progressHandle, progressContent] = res;
const convertedContent = typeConvert.ChatResponseProgress.from(agent.extension, progressContent);
if (!convertedContent) {
this._logService.error('Unknown progress type: ' + JSON.stringify(progressContent));
return;
}

this._proxy.$handleProgressChunk(request.requestId, convertedContent, progressHandle ?? undefined);
});
// Ignore for now, this is the deleted Task type
} else {
this._proxy.$handleProgressChunk(request.requestId, convertedProgress);
}
Expand Down
4 changes: 1 addition & 3 deletions src/vs/workbench/api/common/extHostTypeConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2320,9 +2320,7 @@ export namespace InteractiveEditorResponseFeedbackKind {

export namespace ChatResponseProgress {
export function from(extension: IExtensionDescription, progress: vscode.ChatAgentExtendedProgress): extHostProtocol.IChatProgressDto | undefined {
if ('placeholder' in progress && 'resolvedContent' in progress) {
return { content: progress.placeholder, kind: 'asyncContent' } satisfies extHostProtocol.IChatAsyncContentDto;
} else if ('markdownContent' in progress) {
if ('markdownContent' in progress) {
checkProposedApiEnabled(extension, 'chatAgents2Additions');
return { content: MarkdownString.from(progress.markdownContent), kind: 'markdownContent' };
} else if ('content' in progress) {
Expand Down
21 changes: 1 addition & 20 deletions src/vscode-dts/vscode.proposed.chatAgents2.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ declare module 'vscode' {
export type ChatAgentContentProgress =
| ChatAgentContent
| ChatAgentFileTree
| ChatAgentInlineContentReference
| ChatAgentTask;
| ChatAgentInlineContentReference;

export type ChatAgentMetadataProgress =
| ChatAgentUsedContext
Expand Down Expand Up @@ -322,24 +321,6 @@ declare module 'vscode' {
content: string;
}

/**
* Represents a piece of the chat response's content that is resolved asynchronously. It is rendered immediately with a placeholder,
* which is replaced once the full content is available.
*/
export interface ChatAgentTask {
/**
* The markdown string to be rendered immediately.
*/
placeholder: string;

/**
* A Thenable resolving to the real content. The placeholder will be replaced with this content once it's available.
*/
// TODO@API Should this be an async iterable or progress instance instead
// TODO@API Should this include more inline-renderable items like `ChatAgentInlineContentReference`
resolvedContent: Thenable<ChatAgentContent | ChatAgentFileTree>;
}

/**
* Represents a tree, such as a file and directory structure, rendered in the chat response.
*/
Expand Down

0 comments on commit 3c8e0fc

Please sign in to comment.