🐛 fix(manager.py): catch all exceptions instead of just TypeError when loading JSON payload to improve error handling and prevent crashes

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-24 21:10:34 -03:00
commit 9fb1a26277

View file

@ -187,7 +187,7 @@ class ChatManager:
json_payload = await websocket.receive_json()
try:
payload = orjson.loads(json_payload)
except TypeError:
except Exception:
payload = json_payload
if "clear_history" in payload:
self.chat_history.history[client_id] = []