Skip to content

Commit e3af8b7

Browse files
authored
Don't reset mode to Edit if Agent participant has not loaded yet (#245931)
Fix microsoft/vscode-copilot-release#7379
1 parent d79cd9d commit e3af8b7

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,6 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
404404
});
405405

406406
this.initSelectedModel();
407-
408-
this._register(agentService.onDidChangeAgents(() => {
409-
if (!agentService.hasToolsAgent && this._currentMode === ChatMode.Agent) {
410-
this.setChatMode(ChatMode.Edit);
411-
}
412-
}));
413407
}
414408

415409
private getSelectedModelStorageKey(): string {
@@ -469,10 +463,6 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
469463
}
470464

471465
mode = validateChatMode(mode) ?? (this.location === ChatAgentLocation.Panel ? ChatMode.Ask : ChatMode.Edit);
472-
if (mode === ChatMode.Agent && !this.agentService.hasToolsAgent) {
473-
mode = ChatMode.Edit;
474-
}
475-
476466
this._currentMode = mode;
477467
this.chatMode.set(mode);
478468
this._onDidChangeCurrentChatMode.fire();
@@ -714,6 +704,12 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
714704
}
715705
}
716706

707+
validateCurrentMode(): void {
708+
if (!this.agentService.hasToolsAgent && this._currentMode === ChatMode.Agent) {
709+
this.setChatMode(ChatMode.Edit);
710+
}
711+
}
712+
717713
// A funtion that filters out specifically the `value` property of the attachment.
718714
private getFilteredEntry(query: string, inputState: IChatInputState): IChatHistoryEntry {
719715
const attachmentsWithoutImageValues = inputState.chatContextAttachments?.map(attachment => {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
11431143

11441144
this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionId);
11451145

1146+
this.input.validateCurrentMode();
11461147
const result = await this.chatService.sendRequest(this.viewModel.sessionId, input, {
11471148
mode: this.inputPart.currentMode,
11481149
userSelectedModelId: this.inputPart.currentLanguageModel,

0 commit comments

Comments
 (0)