chore:微信小程序正常

This commit is contained in:
2026-09-30 17:02:26 +08:00
parent a72e1b733d
commit e9c8bac60b

View File

@@ -61,7 +61,8 @@
:key="getMessageKey(message, index)" :key="getMessageKey(message, index)"
:id="getMessageKey(message, index)" :id="getMessageKey(message, index)"
class="message-item" 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))">
<!-- 用户消息 (WorkBuddy 风格: 右对齐 + 浅灰气泡 + 头像在右) --> <!-- 用户消息 (WorkBuddy 风格: 右对齐 + 浅灰气泡 + 头像在右) -->
<view v-if="message.role === 'user'" class="user-message"> <view v-if="message.role === 'user'" class="user-message">
@@ -195,8 +196,8 @@
</view> </view>
</view> </view>
<!-- AI消息: 欢迎语(含快捷问题)在输入框聚焦 或 已发送用户消息后整体隐藏 --> <!-- AI消息 -->
<view v-else class="ai-message" v-show="!(message.isWelcome && (inputFocused || hasUserMessage))"> <view v-else class="ai-message">
<!-- PR-CHAT-UI-CONFIG-V3 (2026-09-24): ui_show_assistant_avatar 控制头像显隐; 自定义头像在 aiAvatarUrl computed 优先 --> <!-- PR-CHAT-UI-CONFIG-V3 (2026-09-24): ui_show_assistant_avatar 控制头像显隐; 自定义头像在 aiAvatarUrl computed 优先 -->
<view class="avatar" v-if="chatUiConfig.ui_show_assistant_avatar"> <view class="avatar" v-if="chatUiConfig.ui_show_assistant_avatar">
<!-- 智能客服头像 --> <!-- 智能客服头像 -->
@@ -1742,9 +1743,9 @@ export default {
// 等路径再触发会造成欢迎气泡重复 push; 网络慢时尤其容易) // 等路径再触发会造成欢迎气泡重复 push; 网络慢时尤其容易)
if (this._welcomeLoading) return if (this._welcomeLoading) return
this._welcomeLoading = true this._welcomeLoading = true
// 仅全新会话才需要欢迎语 // 只要当前没有消息(或历史为空)就展示欢迎语;已有消息/历史时会话 ID 不影响
if (this.currentConversationId) { if (this.messages.length > 0) {
console.log('[AI Chat] 已有会话,跳过欢迎语') console.log('[AI Chat] 已有消息,跳过欢迎语')
this._welcomeLoading = false this._welcomeLoading = false
return return
} }
@@ -1792,8 +1793,8 @@ export default {
} }
} }
// 3. 插入欢迎语(再次检查是否仍是全新会话) // 3. 插入欢迎语:只要当前消息列表仍为空就展示(兼容真机残留会话 ID 但无历史消息)
if (!this.currentConversationId && this.messages.length === 0) { if (this.messages.length === 0) {
// PR-WELCOME-QUICK-BATCH: 所有快捷问题先存起来, 前端每 4 个一批轮播 // PR-WELCOME-QUICK-BATCH: 所有快捷问题先存起来, 前端每 4 个一批轮播
const allQuickQuestions = this.normalizeQuickQuestions(welcomeInfo && welcomeInfo.quick_questions) const allQuickQuestions = this.normalizeQuickQuestions(welcomeInfo && welcomeInfo.quick_questions)
const welcomeMsg = { const welcomeMsg = {
@@ -2829,6 +2830,9 @@ async onNewChat() {
} }
} }
this.clearMessages() this.clearMessages()
// 新对话后重新加载欢迎语
this._welcomeLoading = false
this._loadWelcomeMessage()
uni.showToast({ title: '已开始新对话', icon: 'success' }) uni.showToast({ title: '已开始新对话', icon: 'success' })
}, },