From e9c8bac60b176afcf350c434479368da53362df7 Mon Sep 17 00:00:00 2001
From: jing <1683105490@qq.com>
Date: Wed, 30 Sep 2026 17:02:26 +0800
Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9A=E5=BE=AE=E4=BF=A1=E5=B0=8F?=
=?UTF-8?q?=E7=A8=8B=E5=BA=8F=E6=AD=A3=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages_tool/ai-chat/ai-chat-message.vue | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue
index 15a942b..16ee109 100644
--- a/pages_tool/ai-chat/ai-chat-message.vue
+++ b/pages_tool/ai-chat/ai-chat-message.vue
@@ -61,7 +61,8 @@
:key="getMessageKey(message, index)"
:id="getMessageKey(message, index)"
class="message-item"
- :class="[message.role, { 'first-message': index === 0, 'is-welcome': message.isWelcome, 'search-current': showSearchBar && searchResultFilteredIndex === index, 'search-flash': showSearchBar && searchFlashAnimatingIndex === index }]">
+ :class="[message.role, { 'first-message': index === 0, 'is-welcome': message.isWelcome, 'search-current': showSearchBar && searchResultFilteredIndex === index, 'search-flash': showSearchBar && searchFlashAnimatingIndex === index }]"
+ v-if="!(message.isWelcome && (inputFocused || hasUserMessage))">
@@ -195,8 +196,8 @@
-
-
+
+
@@ -1742,9 +1743,9 @@ export default {
// 等路径再触发会造成欢迎气泡重复 push; 网络慢时尤其容易)
if (this._welcomeLoading) return
this._welcomeLoading = true
- // 仅全新会话才需要欢迎语
- if (this.currentConversationId) {
- console.log('[AI Chat] 已有会话,跳过欢迎语')
+ // 只要当前没有消息(或历史为空)就展示欢迎语;已有消息/历史时会话 ID 不影响
+ if (this.messages.length > 0) {
+ console.log('[AI Chat] 已有消息,跳过欢迎语')
this._welcomeLoading = false
return
}
@@ -1792,8 +1793,8 @@ export default {
}
}
- // 3. 插入欢迎语(再次检查是否仍是全新会话)
- if (!this.currentConversationId && this.messages.length === 0) {
+ // 3. 插入欢迎语:只要当前消息列表仍为空就展示(兼容真机残留会话 ID 但无历史消息)
+ if (this.messages.length === 0) {
// PR-WELCOME-QUICK-BATCH: 所有快捷问题先存起来, 前端每 4 个一批轮播
const allQuickQuestions = this.normalizeQuickQuestions(welcomeInfo && welcomeInfo.quick_questions)
const welcomeMsg = {
@@ -2829,6 +2830,9 @@ async onNewChat() {
}
}
this.clearMessages()
+ // 新对话后重新加载欢迎语
+ this._welcomeLoading = false
+ this._loadWelcomeMessage()
uni.showToast({ title: '已开始新对话', icon: 'success' })
},