Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

print for debugging

Abi Raja7b2e2963ad9b
diff --git a/backend/routes/generate_code.py b/backend/routes/generate_code.py
index c487c679..e96e7205 100644
--- a/backend/routes/generate_code.py
+++ b/backend/routes/generate_code.py
@@ -97,6 +97,12 @@ async def stream_code(websocket: WebSocket):
value: str,
variantIndex: int,
):
+ # Print for debugging on the backend
+ if type == "error":
+ print(f"Error (variant {variantIndex}): {value}")
+ elif type == "status":
+ print(f"Status (variant {variantIndex}): {value}")
+
await websocket.send_json(
{"type": type, "value": value, "variantIndex": variantIndex}
)
@@ -181,8 +187,6 @@ async def stream_code(websocket: WebSocket):
# Get the image generation flag from the request. Fall back to True if not provided.
should_generate_images = bool(params.get("isImageGenerationEnabled", True))
- print("generating code...")
-
# TODO(*): Print with send_message instead of print statements
await send_message("status", "Generating code...", 0)
await send_message("status", "Generating code...", 1)