mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-11 22:51:26 +00:00
Fix undefined on multi-file apply_diff output (#4608)
feat: enhance file handling in `apply_diff` case to support legacy and multi-file formats
This commit is contained in:
parent
184c4803c6
commit
33ce5a2e24
1 changed files with 18 additions and 1 deletions
|
|
@ -161,7 +161,24 @@ export async function presentAssistantMessage(cline: Task) {
|
|||
case "write_to_file":
|
||||
return `[${block.name} for '${block.params.path}']`
|
||||
case "apply_diff":
|
||||
return `[${block.name} for '${block.params.path}']`
|
||||
// Handle both legacy format and new multi-file format
|
||||
if (block.params.path) {
|
||||
return `[${block.name} for '${block.params.path}']`
|
||||
} else if (block.params.args) {
|
||||
// Try to extract first file path from args for display
|
||||
const match = block.params.args.match(/<file>.*?<path>([^<]+)<\/path>/s)
|
||||
if (match) {
|
||||
const firstPath = match[1]
|
||||
// Check if there are multiple files
|
||||
const fileCount = (block.params.args.match(/<file>/g) || []).length
|
||||
if (fileCount > 1) {
|
||||
return `[${block.name} for '${firstPath}' and ${fileCount - 1} more file${fileCount > 2 ? "s" : ""}]`
|
||||
} else {
|
||||
return `[${block.name} for '${firstPath}']`
|
||||
}
|
||||
}
|
||||
}
|
||||
return `[${block.name}]`
|
||||
case "search_files":
|
||||
return `[${block.name} for '${block.params.regex}'${
|
||||
block.params.file_pattern ? ` in '${block.params.file_pattern}'` : ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue