Skip to content

Commit

Permalink
Fix showing wrong welcome view content when offline (#239365)
Browse files Browse the repository at this point in the history
Only apply agent content override hack in chatwidget welcome content, not contributed welcome views
Fix microsoft/vscode-copilot#12726
  • Loading branch information
roblourens committed Feb 2, 2025
1 parent d1e9445 commit 177ddd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/vs/workbench/contrib/chat/browser/chatWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,10 @@ export class ChatWidget extends Disposable implements IChatWidget {
const welcomePart = this._register(this.instantiationService.createInstance(
ChatViewWelcomePart,
{ ...welcomeContent, tips, },
{ location: this.location }
{
location: this.location,
isWidgetWelcomeViewContent: true
}
));
dom.append(this.welcomeMessageContainer, welcomePart.element);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export interface IChatViewWelcomeContent {
export interface IChatViewWelcomeRenderOptions {
firstLinkToButton?: boolean;
location: ChatAgentLocation;
isWidgetWelcomeViewContent?: boolean;
}

export class ChatViewWelcomePart extends Disposable {
Expand Down Expand Up @@ -146,7 +147,7 @@ export class ChatViewWelcomePart extends Disposable {
title.textContent = content.title;

// Preview indicator
if (options?.location === ChatAgentLocation.EditingSession && typeof content.message !== 'function' && chatAgentService.toolsAgentModeEnabled) {
if (options?.location === ChatAgentLocation.EditingSession && typeof content.message !== 'function' && chatAgentService.toolsAgentModeEnabled && options.isWidgetWelcomeViewContent) {
// Override welcome message for the agent. Sort of a hack, should it come from the participant? This case is different because the welcome content typically doesn't change per ChatWidget
const agentMessage = localize({ key: 'agentMessage', comment: ['{Locked="["}', '{Locked="]({0})"}'] }, "Ask Copilot to edit your files in [agent mode]({0}). Copilot will automatically use multiple requests to pick files to edit, run terminal commands, and iterate on errors.\n\nCopilot is powered by AI, so mistakes are possible. Review output carefully before use.", 'https://aka.ms/vscode-copilot-agent');
content.message = new MarkdownString(agentMessage);
Expand Down

0 comments on commit 177ddd8

Please sign in to comment.