Spaces:
Paused
Paused
Daniel Marques
commited on
Commit
·
ff06cd6
1
Parent(s):
b63eab3
fix: add websocket in handlerToken
Browse files
main.py
CHANGED
@@ -259,21 +259,24 @@ async def websocket_endpoint(websocket: WebSocket):
|
|
259 |
|
260 |
await websocket.accept()
|
261 |
|
|
|
|
|
262 |
try:
|
|
|
|
|
|
|
263 |
while True:
|
264 |
-
tokenMessageLLM.after_create(lambda now, old: print(f"{old} updated to {now}."))
|
265 |
|
266 |
-
print(
|
|
|
|
|
|
|
|
|
|
|
267 |
|
268 |
-
data = await websocket.receive_text()
|
269 |
-
res = QA(data)
|
270 |
print(res)
|
271 |
|
272 |
except WebSocketDisconnect:
|
273 |
print('disconnect')
|
274 |
except RuntimeError as error:
|
275 |
print(error)
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
259 |
|
260 |
await websocket.accept()
|
261 |
|
262 |
+
print(f'receive')
|
263 |
+
|
264 |
try:
|
265 |
+
prompt = await websocket.receive_text()
|
266 |
+
res = QA(prompt)
|
267 |
+
|
268 |
while True:
|
|
|
269 |
|
270 |
+
print(prompt)
|
271 |
+
|
272 |
+
tokenMessageLLM.after_update(lambda now, old: print(f"{old} updated to {now}."))
|
273 |
+
|
274 |
+
print(f'tokenMessageLLM')
|
275 |
+
|
276 |
|
|
|
|
|
277 |
print(res)
|
278 |
|
279 |
except WebSocketDisconnect:
|
280 |
print('disconnect')
|
281 |
except RuntimeError as error:
|
282 |
print(error)
|
|
|
|
|
|
|
|