From b917b72fe650252b760b825a6e197bd160f1d9e9 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud <79562285+wangdan-fit2cloud@users.noreply.github.com> Date: Mon, 17 Feb 2025 17:14:45 +0800 Subject: [PATCH] feat: Chat page retains the display of the last conversation --- ui/src/views/chat/embed/index.vue | 7 +++++++ ui/src/views/chat/pc/index.vue | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ui/src/views/chat/embed/index.vue b/ui/src/views/chat/embed/index.vue index 7e67c446f..e644f9937 100644 --- a/ui/src/views/chat/embed/index.vue +++ b/ui/src/views/chat/embed/index.vue @@ -201,6 +201,13 @@ function getChatLog(id: string) { log.asyncGetChatLogClient(id, page, left_loading).then((res: any) => { chatLogData.value = res.data.records + paginationConfig.current_page = 1 + paginationConfig.total = 0 + currentRecordList.value = [] + currentChatId.value = chatLogData.value?.[0]?.id || 'new' + if (currentChatId.value !== 'new') { + getChatRecord() + } }) } diff --git a/ui/src/views/chat/pc/index.vue b/ui/src/views/chat/pc/index.vue index cdeefbc39..ba4338ed1 100644 --- a/ui/src/views/chat/pc/index.vue +++ b/ui/src/views/chat/pc/index.vue @@ -270,7 +270,16 @@ function getChatLog(id: string, refresh?: boolean) { log.asyncGetChatLogClient(id, page, left_loading).then((res: any) => { chatLogData.value = res.data.records if (refresh) { - currentChatName.value = chatLogData.value?.[0].abstract + currentChatName.value = chatLogData.value?.[0]?.abstract + } else { + paginationConfig.value.current_page = 1 + paginationConfig.value.total = 0 + currentRecordList.value = [] + currentChatId.value = chatLogData.value?.[0]?.id || 'new' + currentChatName.value = chatLogData.value?.[0]?.abstract || t('chat.createChat') + if (currentChatId.value !== 'new') { + getChatRecord() + } } }) }