From 3b5a442a9c9435c4edb4dabe34ea3237ba200faa Mon Sep 17 00:00:00 2001 From: Acuspeedster Date: Sat, 31 May 2025 13:22:23 +0530 Subject: [PATCH] Refactor response structure in /compile-and-fix endpoint to use boolean success flag Signed-off-by: Acuspeedster --- app/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/main.py b/app/main.py index 8279426..f142bbe 100644 --- a/app/main.py +++ b/app/main.py @@ -204,9 +204,9 @@ async def compile_and_fix_rust(request: dict): for filename, content in current_files.items(): output_text += f"[filename: {filename}]\n{content}\n\n" - # Return JSON response instead of plain text + # Replace the existing JSONResponse in the success case with this return JSONResponse(content={ - "status": "success", + "success": True, "message": "Code fixed and compiled successfully", "attempts": attempts, "combined_text": output_text.strip(), @@ -281,7 +281,7 @@ async def compile_and_fix_rust(request: dict): # If we've exhausted all attempts, return error return JSONResponse(content={ - "status": "failed", + "success": False, "message": f"Failed to fix code after {max_attempts} attempts", "attempts": attempts, "combined_text": output_text.strip(),