🐛 fix(manager.py): change try-except block to if-elif block to improve code readability and maintainability
This commit is contained in:
parent
df8dd44a16
commit
57b9ab6843
1 changed files with 2 additions and 2 deletions
|
|
@ -202,9 +202,9 @@ class ChatService(Service):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
json_payload = await websocket.receive_json()
|
json_payload = await websocket.receive_json()
|
||||||
try:
|
if isinstance(json_payload, str):
|
||||||
payload = orjson.loads(json_payload)
|
payload = orjson.loads(json_payload)
|
||||||
except Exception as exc:
|
elif isinstance(json_payload, dict):
|
||||||
payload = json_payload
|
payload = json_payload
|
||||||
if "clear_history" in payload and payload["clear_history"]:
|
if "clear_history" in payload and payload["clear_history"]:
|
||||||
self.chat_history.history[client_id] = []
|
self.chat_history.history[client_id] = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue