Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -342,8 +342,9 @@ async def handle_user_input(websocket, process):
|
|
342 |
if process.returncode is not None:
|
343 |
break
|
344 |
message = await websocket.recv()
|
345 |
-
user_input =
|
346 |
-
print(
|
|
|
347 |
if not is_valid_input(user_input):
|
348 |
await websocket.send("Invalid input. Please try again.")
|
349 |
continue
|
@@ -493,23 +494,7 @@ async def exe(websocket,connected,key):
|
|
493 |
# await websocket.send(f'data: {message}')
|
494 |
websockets.broadcast(connected,json.dumps(message) )
|
495 |
|
496 |
-
|
497 |
-
# print('sending line')
|
498 |
-
|
499 |
-
# event = {
|
500 |
-
# "type": "terminal-data",
|
501 |
-
# "data": line.strip().decode('utf-8'),
|
502 |
-
# }
|
503 |
-
# await send_message(event)
|
504 |
-
|
505 |
-
|
506 |
-
# async for line in process.stderr:
|
507 |
-
# print(f'error:{line.strip()}')
|
508 |
-
# event = {
|
509 |
-
# "type": "terminal-error",
|
510 |
-
# "data": line.strip().decode('utf-8'),
|
511 |
-
# }
|
512 |
-
# await send_message(event)
|
513 |
|
514 |
await asyncio.gather(
|
515 |
handle_user_input(websocket, process),
|
|
|
342 |
if process.returncode is not None:
|
343 |
break
|
344 |
message = await websocket.recv()
|
345 |
+
user_input = json.loads(message)
|
346 |
+
print(user_input)
|
347 |
+
print(f"Received user input: {user_input["command"]["command"]}")
|
348 |
if not is_valid_input(user_input):
|
349 |
await websocket.send("Invalid input. Please try again.")
|
350 |
continue
|
|
|
494 |
# await websocket.send(f'data: {message}')
|
495 |
websockets.broadcast(connected,json.dumps(message) )
|
496 |
|
497 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
|
499 |
await asyncio.gather(
|
500 |
handle_user_input(websocket, process),
|