agnaistic / agnai

AI Agnostic (Multi-user and Multi-bot) Chat with Fictional Characters. Designed with scale in mind.
https://agnai.chat
GNU Affero General Public License v3.0
535 stars 107 forks source link

BUG Imported chat messages are inserted backwards #97

Closed kakhulu31 closed 1 year ago

kakhulu31 commented 1 year ago
  1. Import chat
  2. Test using oai or cbt
  3. Pic pic
khanonnie commented 1 year ago

I think this happened when @sceuick merged their Agnaistic implementation with my TavernAI one. Looks like we lost the timestamp property on imported log lines, which I had assumed was necessary since the database sorts chat messages chronologically. Without the timestamp, all imported messages get the same createdAt time (visible in the screenshot) and presumably the tiebreaker becomes (I guess?) reverse database insert order.

Might be possible to quickly fix this by adding .reverse() to the Tavern import parser, but re-adding timestamp might be preferable since database insert order is a bit of an opaque way for them to sort (if that is indeed what's happening).

sceuick commented 1 year ago

I'll get this all fixed up.

khanonnie commented 1 year ago

Actually they're sorting in the correct order in the chat UI but not when building the prompt, huh... 🤔

sceuick commented 1 year ago

Might be due to the timestamps all being the same. Need to constantly increment it most likely.

sceuick commented 1 year ago

Pushed some fixes for this. Let me know how they go.

khanonnie commented 1 year ago

Pushed some fixes for this. Let me know how they go.

Works for logged-in users 👍 needs the same fix for localstorage mode

khanonnie commented 1 year ago

Opened https://github.com/luminai-companion/agn-ai/pull/98 for the above