diff --git a/changelog.md b/changelog.md index 4860ea13077e8962cdb9a3aca1289e55c2899ebe..b57a727bf311aefb6987a66c7d2875d0e6f3de78 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,5 @@ +## 1.0.7(2023-05-15) +- 修复 uni-ai默认服务商,流式响应模式,部分情况下:AI回复的内容包含的代码 没有以代码风格显示的问题 ## 1.0.6(2023-05-12) - 修复 流式响应模式,AI回答内容在开头不涉及敏感,后续内容涉及敏感的场景 卡住会话的问题 ## 1.0.5(2023-05-11) diff --git a/package.json b/package.json index 3331ac7b74cafe38fab48584d4f1cf97ee10b71d..d9a60c04c25fe1ea60cdb9b1e26906b8561ce167 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "id": "uni-ai-chat", "name": "uni-ai-chat", - "version": "1.0.6", + "version": "1.0.7", "description": "基于uni-ai的聊天示例项目,支持流式、支持前文总结,云端一体", "main": "main.js", "scripts": { diff --git a/uniCloud-aliyun/cloudfunctions/uni-ai-chat/index.obj.js b/uniCloud-aliyun/cloudfunctions/uni-ai-chat/index.obj.js index 200ed2632f371cfc0d4252851e8128ec367b43d1..c1f6839d36b7a4c336eaf2f9d9a34fb408ae5f1e 100644 --- a/uniCloud-aliyun/cloudfunctions/uni-ai-chat/index.obj.js +++ b/uniCloud-aliyun/cloudfunctions/uni-ai-chat/index.obj.js @@ -248,7 +248,7 @@ module.exports = { // 如果存在sseChannel if (sseChannel) { - let reply = "" + let reply = "" return new Promise((resolve, reject) => { // 反序列化sseChannel const channel = uniCloud.deserializeSSEChannel(sseChannel) @@ -263,8 +263,11 @@ module.exports = { }else{ // 按行返回 res.on('line', async (line) => { - await channel.write(reply? ("\n\n " + line) : line) + if(reply.length){ + line = " \n\n " + line + } reply += line + await channel.write(line) // console.log('---line----', line) }) }