From a815e50c231d3272e393f9ae6c7c0b65961b161a Mon Sep 17 00:00:00 2001 From: DCloud__JSON Date: Mon, 19 Jun 2023 14:59:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E4=B8=8D=E5=B8=8C=E6=9C=9B=E5=B8=A6=E4=B8=8A=E2=80=9C=E4=B8=8A?= =?UTF-8?q?=E4=B8=8B=E6=96=87=E2=80=9D=E7=9A=84=E5=AE=9E=E7=8E=B0=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/chat/chat.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pages/chat/chat.vue b/pages/chat/chat.vue index de91fa2..4824f3c 100644 --- a/pages/chat/chat.vue +++ b/pages/chat/chat.vue @@ -519,7 +519,9 @@ let messages = [] // 复制一份,消息列表数据 - let msgs = JSON.parse(JSON.stringify(this.msgList)) + let msgs = JSON.parse(JSON.stringify(this.msgList)) + + // - 获取上下文的代码【start】- // 带总结的消息 index let findIndex = [...msgs].reverse().findIndex(item => item.summarize) // console.log('findIndex', findIndex) @@ -535,7 +537,10 @@ msgs = msgs.splice(-10) } // 过滤涉敏问题 - msgs = msgs.filter(msg => !msg.illegal) + msgs = msgs.filter(msg => !msg.illegal) + // - 获取上下文的代码【end】- + + // 如果:不希望带上上下文;请注释掉 上方:获取上下文的代码【start】-【end】。并添加,代码: msgs = [msgs.pop()] // 根据数据内容设置角色 messages = msgs.map(item => { // 角色默认为用户 -- GitLab