mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 14:22:27 +00:00
sync
This commit is contained in:
@@ -4,6 +4,7 @@ import * as fs from "fs/promises"
|
||||
import { Tool } from "./tool"
|
||||
import { FileTimes } from "./util/file-times"
|
||||
import DESCRIPTION from "./patch.txt"
|
||||
import { App } from "../app/app"
|
||||
|
||||
const PatchParams = z.object({
|
||||
patchText: z
|
||||
@@ -11,12 +12,6 @@ const PatchParams = z.object({
|
||||
.describe("The full patch text that describes all changes to be made"),
|
||||
})
|
||||
|
||||
interface PatchResponseMetadata {
|
||||
changed: string[]
|
||||
additions: number
|
||||
removals: number
|
||||
}
|
||||
|
||||
interface Change {
|
||||
type: "add" | "update" | "delete"
|
||||
old_content?: string
|
||||
@@ -242,10 +237,6 @@ export const PatchTool = Tool.define({
|
||||
description: DESCRIPTION,
|
||||
parameters: PatchParams,
|
||||
execute: async (params, ctx) => {
|
||||
if (!params.patchText) {
|
||||
throw new Error("patchText is required")
|
||||
}
|
||||
|
||||
// Identify all files needed for the patch and verify they've been read
|
||||
const filesToRead = identifyFilesNeeded(params.patchText)
|
||||
for (const filePath of filesToRead) {
|
||||
@@ -372,7 +363,8 @@ export const PatchTool = Tool.define({
|
||||
changed: changedFiles,
|
||||
additions: totalAdditions,
|
||||
removals: totalRemovals,
|
||||
} satisfies PatchResponseMetadata,
|
||||
title: `${filesToRead.length} files`,
|
||||
},
|
||||
output,
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user