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:
LE Quoc Dat 2025-07-28 22:02:07 +02:00
parent 1fbac3bc15
commit 86aaa9e5ca
2 changed files with 3 additions and 3 deletions

View File

@ -142,7 +142,7 @@ export function FileEditToolView({
const lineDiff = originalContent && updatedContent ? generateLineDiff(originalContent, updatedContent) : []; const lineDiff = originalContent && updatedContent ? generateLineDiff(originalContent, updatedContent) : [];
const stats: DiffStats = calculateDiffStats(lineDiff); const stats: DiffStats = calculateDiffStats(lineDiff);
const shouldShowError = !isStreaming && (!actualIsSuccess || (actualIsSuccess && (!originalContent || !updatedContent))); const shouldShowError = !isStreaming && (!actualIsSuccess || (actualIsSuccess && (originalContent === null || updatedContent === null)));
return ( return (
<Card className="gap-0 flex border shadow-none border-t border-b-0 border-x-0 p-0 rounded-none flex-col h-full overflow-hidden bg-card"> <Card className="gap-0 flex border shadow-none border-t border-b-0 border-x-0 p-0 rounded-none flex-col h-full overflow-hidden bg-card">

View File

@ -265,8 +265,8 @@ export const extractFileEditData = (
const success = parsed.tool_execution.result?.success; const success = parsed.tool_execution.result?.success;
return { return {
filePath: args.target_file || output?.file_path || null, filePath: args.target_file || output?.file_path || null,
originalContent: output?.original_content || null, originalContent: output?.original_content ?? null,
updatedContent: output?.updated_content || null, updatedContent: output?.updated_content ?? null,
success: success, success: success,
timestamp: parsed.tool_execution.execution_details?.timestamp, timestamp: parsed.tool_execution.execution_details?.timestamp,
errorMessage: success === false ? (output?.message || (typeof output === 'string' ? output : JSON.stringify(output))) : undefined, errorMessage: success === false ? (output?.message || (typeof output === 'string' ? output : JSON.stringify(output))) : undefined,