Closed quacrobat closed 6 days ago
PS, i had updated to latest version on local a few days ago. but the hugging face hasn't been updated (unless it does it automatically when i rebuild). they both present the same issue. When i update the local/docker version to latest version, i still see the same issue.
Here's a sketch of what the structure of the structure i see, i hope it makes sense!
Also having this issue — not sure if it's number of messages or chat lengths, but I noticed it kicking in with one of my chats every time it hit 20 messages or so. The collapse seems to happen if I export or fork the chat but not in the original thread. Although what does tend to happen in the original thread (past another length threshold) is #3813, likely related.
I also don't notice any corruption that happens in the actual JSON, say if I export the original chat.
I'm also experiencing the same issue. It seems that if you fork when there are more than 16 messages (user + assistant), the newly forked conversation will be messed up.
I've come up with a pretty consistent way to reproduce:
There would be no problem if you fork at any point before that.
Another thing I found out is that if the original conversation has branches, the original conversation might get corrupted at well. Let's say after I had 8 rounds of conversation, I change the 8th query to another message, then I created a branch with a new response, then the total number of message in this conversation will exceed 16. In this case, if I at any point create a fork, the ORIGINAL conversation will be messed up as well. If the newly created conversation contains more than 16 messages, it too will be messed up.
So here is my summary:
Edit: After further investigation, I found that when a conversation has more than 16 messsages and has any branching going on. When refreshing the page, this conversation will be messed up.
Continuing the conversation at https://github.com/danny-avila/LibreChat/pull/4772#issuecomment-2493833729
After some investigation, I found that the message list is sorted by createdAt
in https://github.com/danny-avila/LibreChat/blob/7d5be6874790655e9060ed93dc67cf7c9a0fad52/api/models/Message.js#L253-L259
But after forking, all the newly created messages will have the createdAt
field updated to the current time (is this intentional? @danny-avila ), so when querying, the ordering of the message list is unpredictable. So in buildTree.ts, the built tree is also incorrect.
My guess is that mongodb only guanrantees the insertion order when qeurying small number of objects, hence the magic number 16.
Fantastic work @xyqyear - and I realize I had a similar bug in a different project due to createdAt in mongodb... @danny-avila hopefully this mean this is a front-end issue only and once fixed the corrupted conversations will appear correctly again?
Fantastic work @xyqyear - and I realize I had a similar bug in a different project due to createdAt in mongodb... @danny-avila hopefully this mean this is a front-end issue only and once fixed the corrupted conversations will appear correctly again?
Unfortunately it's a backend issue. The folding conversations can be fixed, but it would be a lot of overhead to fix the issue retroactively. Maybe I can make a script to fix specific conversations?
What happened?
I had a long conversation saved last week. That conversation had occasional branching where i edited my questions. Never more than a couple of branches wide, max 3 or 4. Now it is showing as if the entire conversation has one message at the trunk, and 42 branches on the same level. When i click on the < and > to navigate between these branches, it actually changes the root message, which is sometimes mine sometimes the LLM's answer!
I tried on both local / running on docker and on hugginface. They're both using the same DB so i guess there is corruption at the DB level. WHICH IS VERY SCARY.
Steps to Reproduce
I noticed this today I tried to find a message in that conversation so searched for a term in the search bar, it listed the relevant messages and the correct conversation. When I clicked on it, I found that the normal tree structure of the conversation had totally collapsed into a single trunk with 42 branches.
What browsers are you seeing the problem on?
Chrome
Relevant log output
Screenshots
Code of Conduct