first update

This commit is contained in:
2024-12-30 17:01:16 +08:00
parent 728c0a0ede
commit 6e8b0a7f15
82 changed files with 11379 additions and 2 deletions

20
backend/testchat.py Normal file
View File

@@ -0,0 +1,20 @@
from websockets.sync.client import connect as ws_connect
uri = "ws://0.0.0.0:8765"
with ws_connect(uri) as websocket:
print(f" - Connected to server on {uri}", flush=True)
print(" - Sending message to server.", flush=True)
# websocket.send("2+2=?")
websocket.send("Check out the weather in Paris and write a poem about it.")
while True:
message = websocket.recv()
message = message.decode("utf-8") if isinstance(message, bytes) else message
print(message, end="", flush=True)
if "TERMINATE" in message:
print()
print(" - Received TERMINATE message. Exiting.", flush=True)
break