diff --git a/backend/agent/tools/sb_files_tool.py b/backend/agent/tools/sb_files_tool.py index 563c379e..590df309 100644 --- a/backend/agent/tools/sb_files_tool.py +++ b/backend/agent/tools/sb_files_tool.py @@ -529,7 +529,7 @@ def authenticate_user(username, password): })) if new_content == original_content: - return ToolResult(success=False, output=json.dumps({ + return ToolResult(success=True, output=json.dumps({ "message": f"AI editing resulted in no changes to the file '{target_file}'.", "file_path": target_file, "original_content": original_content, diff --git a/frontend/src/components/thread/tool-views/file-operation/FileEditToolView.tsx b/frontend/src/components/thread/tool-views/file-operation/FileEditToolView.tsx index e7953260..a0094ce6 100644 --- a/frontend/src/components/thread/tool-views/file-operation/FileEditToolView.tsx +++ b/frontend/src/components/thread/tool-views/file-operation/FileEditToolView.tsx @@ -202,14 +202,20 @@ export function FileEditToolView({
-
- - {stats.additions} -
-
- - {stats.deletions} -
+ {stats.additions === 0 && stats.deletions === 0 ? ( + No changes + ) : ( + <> +
+ + {stats.additions} +
+
+ + {stats.deletions} +
+ + )}
setViewMode(v as 'unified' | 'split')} className="w-auto"> diff --git a/frontend/src/components/thread/tool-views/file-operation/_utils.ts b/frontend/src/components/thread/tool-views/file-operation/_utils.ts index be7b7a26..af6ebf31 100644 --- a/frontend/src/components/thread/tool-views/file-operation/_utils.ts +++ b/frontend/src/components/thread/tool-views/file-operation/_utils.ts @@ -282,6 +282,18 @@ export const extractFileEditData = ( errorMessage: errorMessage, }; } + + // Fallback for when toolContent is just the output object from the tool result + if (typeof parsed === 'object' && parsed !== null && (parsed.original_content !== undefined || parsed.updated_content !== undefined)) { + return { + filePath: parsed.file_path || null, + originalContent: parsed.original_content ?? null, + updatedContent: parsed.updated_content ?? null, + success: true, // Assume success if we have content + timestamp: null, + errorMessage: parsed.message, + }; + } return {}; };