mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Fix for agent session progress (#281397)
This commit is contained in:
@@ -188,23 +188,22 @@ export class AgentSessionRenderer implements ICompressibleTreeRenderer<IAgentSes
|
||||
}
|
||||
|
||||
private renderDescription(session: ITreeNode<IAgentSession, FuzzyScore>, template: IAgentSessionItemTemplate): void {
|
||||
|
||||
// Support description as string
|
||||
if (typeof session.element.description === 'string') {
|
||||
template.description.textContent = session.element.description;
|
||||
}
|
||||
|
||||
// or as markdown
|
||||
else if (session.element.description) {
|
||||
template.elementDisposable.add(this.markdownRendererService.render(session.element.description, {
|
||||
sanitizerConfig: {
|
||||
replaceWithPlaintext: true,
|
||||
allowedTags: {
|
||||
override: allowedChatMarkdownHtmlTags,
|
||||
const description = session.element.description;
|
||||
if (description) {
|
||||
// Support description as string
|
||||
if (typeof description === 'string') {
|
||||
template.description.textContent = description;
|
||||
} else {
|
||||
template.elementDisposable.add(this.markdownRendererService.render(description, {
|
||||
sanitizerConfig: {
|
||||
replaceWithPlaintext: true,
|
||||
allowedTags: {
|
||||
override: allowedChatMarkdownHtmlTags,
|
||||
},
|
||||
allowedLinkSchemes: { augment: [this.productService.urlProtocol] }
|
||||
},
|
||||
allowedLinkSchemes: { augment: [this.productService.urlProtocol] }
|
||||
},
|
||||
}, template.description));
|
||||
}, template.description));
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to state label
|
||||
|
||||
@@ -953,33 +953,35 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
|
||||
|
||||
for (let i = responseParts.length - 1; i >= 0; i--) {
|
||||
const part = responseParts[i];
|
||||
if (!description && part.kind === 'confirmation' && typeof part.message === 'string') {
|
||||
description = part.message;
|
||||
if (description) {
|
||||
break;
|
||||
}
|
||||
if (!description && part.kind === 'toolInvocation') {
|
||||
|
||||
if (part.kind === 'confirmation' && typeof part.message === 'string') {
|
||||
description = part.message;
|
||||
} else if (part.kind === 'toolInvocation') {
|
||||
const toolInvocation = part as IChatToolInvocation;
|
||||
const state = toolInvocation.state.get();
|
||||
|
||||
if (state.type !== IChatToolInvocation.StateKind.Completed) {
|
||||
const pastTenseMessage = toolInvocation.pastTenseMessage;
|
||||
const invocationMessage = toolInvocation.invocationMessage;
|
||||
description = pastTenseMessage || invocationMessage;
|
||||
description = toolInvocation.pastTenseMessage || toolInvocation.invocationMessage;
|
||||
|
||||
if (state.type === IChatToolInvocation.StateKind.WaitingForConfirmation) {
|
||||
const message = toolInvocation.confirmationMessages?.title && (typeof toolInvocation.confirmationMessages.title === 'string'
|
||||
? toolInvocation.confirmationMessages.title
|
||||
: toolInvocation.confirmationMessages.title.value);
|
||||
description = message ?? localize('chat.sessions.description.waitingForConfirmation', "Waiting for confirmation: {0}", typeof description === 'string' ? description : description.value);
|
||||
const confirmationTitle = toolInvocation.confirmationMessages?.title;
|
||||
const titleMessage = confirmationTitle && (typeof confirmationTitle === 'string'
|
||||
? confirmationTitle
|
||||
: confirmationTitle.value);
|
||||
const descriptionValue = typeof description === 'string' ? description : description.value;
|
||||
description = titleMessage ?? localize('chat.sessions.description.waitingForConfirmation', "Waiting for confirmation: {0}", descriptionValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!description && part.kind === 'toolInvocationSerialized') {
|
||||
} else if (part.kind === 'toolInvocationSerialized') {
|
||||
description = part.invocationMessage;
|
||||
}
|
||||
if (!description && part.kind === 'progressMessage') {
|
||||
} else if (part.kind === 'progressMessage') {
|
||||
description = part.content;
|
||||
}
|
||||
}
|
||||
|
||||
return renderAsPlaintext(description, { useLinkFormatter: true });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user