Update response to write_to_file

This commit is contained in:
Saoud Rizwan
2024-08-31 06:57:26 -04:00
parent 2b7114b813
commit fdb8df5aa6

View File

@@ -893,12 +893,14 @@ export class ClaudeDev {
diff: this.createPrettyPatch(relPath, newContent, editedContent), diff: this.createPrettyPatch(relPath, newContent, editedContent),
} as ClaudeSayTool) } as ClaudeSayTool)
) )
return `${ return `The user accepted but made the following changes to your content:\n\n${userDiff}\n\nFinal result ${
fileExists ? "Changes applied" : "New file written" fileExists ? "applied to" : "written as new file"
} to ${relPath}:\n${diffResult}, the user applied these changes:\n${userDiff}` } ${relPath}:\n\n${diffResult}`
} else { } else {
const diffResult = diff.createPatch(relPath, originalContent, newContent) const diffResult = diff.createPatch(relPath, originalContent, newContent)
return `${fileExists ? "Changes applied" : "New file written"} to ${relPath}:\n${diffResult}` return `${
fileExists ? `Changes applied to ${relPath}:\n\n${diffResult}` : `New file written to ${relPath}`
}`
} }
} catch (error) { } catch (error) {
const errorString = `Error writing file: ${JSON.stringify(serializeError(error))}` const errorString = `Error writing file: ${JSON.stringify(serializeError(error))}`