diff --git a/core/config/load.ts b/core/config/load.ts index 25a9b510d..b199e0e58 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -58,7 +58,7 @@ import { readAllGlobalPromptFiles, } from "../util/paths"; -import { makeCreateNewFileTool } from "../tools"; +import { makeCreateNewFileTool, runTerminalCommandTool } from "../tools"; import { defaultContextProvidersJetBrains, defaultContextProvidersVsCode, @@ -336,7 +336,10 @@ async function intermediateToFinalConfig( ...model.requestOptions, ...config.requestOptions, }; - model.completionOptions.tools = [makeCreateNewFileTool(ide)]; + model.completionOptions.tools = [ + makeCreateNewFileTool(ide), + runTerminalCommandTool(ide), + ]; } if (allowFreeTrial) { diff --git a/core/tools/index.ts b/core/tools/index.ts index ad6767d9b..aec23de36 100644 --- a/core/tools/index.ts +++ b/core/tools/index.ts @@ -24,3 +24,25 @@ export const makeCreateNewFileTool = (ide: IDE): Tool => ({ }, }, }); + +export const runTerminalCommandTool = (ide: IDE): Tool => ({ + type: "function", + action: async (...args) => { + await ide.runCommand(args[0]); + }, + function: { + name: "run_terminal_command", + description: "Run a terminal command in the current directory", + parameters: { + type: "object", + required: ["command"], + properties: { + command: { + type: "string", + description: + "The command to run. This will be passed directly into the shell.", + }, + }, + }, + }, +}); diff --git a/gui/src/hooks/useChatHandler.ts b/gui/src/hooks/useChatHandler.ts index a66debf80..baf2310c6 100644 --- a/gui/src/hooks/useChatHandler.ts +++ b/gui/src/hooks/useChatHandler.ts @@ -89,7 +89,6 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { abortController.abort(); break; } - console.log(".......", (next.value as any).role); dispatch(streamUpdate(next.value as ChatMessage)); next = await gen.next(); } diff --git a/gui/src/pages/gui/ToolCallDiv/CreateFile.tsx b/gui/src/pages/gui/ToolCallDiv/CreateFile.tsx index e1e65981e..5dbdaf340 100644 --- a/gui/src/pages/gui/ToolCallDiv/CreateFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/CreateFile.tsx @@ -11,10 +11,10 @@ export function CreateFile(props: CreateFileToolCallProps) { <>
Continue wants to create a file:
Continue wants to run a terminal command:
+ +