bettermint commited on
Commit
6c65761
·
verified ·
1 Parent(s): 8b63970

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -160,7 +160,7 @@ async def exec_command(command):
160
  async def send_prompt(websocket):
161
  # Send initial prompt to client
162
  prompt = await get_prompt()
163
- await websocket.send(prompt)
164
 
165
  @app.websocket("/shell")
166
  async def websocket_endpoint(websocket: WebSocket):
@@ -173,14 +173,14 @@ async def websocket_endpoint(websocket: WebSocket):
173
  command = await websocket.receive_text()
174
 
175
  if command == "exit":
176
- await websocket.send("Goodbye!")
177
  break
178
 
179
  # Execute command
180
  output = await exec_command(command)
181
 
182
  # Send output to client
183
- await websocket.send(output)
184
 
185
  # Send updated prompt to client
186
  await send_prompt(websocket)
 
160
  async def send_prompt(websocket):
161
  # Send initial prompt to client
162
  prompt = await get_prompt()
163
+ await websocket.send_text(prompt)
164
 
165
  @app.websocket("/shell")
166
  async def websocket_endpoint(websocket: WebSocket):
 
173
  command = await websocket.receive_text()
174
 
175
  if command == "exit":
176
+ await websocket.send_text("Goodbye!")
177
  break
178
 
179
  # Execute command
180
  output = await exec_command(command)
181
 
182
  # Send output to client
183
+ await websocket.send_text(output)
184
 
185
  # Send updated prompt to client
186
  await send_prompt(websocket)