mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-08 15:22:39 +02:00
update the chat state version with messages
This commit is contained in:
parent
13342eb823
commit
cc3e04031e
2 changed files with 44 additions and 27 deletions
|
|
@ -259,9 +259,10 @@ async def update_chat(
|
|||
db_chat = await read_chat(chat_id, session, user)
|
||||
update_data = chat_update.model_dump(exclude_unset=True)
|
||||
for key, value in update_data.items():
|
||||
if key == "messages":
|
||||
db_chat.state_version = len(update_data["messages"])
|
||||
setattr(db_chat, key, value)
|
||||
# Increment state_version when chat is modified
|
||||
db_chat.state_version = (db_chat.state_version or 0) + 1
|
||||
|
||||
await session.commit()
|
||||
await session.refresh(db_chat)
|
||||
return db_chat
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue