-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
feat: Sort conversations by updated_at desc #7348
Conversation
I think sorting by creation time is reasonable because it ensures the relative order of items in the list remains unchanged. Do you have a more compelling argument for sorting by update time? |
Of course, sorting by creation time can ensure that the relative order remains unchanged, but in most conversational applications such as GPT, WeChat, Telegram, etc., conversations are always sorted by the latest conversation messages. My optimization reasons are as follows:
|
I think it would be great to support both options. How about we add a |
+1 |
Of course, the code I have submitted has already solved the two issues mentioned above.And it has been tested and the results are correct
|
Hi @KinWang130! Apologies for the lack of clarity earlier. We would like to support the option to specify the sorting method in the web service API. Instead of directly changing the current sorting method, we aim to allow users to choose their preferred sorting method by adding a button in the frontend. Would you be willing to implement this feature? |
…rameter values: 'creatd_at', '- creatd_at', 'updated_at', '- updated_at'
I am honored to assist you in implementing this feature. My newly submitted code now supports sort_by parameter sorting, including web and API interfaces. The parameter examples are as follows: |
…rameter values: 'creatd_at', '- creatd_at', 'updated_at', '- updated_at'
@KinWang130 Thank you very much for your contribution! We plan to add sorting options on the logs page and use the default order on the chat page. Due to the need for design and front-end development, the merging of this PR might be slightly delayed. Additionally, please check the CI errors. |
…rameter values: 'creatd_at', '- creatd_at', 'updated_at', '- updated_at'
You can run |
@laipz8200 |
…rameter values: 'creatd_at', '- creatd_at', 'updated_at', '- updated_at'
OK,Thanks |
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.
…chat-conversations`.
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.
Thanks for your contribution!
Co-authored-by: wangpj <[email protected]> Co-authored-by: JzoNg <[email protected]> Co-authored-by: -LAN- <[email protected]>
Co-authored-by: wangpj <[email protected]> Co-authored-by: JzoNg <[email protected]> Co-authored-by: -LAN- <[email protected]>
Checklist:
Important
Please review the checklist below before submitting your pull request.
dev/pr
(backend) andcd web && npx lint-staged
(frontend) to appease the lint godsDescription
In the process of using dify for conversations, the historical conversation records are always sorted in descending order according to the time of session creation. Normally, they should be sorted according to the latest time of conversation messages.
My optimization is to modify the updated_at of the conversation during the conversation, and sort the conversation list in descending order based on the updated_at. This way, users can see the latest list of session messages.
Fixes #7338
Type of Change
Testing Instructions
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration