print for debugging

This commit is contained in:
Abi Raja 2024-07-31 11:25:49 -04:00
parent 637c1b4c1d
commit 7b2e2963ad

View File

@ -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)