🐛 fix(manager.py): remove unnecessary exception handling and logging for JSON decoding error

🐛 fix(manager.py): fix condition for clearing chat history to only clear if "clear_history" key is present and its value is truthy
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-10-05 17:39:56 -03:00 committed by anovazzi1
commit aec14bd250

View file

@ -204,11 +204,9 @@ class ChatService(Service):
json_payload = await websocket.receive_json()
try:
payload = orjson.loads(json_payload)
# except TypeError or JSONDecodeError how?
except Exception as exc:
logger.error(f"Error decoding JSON: {exc}")
payload = json_payload
if "clear_history" in payload:
if "clear_history" in payload and payload["clear_history"]:
self.chat_history.history[client_id] = []
continue