diff --git a/changelog.md b/changelog.md index d234532fdc80df9154ae559cd5dede9d6dc53045..e5e4faecaa4fa802e14c432cd1ad597ed4d6a9c3 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 8f675ea0b70d6a3791719150414c27e5548f3f6d..431643f915cf6ab00831b59a299726391c6a5256 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 acf9adae083faa5df72f2f60f2729bc6aef27ae1..4f17985ace8817e888e5661daa45dead02dccf9e 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 2b3f736d9384019f23a4d7fc0916519a24b94dc8..2a54ae3901b2882311a60829986aeedfd4ee6c1d 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('内容涉及敏感');