New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added toggle button to sort chats by title, creation date, or recently updated. #1932
Conversation
Changed design to occupy less space on the sidebar. Update to request open-webui#1392
There is this possibility of the button inside the user menu, which takes up less space. In this case, you have to click again on the user button to close the menu, which can be frustrating until you realize it.
I have pushed the change in a second commit 7593687 following the first, choose whichever you prefer. Also, there is this in line 445 where swapping
It makes sense keep it as it is, I think, returning the oldest at the top, as opposed to sorting by updated_at, where the oldest are at the bottom, but it could be the other way. It can be unintuitive, because "recent" can be applied for both cases, but then it's a matter of labels, and not introducing another button to reverse. Just some thoughts. |
suggestion: Should the button be placed next to the search button? That might make it easer for users to know what's it going to sort the data on. Having the option above search might not be the ideal place. |
I agree, it's a good place. What happens there is there's no space for a label, so the icon must be clear enough by itself to tell which sorting is being applied, either by title / created_at / updated_at. There could be a tooltip on hovering the icon to clarify, but that would not work on touch devices. Looking through heroicons I couldn't find icons that would represent clearly enough what they do. Good candidates are That space is usually reserved for a button to erase the search text, but there is no such thing at the moment. If there was, it would have to coexist with the sort button, because you might want to toggle the order while you are filtering by search. Another option, could be an icon of three dots at the right of the search box, that would open a dropdown with the sorting choices (or other things that could be done with the search). But that is more involved, and needs more thought. I might give it another go, if I find more adequate icons. |
True, those are valid points. Could we Show a dropdown upon clicking the button (just the icon) and the dropdown shows the icon and corresponding text? Another approach I think could be, we just have arrow down and arrow up and we don't sort by title in this version. Future functionality |
I'll refactor this personally in a bit! |
Hey @tjbck, happy to contribute :) In response to @anuraagdjain, here is one way the button could be placed next to the search box, but it looks a bit off: As you can see, the tooltip disappears when you click, it's finnicky. There might be some way to modify the Tooltip component and make it stay visible between clicks, or even triggered by click, and fade out after some duration, which would make this work for touch, but I haven't tried that. There is also the issue of the space taken to align with the icon of new chat above. The padding would need some more adjusting, but still, I am not sure it looks/feels right. I haven't pushed this, just giving observations. |
I like the sort button next to the search bar personally the most |
Also removed right padding from input, to so text reaches flush with the icon. Otherwise, there is a lot of space, but this might be preference.
Ok, I adjusted the padding and commited this last version: I changed the labels to "Sort by Update" "Sort by Creation" and "Sort Alphabetically", but it could be "Sort by Updated" or "Sort by Recent", and "Sort by Creation Date" or "Sort by Created", or something else. The code has some mixed tabs and spaces that can be improved, but I don't want to push more commits and make it confusing. |
One more thing about the icon in searchbox. With the initial sorting by recent, the icon is a If the initial sorting is changed to alphabetical, for which the icon is now Comparing to ChatGPT, they segment the list by time slices, which could be introduced as another mode of sorting. That could be done, either, inserting elements on to the list to act as headers, or, wrapping sub-lists in a list of time-slices. Probably inserting elements into the list is easiest, with least code changes. I may look into it, if there is interest. Edit: After testing it out a bit, the clock is not that unintuitive, it would be okay as the starting choice. |
The aria label was static, now it's the same as the tooltip. Reordered enum to match with initial value (equal behaviour).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this last commit, I changed the enum order, and said it is equal, but technically it's not.
If the starting choice is Updated, it feels more natural when the next choice is the other time-based order.
But there isn't much difference, really.
Edit: I don't know why this comment is blue. If I have triggered some specific attention by doing a code review, I didn't mean to. It's just a comment, related to the commit.
Thanks for the PR but this feature doesn't seem to work nicely with time range grouping feature recently added to our dev branch, so I'll be closing this for now. Hopefully I'll get back to this later soon. I appreciate the effort you put in! |
Pull Request Checklist
Description
I want to be able to sort chats alphabetically.
I copied the changes from my local repo to this fork directly on github web.
It should be fine, but please test. Feel free to correct indentation, if anything went off.
The order of toggle is determined by an enum, so it can be changed easily.
In terms of design, I tried other icons, placements, words, with icon to the right, with reverse button...
This was the most simple and clean solution I found. Open to suggestion.
Also works while list is filtered by search.
3 strings for i18n.
Changelog
Added