Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/chat/electron-browser/builtInTools/tools.ts
4780 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Disposable } from '../../../../../base/common/lifecycle.js';
7
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
8
import { IWorkbenchContribution } from '../../../../common/contributions.js';
9
import { ChatUrlFetchingConfirmationContribution } from '../../common/tools/builtinTools/chatUrlFetchingConfirmation.js';
10
import { ILanguageModelToolsConfirmationService } from '../../common/tools/languageModelToolsConfirmationService.js';
11
import { ILanguageModelToolsService } from '../../common/tools/languageModelToolsService.js';
12
import { InternalFetchWebPageToolId } from '../../common/tools/builtinTools/tools.js';
13
import { FetchWebPageTool, FetchWebPageToolData, IFetchWebPageToolParams } from './fetchPageTool.js';
14
15
export class NativeBuiltinToolsContribution extends Disposable implements IWorkbenchContribution {
16
17
static readonly ID = 'chat.nativeBuiltinTools';
18
19
constructor(
20
@ILanguageModelToolsService toolsService: ILanguageModelToolsService,
21
@IInstantiationService instantiationService: IInstantiationService,
22
@ILanguageModelToolsConfirmationService confirmationService: ILanguageModelToolsConfirmationService,
23
) {
24
super();
25
26
const editTool = instantiationService.createInstance(FetchWebPageTool);
27
this._register(toolsService.registerTool(FetchWebPageToolData, editTool));
28
29
this._register(confirmationService.registerConfirmationContribution(
30
InternalFetchWebPageToolId,
31
instantiationService.createInstance(
32
ChatUrlFetchingConfirmationContribution,
33
params => (params as IFetchWebPageToolParams).urls
34
)
35
));
36
}
37
}
38
39