Spaces:
Paused
Paused
Daniel Marques
commited on
Commit
•
880c11d
1
Parent(s):
03ebafe
fix: add callback
Browse files
main.py
CHANGED
@@ -241,17 +241,17 @@ async def websocket_endpoint(websocket: WebSocket, client_id: int):
|
|
241 |
pubsub = redisClient.pubsub()
|
242 |
pubsub.subscribe(f'{client_id}')
|
243 |
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
|
256 |
|
257 |
except WebSocketDisconnect:
|
|
|
241 |
pubsub = redisClient.pubsub()
|
242 |
pubsub.subscribe(f'{client_id}')
|
243 |
|
244 |
+
response = QA(inputs=prompt, return_only_outputs=True, tags=f'{client_id}', include_run_info=True, callbacks=[handleCallback])
|
245 |
+
await websocket.send_text(f'{response}')
|
246 |
+
|
247 |
+
# with concurrent.futures.ThreadPoolExecutor() as executor:
|
248 |
+
# executor.submit(QA(inputs=prompt, return_only_outputs=True, tags=f'{client_id}', include_run_info=True, callbacks=[handleCallback]))
|
249 |
+
|
250 |
+
# for item in pubsub.listen():
|
251 |
+
# if item["type"] == "message":
|
252 |
+
# message = item["data"].decode('utf-8')
|
253 |
+
# if message == "end": pubsub.unsubscribe({client_id})
|
254 |
+
# await websocket.send_text(f'{message}')
|
255 |
|
256 |
|
257 |
except WebSocketDisconnect:
|