Quansight / ragna

RAG orchestration framework ⛵️
https://ragna.chat
BSD 3-Clause "New" or "Revised" License
177 stars 22 forks source link

#391 Chat Ordering based upon the order of interaction #445

Closed arjxn-py closed 2 months ago

arjxn-py commented 2 months ago

This PR modifies the LeftSidebar component to display chats in reverse order, showing the newest chats first instead of the oldest. Should fix #391

pmeier commented 2 months ago

@blakerosenthal Could you check if this change is indeed enough?

blakerosenthal commented 2 months ago

This doesn't quite work, unfortunately. self.chats comes indirectly from database.py:get_chats which doesn't guarantee order. There's no timestamp on orm.Chat either otherwise we could sort in get_chats.

Option 1: add a (created_at) timestamp to Chats and then add an order_by to the table. Option 2: dig into the messages and pull out either the first or last message timestamp. I kind of like this option because then the UI could show chats by how recently they were used, not when they were created. This could be accomplished with a last_updated field on the chat table as well.

image

pmeier commented 2 months ago

I'd prefer option 1. by a big margin.

arjxn-py commented 2 months ago

Thanks a lot for confirming on this @blakerosenthal, the ui tests you added were also very helpful to test in #446 🚀 To be honest I also like the latter (option 2) more as I feel it contains more utility for the user.

arjxn-py commented 2 months ago

Hi @blakerosenthal, happy to have your quick look again on this. Thanks 🙂

pmeier commented 2 months ago

I'm ok with limiting the scope of this change to only adapt the order when the page (re-)loaded. But ultimately, we want the ordering change to be dynamic, e.g. if I ask a new question in an old chat, that should automatically move to the top of the list rather than this only happening the next time I load the page. @arjxn-py or @blakerosenthal could one of you open a new issue for this?

arjxn-py commented 2 months ago

could one of you open a new issue for this?

Thanks @pmeier, opened #457 for this, feel free to correct me there if needed.