Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -341,14 +341,14 @@ async def handle_user_input(websocket, process):
|
|
341 |
await asyncio.sleep(0.1)
|
342 |
if process.returncode is not None:
|
343 |
break
|
344 |
-
message = await websocket.recv()
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
except websockets.ConnectionClosed:
|
353 |
print("WebSocket connection closed")
|
354 |
break
|
|
|
341 |
await asyncio.sleep(0.1)
|
342 |
if process.returncode is not None:
|
343 |
break
|
344 |
+
# message = await websocket.recv()
|
345 |
+
async for message in websocket:
|
346 |
+
user_input = json.loads(message)
|
347 |
+
print(user_input)
|
348 |
+
print(f'Received user input: {user_input["command"]["command"]}')
|
349 |
+
|
350 |
+
process_input(user_input, process)
|
351 |
+
break
|
352 |
except websockets.ConnectionClosed:
|
353 |
print("WebSocket connection closed")
|
354 |
break
|