From da808b330d7b7a9559d6fb5ebe996bd0c8b471f9 Mon Sep 17 00:00:00 2001 From: ulleo Date: Mon, 24 Aug 2026 16:04:33 +0800 Subject: [PATCH] improve: chat list sort during chat --- frontend/src/views/chat/ChatList.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chat/ChatList.vue b/frontend/src/views/chat/ChatList.vue index f98d7b98..cc34ce09 100644 --- a/frontend/src/views/chat/ChatList.vue +++ b/frontend/src/views/chat/ChatList.vue @@ -7,7 +7,7 @@ import { type Chat, chatApi, ChatInfo } from '@/api/chat.ts' import { computed, reactive, ref } from 'vue' import dayjs from 'dayjs' import { getDate } from '@/utils/utils.ts' -import { groupBy } from 'lodash-es' +import { groupBy, orderBy } from 'lodash-es' import { useI18n } from 'vue-i18n' const props = withDefaults( @@ -48,7 +48,10 @@ function groupByDate(chat: Chat) { } const computedChatGroup = computed(() => { - return groupBy(props.chatList, groupByDate) + return groupBy( + orderBy(props.chatList, [(c: Chat) => c.latest_record_time ?? c.create_time], ['desc']), + groupByDate + ) }) const expandMap = ref({