You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the SQLAlchemy data layer with SQLite, in get_all_user_threads(), the returned metadata seems to be a JSON string but it is not ever deserialized.
For me, backend/chainlit/socket.py, line 53 in resume_thread() subsequently fails attempting metadata.copy() triggered by having an implementation of @on_chat_resume.
Interestingly, similar case seems to be correctly handled elsewhere in the same module:
petri
changed the title
Missing JSON deserialization in SQLAlchemy data layer when using SQLite (at least)
Missing JSON deserialization in SQLAlchemy data layer when using SQLite
Nov 27, 2024
Describe the bug
When using the SQLAlchemy data layer with SQLite, in
get_all_user_threads()
, the returnedmetadata
seems to be a JSON string but it is not ever deserialized.chainlit/backend/chainlit/data/sql_alchemy.py
Line 623 in 8e739b3
For me,
backend/chainlit/socket.py
, line 53 inresume_thread()
subsequently fails attemptingmetadata.copy()
triggered by having an implementation of@on_chat_resume
.Interestingly, similar case seems to be correctly handled elsewhere in the same module:
chainlit/backend/chainlit/data/sql_alchemy.py
Lines 126 to 129 in 8e739b3
Given that, I'd go as far as to suggest the whole module should be reviewed; there might be other places where deserialization is missing.
To Reproduce
Try out anything that uses the metadata using SQLAlchemy + SQLite. I tried on_chat_resume which appears to trigger the problematic code.
For what it's worth, I thought SQLAlchemy handled this kind of differences transparently, unless it is being used in a low-level way... ?
The text was updated successfully, but these errors were encountered: