feat: always show welcome message regardless of history
This commit is contained in:
parent
275a611381
commit
a47be2c3f6
@ -598,6 +598,21 @@ const getHistoryMessages = async (page: number = 1) => {
|
|||||||
// 如果没有历史记录,清空消息列表
|
// 如果没有历史记录,清空消息列表
|
||||||
console.log('没有历史记录')
|
console.log('没有历史记录')
|
||||||
messages.value = []
|
messages.value = []
|
||||||
|
|
||||||
|
// 没有历史记录时,也展示一条开场白信息
|
||||||
|
nextTick(() => {
|
||||||
|
if (quickQuestionsData.value.length > 0) {
|
||||||
|
const welcomeMessage: Message = {
|
||||||
|
role: 'ai',
|
||||||
|
content: '您好!我是物业客服,有什么可以帮助您的吗?',
|
||||||
|
quickQuestions: quickQuestionsData.value,
|
||||||
|
created_at: new Date().toISOString()
|
||||||
|
}
|
||||||
|
messages.value.push(welcomeMessage)
|
||||||
|
console.log('[Customer] 没有历史记录时,展示开场白消息')
|
||||||
|
scrollToBottom()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否应该展示开场白(第一次进入或全部加载完成)
|
// 检查是否应该展示开场白(第一次进入或全部加载完成)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user