mirror of https://github.com/kortix-ai/suna.git
AI: How can we stream the edit_file tool when it generating like create_file ? Also the edit_file tool show this
"""Invalid File Edit Could not extract the file changes from the tool result.""" Check the state of code base and make to sure implement fully
This commit is contained in:
parent
7ef8a624be
commit
fe1e1c6fb4
|
@ -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,
|
||||
|
|
|
@ -202,14 +202,20 @@ export function FileEditToolView({
|
|||
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="flex items-center text-xs text-zinc-500 dark:text-zinc-400 gap-3">
|
||||
<div className="flex items-center">
|
||||
<Plus className="h-3.5 w-3.5 text-emerald-500 mr-1" />
|
||||
<span>{stats.additions}</span>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Minus className="h-3.5 w-3.5 text-red-500 mr-1" />
|
||||
<span>{stats.deletions}</span>
|
||||
</div>
|
||||
{stats.additions === 0 && stats.deletions === 0 ? (
|
||||
<Badge variant="outline" className="text-xs font-normal">No changes</Badge>
|
||||
) : (
|
||||
<>
|
||||
<div className="flex items-center">
|
||||
<Plus className="h-3.5 w-3.5 text-emerald-500 mr-1" />
|
||||
<span>{stats.additions}</span>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Minus className="h-3.5 w-3.5 text-red-500 mr-1" />
|
||||
<span>{stats.deletions}</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<Tabs value={viewMode} onValueChange={(v) => setViewMode(v as 'unified' | 'split')} className="w-auto">
|
||||
<TabsList className="h-7 p-0.5">
|
||||
|
|
|
@ -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 {};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue