Skip to content

Commit 958bd46

Browse files
feat: Chat page retains the display of the last conversation
1 parent 9249c17 commit 958bd46

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ui/src/views/chat/embed/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ function getChatLog(id: string) {
201201
202202
log.asyncGetChatLogClient(id, page, left_loading).then((res: any) => {
203203
chatLogData.value = res.data.records
204+
paginationConfig.current_page = 1
205+
paginationConfig.total = 0
206+
currentRecordList.value = []
207+
currentChatId.value = chatLogData.value?.[0]?.id || 'new'
208+
if (currentChatId.value !== 'new') {
209+
getChatRecord()
210+
}
204211
})
205212
}
206213

ui/src/views/chat/pc/index.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,16 @@ function getChatLog(id: string, refresh?: boolean) {
270270
log.asyncGetChatLogClient(id, page, left_loading).then((res: any) => {
271271
chatLogData.value = res.data.records
272272
if (refresh) {
273-
currentChatName.value = chatLogData.value?.[0].abstract
273+
currentChatName.value = chatLogData.value?.[0]?.abstract
274+
} else {
275+
paginationConfig.value.current_page = 1
276+
paginationConfig.value.total = 0
277+
currentRecordList.value = []
278+
currentChatId.value = chatLogData.value?.[0]?.id || 'new'
279+
currentChatName.value = chatLogData.value?.[0]?.abstract || t('chat.createChat')
280+
if (currentChatId.value !== 'new') {
281+
getChatRecord()
282+
}
274283
}
275284
})
276285
}

0 commit comments

Comments
 (0)