Skip to content

Commit 8974990

Browse files
authored
Ensure user selected tools is setup correctly (microsoft#250027)
1 parent 7f3d92f commit 8974990

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { IInstantiationService } from '../../../../../platform/instantiation/com
1010
import { IChatProgressRenderableResponseContent } from '../../common/chatModel.js';
1111
import { IChatConfirmation, IChatSendRequestOptions, IChatService } from '../../common/chatService.js';
1212
import { isResponseVM } from '../../common/chatViewModel.js';
13+
import { ChatMode } from '../../common/constants.js';
14+
import { ILanguageModelToolsService } from '../../common/languageModelToolsService.js';
1315
import { IChatWidgetService } from '../chat.js';
1416
import { ChatConfirmationWidget } from './chatConfirmationWidget.js';
1517
import { IChatContentPart, IChatContentPartRenderContext } from './chatContentParts.js';
@@ -26,6 +28,7 @@ export class ChatConfirmationContentPart extends Disposable implements IChatCont
2628
@IInstantiationService private readonly instantiationService: IInstantiationService,
2729
@IChatService private readonly chatService: IChatService,
2830
@IChatWidgetService chatWidgetService: IChatWidgetService,
31+
@ILanguageModelToolsService private readonly toolsService: ILanguageModelToolsService,
2932
) {
3033
super();
3134

@@ -56,6 +59,15 @@ export class ChatConfirmationContentPart extends Disposable implements IChatCont
5659
const widget = chatWidgetService.getWidgetBySessionId(element.sessionId);
5760
options.userSelectedModelId = widget?.input.currentLanguageModel;
5861
options.mode = widget?.input.currentMode;
62+
if (widget?.input.currentMode2.customTools) {
63+
options.userSelectedTools = this.toolsService.toEnablementMap(widget.input.currentMode2.customTools);
64+
} else if (widget?.input.currentMode === ChatMode.Agent) {
65+
options.userSelectedTools = {};
66+
for (const [tool, enablement] of widget.input.selectedToolsModel.asEnablementMap()) {
67+
options.userSelectedTools[tool.id] = enablement;
68+
}
69+
}
70+
5971
if (await this.chatService.sendRequest(element.sessionId, prompt, options)) {
6072
confirmation.isUsed = true;
6173
confirmationWidget.setShowButtons(false);

0 commit comments

Comments
 (0)