Skip to content

Commit 6a81a59

Browse files
authored
Fix showing wrong welcome view content when offline (microsoft#239365)
Only apply agent content override hack in chatwidget welcome content, not contributed welcome views Fix microsoft/vscode-copilot#12726
1 parent d231e6c commit 6a81a59

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,10 @@ export class ChatWidget extends Disposable implements IChatWidget {
587587
const welcomePart = this._register(this.instantiationService.createInstance(
588588
ChatViewWelcomePart,
589589
{ ...welcomeContent, tips, },
590-
{ location: this.location }
590+
{
591+
location: this.location,
592+
isWidgetWelcomeViewContent: true
593+
}
591594
));
592595
dom.append(this.welcomeMessageContainer, welcomePart.element);
593596
}

src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewWelcomeController.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export interface IChatViewWelcomeContent {
116116
export interface IChatViewWelcomeRenderOptions {
117117
firstLinkToButton?: boolean;
118118
location: ChatAgentLocation;
119+
isWidgetWelcomeViewContent?: boolean;
119120
}
120121

121122
export class ChatViewWelcomePart extends Disposable {
@@ -146,7 +147,7 @@ export class ChatViewWelcomePart extends Disposable {
146147
title.textContent = content.title;
147148

148149
// Preview indicator
149-
if (options?.location === ChatAgentLocation.EditingSession && typeof content.message !== 'function' && chatAgentService.toolsAgentModeEnabled) {
150+
if (options?.location === ChatAgentLocation.EditingSession && typeof content.message !== 'function' && chatAgentService.toolsAgentModeEnabled && options.isWidgetWelcomeViewContent) {
150151
// 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
151152
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');
152153
content.message = new MarkdownString(agentMessage);

0 commit comments

Comments
 (0)