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' }) },