diff --git a/core/tools/definitions/editFile.ts b/core/tools/definitions/editFile.ts index 6ee5cee6b..9e2d60219 100644 --- a/core/tools/definitions/editFile.ts +++ b/core/tools/definitions/editFile.ts @@ -3,7 +3,7 @@ import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; export interface EditToolArgs { filepath: string; - new_contents: string; + changes: string; } export const editFileTool: Tool = { @@ -20,16 +20,17 @@ export const editFileTool: Tool = { "Use this tool to edit an existing file. If you don't know the contents of the file, read it first.", parameters: { type: "object", - required: ["filepath", "new_contents"], + required: ["filepath", "changes"], properties: { filepath: { type: "string", description: "The path of the file to edit, relative to the root of the workspace.", }, - new_contents: { + changes: { type: "string", - description: "The new file contents", + description: + "Any modifications to the file, showing only needed changes. Do NOT wrap this in a codeblock. Use brief language-appropriate placeholders for large unmodified sections, e.g. '// ... rest of code here ...'", }, }, }, diff --git a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx index 304dcb4c7..a298325b5 100644 --- a/gui/src/pages/gui/ToolCallDiv/EditFile.tsx +++ b/gui/src/pages/gui/ToolCallDiv/EditFile.tsx @@ -6,12 +6,12 @@ import { useAppSelector } from "../../../redux/hooks"; type EditToolCallProps = { relativeFilePath: string; - newContents: string; + changes: string; toolCallId?: string; }; export function EditFile(props: EditToolCallProps) { - const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.newContents ?? ""}\n\`\`\``; + const src = `\`\`\`${getMarkdownLanguageTagForFile(props.relativeFilePath ?? "test.txt")} ${props.relativeFilePath}\n${props.changes ?? ""}\n\`\`\``; const isStreaming = useAppSelector((state) => state.session.isStreaming); const states = useAppSelector((store) => store.session.codeBlockApplyStates); diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index d9906794e..02759dd18 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -25,7 +25,7 @@ function FunctionSpecificToolCallDiv({ return ( ); diff --git a/gui/src/util/clientTools/editImpl.ts b/gui/src/util/clientTools/editImpl.ts index 2a6d3e1d4..3e5271228 100644 --- a/gui/src/util/clientTools/editImpl.ts +++ b/gui/src/util/clientTools/editImpl.ts @@ -19,7 +19,7 @@ export const editToolImpl: ClientToolImpl = async ( } const apply = await extras.ideMessenger.request("applyToFile", { streamId: extras.activeToolStreamId, - text: args.new_contents, + text: args.changes, toolCallId, filepath: firstUriMatch, });