Refresh the conversation from the db in the websocket flow

This commit is contained in:
sabaimran 2024-05-31 16:15:56 +05:30
parent fd07abbfc8
commit 2667ef4544

View file

@ -487,6 +487,10 @@ async def websocket_endpoint(
if conversation:
await sync_to_async(conversation.refresh_from_db)(fields=["conversation_log"])
q = await websocket.receive_text()
# Refresh these because the connection to the database might have been closed
await conversation.arefresh_from_db()
except WebSocketDisconnect:
logger.debug(f"User {user} disconnected web socket")
break