From 6144dc72b8f8a52cc33a716716b87e1e11533777 Mon Sep 17 00:00:00 2001 From: jinhhanhan <1683105490@qq.com> Date: Fri, 16 Jan 2026 18:00:03 +0800 Subject: [PATCH] =?UTF-8?q?chore:=E9=9D=9E=20h5=20=E5=B9=B3=E5=8F=B0=20:ke?= =?UTF-8?q?y=20=E4=B8=8D=E6=94=AF=E6=8C=81=E8=A1=A8=E8=BE=BE=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages_tool/ai-chat/ai-chat-message.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue index edcf3a8..4978f1b 100644 --- a/pages_tool/ai-chat/ai-chat-message.vue +++ b/pages_tool/ai-chat/ai-chat-message.vue @@ -10,8 +10,7 @@ - + @@ -392,6 +391,19 @@ export default { isFetchingHistory: false } }, + computed: { + // 为每条消息生成兼容小程序的唯一 key + messagesWithKey() { + return this.messages.map((msg, idx) => { + const uniqueId = msg.id || msg.timestamp || idx; + return { + ...msg, + __renderKey: `msg_${uniqueId}_${idx}`, + __index: idx // 保留原始索引,用于判断 first-message 等 + }; + }); + } + }, onShow() { // 优先读取本地缓存的会话 ID const localConvId = this.getConversationIdFromLocal();