mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
remove extraneous tool selection
This commit is contained in:
4
chat-tools-sample/package-lock.json
generated
4
chat-tools-sample/package-lock.json
generated
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "chat-tool-sample",
|
||||
"name": "chat-tools-sample",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "chat-tool-sample",
|
||||
"name": "chat-tools-sample",
|
||||
"version": "0.1.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.5.9",
|
||||
|
||||
@ -45,6 +45,7 @@ function registerChatParticipant(context: vscode.ExtensionContext) {
|
||||
|
||||
const options: vscode.LanguageModelChatRequestOptions = {
|
||||
justification: 'Just because!',
|
||||
tools: allTools
|
||||
};
|
||||
|
||||
const messages = [
|
||||
@ -56,17 +57,7 @@ function registerChatParticipant(context: vscode.ExtensionContext) {
|
||||
}
|
||||
messages.push(vscode.LanguageModelChatMessage.User(request.prompt));
|
||||
|
||||
const toolReferences = [...request.toolReferences];
|
||||
const runWithFunctions = async (): Promise<void> => {
|
||||
const requestedTool = toolReferences.shift();
|
||||
if (requestedTool) {
|
||||
options.toolChoice = requestedTool.id;
|
||||
options.tools = allTools.filter(tool => tool.name === requestedTool.id);
|
||||
} else {
|
||||
options.toolChoice = undefined;
|
||||
options.tools = allTools;
|
||||
}
|
||||
|
||||
const toolCalls: IToolCall[] = [];
|
||||
|
||||
const response = await model.sendRequest(messages, options, token);
|
||||
|
||||
Reference in New Issue
Block a user