From acf15f83c9dd4f70e6fea3ec82346eaf1bd77b96 Mon Sep 17 00:00:00 2001 From: DCloud__JSON Date: Mon, 3 Jul 2023 17:06:00 +0800 Subject: [PATCH] 1.2.7 --- changelog.md | 2 ++ package.json | 2 +- pages/chat/SliceMsgToLastMsg.js | 2 +- pages/chat/chat.vue | 12 ++++++------ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/changelog.md b/changelog.md index d234532..e5e4fae 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,5 @@ +## 1.2.7(2023-07-03) +- 【重要】修复 部分情况下 客户端未正确带上ai总结的内容的问题 ## 1.2.6(2023-07-03) - 修改错误的`placeholder`提示内容 ## 1.2.5(2023-06-26) diff --git a/package.json b/package.json index 8f675ea..431643f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "id": "uni-ai-chat", "name": "uni-ai-chat", - "version": "1.2.6", + "version": "1.2.7", "description": "基于uni-ai的聊天示例项目,支持流式、支持前文总结,云端一体", "main": "main.js", "scripts": { diff --git a/pages/chat/SliceMsgToLastMsg.js b/pages/chat/SliceMsgToLastMsg.js index acf9ada..4f17985 100644 --- a/pages/chat/SliceMsgToLastMsg.js +++ b/pages/chat/SliceMsgToLastMsg.js @@ -2,7 +2,7 @@ export default class SliceMsgToLastMsg { constructor(arg) { this.$ = arg //分割显示的速度(毫秒) - this.t = 30 + this.t = 70 // 要追加的消息的创建时间 this.msgCreateTime = false // 是否立即结束追加 diff --git a/pages/chat/chat.vue b/pages/chat/chat.vue index 2b3f736..2a54ae3 100644 --- a/pages/chat/chat.vue +++ b/pages/chat/chat.vue @@ -731,21 +731,21 @@ console.log(' 拿到总结',summarize); // 总结的内容是上一轮对话的 // console.log('setSummarize'); - let index = this.msgList.length; - // 如果最后一项是ai就往前退2项,否则退一项(流式响应的时候,回答可能晚于总结) - if(index%2 === 0){ + let index = this.msgList.length - 1; + // 如果最后一项是ai就往前退2项,否则退1项(流式响应的时候,回答可能晚于总结) + if(index%2){ index -= 2 }else{ index -= 1 } // 假如第一次提问就需要总结 - if (index < 0) { - index = 0 + if (index < 1) { + index = 1 } let msg = this.msgList[index] msg.summarize = summarize this.msgList.splice(index, 1, msg) - // console.log('setSummarize this.msgList',this.msgList); + // console.log('setSummarize this.msgList',this.msgList,this.msgList.length-1,index); } if (illegal) { console.error('内容涉及敏感'); -- GitLab