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