feat: append welcome message after history records
This commit is contained in:
parent
fc46be8385
commit
275a611381
@ -580,7 +580,7 @@ const getHistoryMessages = async (page: number = 1) => {
|
|||||||
messages.value = historyMessages
|
messages.value = historyMessages
|
||||||
console.log('第一页历史记录已加载,总共', historyMessages.length, '条消息')
|
console.log('第一页历史记录已加载,总共', historyMessages.length, '条消息')
|
||||||
|
|
||||||
// 在有历史记录的情况下,在最前方插入一条新的开场白信息
|
// 在有历史记录的情况下,在历史数据后面push一条新的开场白信息
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (quickQuestionsData.value.length > 0) {
|
if (quickQuestionsData.value.length > 0) {
|
||||||
const welcomeMessage: Message = {
|
const welcomeMessage: Message = {
|
||||||
@ -589,8 +589,9 @@ const getHistoryMessages = async (page: number = 1) => {
|
|||||||
quickQuestions: quickQuestionsData.value,
|
quickQuestions: quickQuestionsData.value,
|
||||||
created_at: new Date().toISOString()
|
created_at: new Date().toISOString()
|
||||||
}
|
}
|
||||||
messages.value.unshift(welcomeMessage)
|
messages.value.push(welcomeMessage)
|
||||||
console.log('[Customer] 在有历史记录时,在最前方插入新开场白消息')
|
console.log('[Customer] 在有历史记录时,在历史数据后面push新开场白消息')
|
||||||
|
scrollToBottom()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user