Daniel Marques commited on
Commit
cde8337
1 Parent(s): 5b4b189

fix: add type filter message

Browse files
Files changed (1) hide show
  1. main.py +5 -2
main.py CHANGED
@@ -230,12 +230,15 @@ async def websocket_endpoint(websocket: WebSocket, client_id: int):
230
  with concurrent.futures.ThreadPoolExecutor() as executor:
231
  executor.submit(QA(inputs=prompt, return_only_outputs=True, callbacks=[MyCustomSyncHandler()], tags=f'{client_id}', include_run_info=True))
232
 
 
233
  for item in pubsub.listen():
 
234
  itemJson = str(item)
235
- print(itemJson)
236
- # await websocket.send_text(f'{item}')
237
 
 
238
 
 
239
 
240
  except WebSocketDisconnect:
241
  print('disconnect')
 
230
  with concurrent.futures.ThreadPoolExecutor() as executor:
231
  executor.submit(QA(inputs=prompt, return_only_outputs=True, callbacks=[MyCustomSyncHandler()], tags=f'{client_id}', include_run_info=True))
232
 
233
+ i = 0
234
  for item in pubsub.listen():
235
+ i+=1
236
  itemJson = str(item)
237
+ print(item["type"] == "message")
 
238
 
239
+ if(i > 10 ): pubsub.unsubscribe({client_id})
240
 
241
+ # await websocket.send_text(f'{item}')
242
 
243
  except WebSocketDisconnect:
244
  print('disconnect')