Skip to content

Commit

Permalink
Quansight#391 Sort chat buttons in left sidebar by latest message tim…
Browse files Browse the repository at this point in the history
…estamp
  • Loading branch information
arjxn-py committed Jul 10, 2024
1 parent 00d9c02 commit 24f7b3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ragna/deploy/_ui/left_sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ def refresh(self):

@pn.depends("refresh_counter", "chats", "current_chat_id", on_init=True)
def __panel__(self):
self.chats.sort(key=lambda chat: chat['messages'][-1]['timestamp'], reverse=True)

self.chat_buttons = []
for chat in reversed(self.chats):
for chat in self.chats:
button = pn.widgets.Button(
name=chat["metadata"]["name"],
css_classes=["chat_button"],
Expand Down

0 comments on commit 24f7b3f

Please sign in to comment.