提交 d47ae269 编写于 作者: DCloud_JSON's avatar DCloud_JSON

1.0.16

上级 a3103637
## 1.0.16(2023-05-26)
- 更新 默认不启用(注释掉)广告组件`uni-ad-rewarded-video`
## 1.0.15(2023-05-26)
- 修复 由1.0.12优化引起的 web-pc端 样式不正确的问题
## 1.0.14(2023-05-25) ## 1.0.14(2023-05-25)
- 修复 报` config is not defined`的问题 - 修复 报` config is not defined`的问题
## 1.0.13(2023-05-24) ## 1.0.13(2023-05-24)
......
...@@ -21,7 +21,11 @@ ...@@ -21,7 +21,11 @@
<view v-if="msgIndex == msgIndexList.length-1 && adpid && msg.insufficientScore"> <view v-if="msgIndex == msgIndexList.length-1 && adpid && msg.insufficientScore">
<uni-ad-rewarded-video :adpid="adpid" @onAdClose="onAdClose"></uni-ad-rewarded-video> <view style="flex-direction: column;color: red;">
<view>默认不启用广告组件(被注释),如需使用,请"去掉注释"</view>
<view>位置:/components/uni-ai-msg/uni-ai-msg.vue 第28行,或全局搜索 uni-ad-rewarded-video</view>
</view>
<!-- <uni-ad-rewarded-video :adpid="adpid" @onAdClose="onAdClose"></uni-ad-rewarded-video> -->
</view> </view>
</view> </view>
<uni-icons v-if="msgIndex == msgIndexList.length-1 && !msg.isAi && msg.state != 100 && msgStateIcon(msg)" <uni-icons v-if="msgIndex == msgIndexList.length-1 && !msg.isAi && msg.state != 100 && msgStateIcon(msg)"
...@@ -279,6 +283,10 @@ ...@@ -279,6 +283,10 @@
align-items: flex-end; align-items: flex-end;
} }
.create_time-box {
margin-top: 15px;
justify-content: center;
}
/* #ifndef VUE3 && APP-PLUS */ /* #ifndef VUE3 && APP-PLUS */
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
}, },
"quickapp" : {}, "quickapp" : {},
"mp-weixin" : { "mp-weixin" : {
"appid" : "wxdcbd74f0961c068d", "appid" : "wx07597007230e3702",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"es6" : false "es6" : false
......
{ {
"id": "uni-ai-chat", "id": "uni-ai-chat",
"name": "uni-ai-chat", "name": "uni-ai-chat",
"version": "1.0.14", "version": "1.0.16",
"description": "基于uni-ai的聊天示例项目,支持流式、支持前文总结,云端一体", "description": "基于uni-ai的聊天示例项目,支持流式、支持前文总结,云端一体",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<text class="noData" v-if="msgLength === 0">没有对话记录</text> <text class="noData" v-if="msgLength === 0">没有对话记录</text>
<scroll-view :scroll-into-view="scrollIntoView" scroll-y="true" class="msg-list" :enable-flex="true"> <scroll-view :scroll-into-view="scrollIntoView" scroll-y="true" class="msg-list" :enable-flex="true">
<uni-ai-msg ref="msg" v-for="(msgIndex,index) in msgLength" :key="index" :msgIndex="index" <uni-ai-msg ref="msg" v-for="(msgIndex,index) in msgLength" :key="index" :msgIndex="index"
:show-cursor="index == msgLength - 1 && msgLength%2 === 0 && sseIndex" :show-cursor="index == msgLength - 1 && msgLength%2 === 0 && sseIndex"></uni-ai-msg>
></uni-ai-msg>
<view class="tip-ai-ing" v-if="msgLength && msgLength%2 !== 0"> <view class="tip-ai-ing" v-if="msgLength && msgLength%2 !== 0">
<text>uni-ai正在思考中...</text> <text>uni-ai正在思考中...</text>
<view v-if="NODE_ENV == 'development' && !enableStream"> <view v-if="NODE_ENV == 'development' && !enableStream">
如需提速,请开通<uni-link class="uni-link" href="https://uniapp.dcloud.net.cn/uniCloud/uni-ai-chat.html" text="[流式响应]"></uni-link> 如需提速,请开通<uni-link class="uni-link" href="https://uniapp.dcloud.net.cn/uniCloud/uni-ai-chat.html"
text="[流式响应]"></uni-link>
</view> </view>
</view> </view>
<view id="last-msg-item"></view> <view id="last-msg-item"></view>
...@@ -49,7 +49,9 @@ ...@@ -49,7 +49,9 @@
// 引入配置文件 // 引入配置文件
import config from '@/config.js'; import config from '@/config.js';
import {msgList} from '@/pages/chat/msgList.js'; import {
msgList
} from '@/pages/chat/msgList.js';
// 获取广告id // 获取广告id
const { const {
...@@ -69,7 +71,7 @@ ...@@ -69,7 +71,7 @@
// 使聊天窗口滚动到指定元素id的值 // 使聊天窗口滚动到指定元素id的值
scrollIntoView: "", scrollIntoView: "",
// 消息长度(个数) // 消息长度(个数)
msgLength:0, msgLength: 0,
// 消息列表数据 // 消息列表数据
msgList: [], msgList: [],
// 输入框的消息内容 // 输入框的消息内容
...@@ -127,17 +129,17 @@ ...@@ -127,17 +129,17 @@
handler(msgList) { handler(msgList) {
let msgLength = msgList.length let msgLength = msgList.length
if(msgLength != this.msgLength){ if (msgLength != this.msgLength) {
this.msgLength = msgLength this.msgLength = msgLength
this.$nextTick(()=>{ this.$nextTick(() => {
this.updateLastMsg(msgList[msgLength - 1]) this.updateLastMsg(msgList[msgLength - 1])
}) })
} }
// 将msgList存储到本地缓存中 // 将msgList存储到本地缓存中
uni.setStorage({ uni.setStorage({
"key":"uni-ai-msg", "key": "uni-ai-msg",
"data":msgList "data": msgList
}) })
}, },
// 深度监听msgList变化 // 深度监听msgList变化
...@@ -175,7 +177,7 @@ ...@@ -175,7 +177,7 @@
let _msgList = uni.getStorageSync('uni-ai-msg') || []; let _msgList = uni.getStorageSync('uni-ai-msg') || [];
if(_msgList.length){ if (_msgList.length) {
msgList.push(..._msgList) msgList.push(..._msgList)
} }
...@@ -553,7 +555,7 @@ ...@@ -553,7 +555,7 @@
.then(res => { .then(res => {
// console.log(111,res); // console.log(111,res);
if (!sseChannel) { if (!sseChannel) {
if(!res.data){ if (!res.data) {
return return
} }
// 更新最后一条消息的状态为100(发送成功) // 更新最后一条消息的状态为100(发送成功)
...@@ -597,7 +599,7 @@ ...@@ -597,7 +599,7 @@
} else { } else {
console.log('用户点击了清空按钮,跳过前一次请求的回调。内容:', res.data.reply); console.log('用户点击了清空按钮,跳过前一次请求的回调。内容:', res.data.reply);
} }
}else{ } else {
// 处理 sseChannel没结束 云函数提前结束的情况 // 处理 sseChannel没结束 云函数提前结束的情况
sseChannel.close() sseChannel.close()
this.sseIndex = 0 this.sseIndex = 0
...@@ -678,7 +680,7 @@ ...@@ -678,7 +680,7 @@
// 将流式响应计数值归零 // 将流式响应计数值归零
this.sseIndex = 0 this.sseIndex = 0
// 将消息列表清空 // 将消息列表清空
this.msgList.splice(0,this.msgLength); this.msgList.splice(0, this.msgLength);
} }
} }
}); });
...@@ -700,6 +702,7 @@ ...@@ -700,6 +702,7 @@
display: flex; display: flex;
box-sizing: border-box; box-sizing: border-box;
} }
/* #endif */ /* #endif */
...@@ -803,6 +806,7 @@ ...@@ -803,6 +806,7 @@
.send::after { .send::after {
display: none; display: none;
} }
/* #endif */ /* #endif */
...@@ -811,6 +815,7 @@ ...@@ -811,6 +815,7 @@
height: 1px; height: 1px;
width: 750rpx; width: 750rpx;
} }
.noData { .noData {
margin-top: 15px; margin-top: 15px;
text-align: center; text-align: center;
...@@ -819,6 +824,7 @@ ...@@ -819,6 +824,7 @@
font-size: 12px; font-size: 12px;
justify-content: center; justify-content: center;
} }
.tip-ai-ing { .tip-ai-ing {
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
...@@ -847,7 +853,7 @@ ...@@ -847,7 +853,7 @@
max-width: 950px; max-width: 950px;
} }
.container, .container
{ {
box-shadow: 0 0 5px #e0e1e7; box-shadow: 0 0 5px #e0e1e7;
margin-top: 44px; margin-top: 44px;
...@@ -894,11 +900,6 @@ ...@@ -894,11 +900,6 @@
width: 100% !important; width: 100% !important;
} }
.create_time-box {
margin-top: 15px;
justify-content: center;
}
.textarea-box, .textarea-box,
.textarea, .textarea,
textarea, textarea,
...@@ -906,7 +907,6 @@ ...@@ -906,7 +907,6 @@
height: 120px; height: 120px;
} }
.container,
.foot-box, .foot-box,
.textarea-box { .textarea-box {
background-color: #FFF; background-color: #FFF;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册