feat: Chat page retains the display of the last conversation

This commit is contained in:
wangdan-fit2cloud 2025-02-17 17:14:45 +08:00 committed by GitHub
parent 9249c1756f
commit b917b72fe6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -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()
}
})
}

View File

@ -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()
}
}
})
}