Spaces:
Paused
Paused
Daniel Marques
commited on
Commit
•
fac2b5c
1
Parent(s):
194045e
feat: add backend
Browse files
main.py
CHANGED
@@ -37,10 +37,11 @@ class Delete(BaseModel):
|
|
37 |
websocket_state = None
|
38 |
|
39 |
class MyCustomSyncHandler(AsyncCallbackHandler):
|
40 |
-
|
41 |
print(f"{websocket_state}")
|
42 |
|
43 |
-
|
|
|
44 |
|
45 |
print(f"token: {token}")
|
46 |
|
|
|
37 |
websocket_state = None
|
38 |
|
39 |
class MyCustomSyncHandler(AsyncCallbackHandler):
|
40 |
+
def on_llm_new_token(self, token: str, **kwargs) -> None:
|
41 |
print(f"{websocket_state}")
|
42 |
|
43 |
+
asyncio.sleep(1.5)
|
44 |
+
websocket_state.send_text(f"token: {token}")
|
45 |
|
46 |
print(f"token: {token}")
|
47 |
|