diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue index f34ce7a..8096120 100644 --- a/pages_tool/ai-chat/ai-chat-message.vue +++ b/pages_tool/ai-chat/ai-chat-message.vue @@ -1779,6 +1779,8 @@ export default { // 3. 插入欢迎语(再次检查是否仍是全新会话) if (!this.currentConversationId && this.messages.length === 0) { + // PR-WELCOME-QUICK-BATCH: 所有快捷问题先存起来, 前端每 4 个一批轮播 + const allQuickQuestions = this.normalizeQuickQuestions(welcomeInfo && welcomeInfo.quick_questions) const welcomeMsg = { id: ++this.messageId, role: 'ai', @@ -1789,7 +1791,10 @@ export default { // PR-WELCOME-QUICK-CHIPS (2026-09-19): 欢迎语配套快捷问题 (chips) // 后端可存 string[] 或 {id,text}[] ,前端统一归一化为 string[] // message.quickQuestions 数组非空 → 模板渲染 chips;点击调 onQuickQuestionClick - quickQuestions: this.normalizeQuickQuestions(welcomeInfo && welcomeInfo.quick_questions), + // PR-WELCOME-QUICK-BATCH: 每 4 个一批展示, 点击换一换循环切换 + quickQuestions: (allQuickQuestions || []).slice(0, 4), + allQuickQuestions: allQuickQuestions || [], + _qqBatchIndex: 0, // PR-WELCOME-HIDE-AFTER-SEND: 标记这是欢迎语消息, 发送第一条用户消息后永久隐藏 isWelcome: true } @@ -3764,13 +3769,23 @@ _handleStreamError(msg) { } catch (e) { /* noop */ } }, - // 欢迎语"换一换": 移除当前欢迎语并重新加载(刷新快捷问题) + // 欢迎语"换一换": 快捷问题每 4 个一批, 点击后切换到下一批, 末尾循环回第一批 onAiActionRefreshWelcome(message) { try { - const idx = this.messages.findIndex(m => m && m.id === message.id) - if (idx !== -1) this.messages.splice(idx, 1) - this._welcomeLoading = false - this._loadWelcomeMessage() + const all = message.allQuickQuestions || [] + if (!all.length) { + uni.showToast({ title: '暂无更多问题', icon: 'none' }) + return + } + const batchSize = 4 + const total = all.length + const batchCount = Math.ceil(total / batchSize) || 1 + const current = message._qqBatchIndex || 0 + const next = (current + 1) % batchCount + const start = next * batchSize + const end = Math.min(start + batchSize, total) + this.$set(message, '_qqBatchIndex', next) + this.$set(message, 'quickQuestions', all.slice(start, end)) } catch (e) { /* noop */ } },