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
4a19e1e521
commit
cb424d8fe7
|
@ -1727,10 +1727,10 @@ class ResponseProcessor:
|
||||||
# If parsing fails, keep the original string
|
# If parsing fails, keep the original string
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
output_to_use = output
|
||||||
# If this is for the LLM and it's an edit_file tool, create a concise output
|
# If this is for the LLM and it's an edit_file tool, create a concise output
|
||||||
if for_llm and function_name == 'edit_file' and isinstance(output, dict):
|
if for_llm and function_name == 'edit_file' and isinstance(output, dict):
|
||||||
output_for_llm = {"message": output.get("message", "File edited successfully.")}
|
output_to_use = {"message": output.get("message", "File edited successfully.")}
|
||||||
output = output_for_llm
|
|
||||||
|
|
||||||
# Create the structured result
|
# Create the structured result
|
||||||
structured_result_v1 = {
|
structured_result_v1 = {
|
||||||
|
@ -1741,7 +1741,7 @@ class ResponseProcessor:
|
||||||
"arguments": arguments,
|
"arguments": arguments,
|
||||||
"result": {
|
"result": {
|
||||||
"success": result.success if hasattr(result, 'success') else True,
|
"success": result.success if hasattr(result, 'success') else True,
|
||||||
"output": output, # This will be either rich or concise based on `for_llm`
|
"output": output_to_use, # This will be either rich or concise based on `for_llm`
|
||||||
"error": getattr(result, 'error', None) if hasattr(result, 'error') else None
|
"error": getattr(result, 'error', None) if hasattr(result, 'error') else None
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,9 +246,9 @@ export const extractPrimaryParam = (
|
||||||
return match ? match[1].split('/').pop() || match[1] : null;
|
return match ? match[1].split('/').pop() || match[1] : null;
|
||||||
case 'edit-file':
|
case 'edit-file':
|
||||||
// Try to match target_file attribute for edit-file
|
// Try to match target_file attribute for edit-file
|
||||||
match = content.match(/target_file=(?:"|')([^"|']+)(?:"|')/);
|
match = content.match(/target_file=(?:"|')([^"|']+)(?:"|')/) || content.match(/<parameter\s+name=["']target_file["']>([^<]+)/i);
|
||||||
// Return just the filename part
|
// Return just the filename part
|
||||||
return match ? match[1].split('/').pop() || match[1] : null;
|
return match ? (match[1].split('/').pop() || match[1]).trim() : null;
|
||||||
|
|
||||||
// Shell commands
|
// Shell commands
|
||||||
case 'execute-command':
|
case 'execute-command':
|
||||||
|
|
Loading…
Reference in New Issue