| | |
| | | <image src="/static/question/copy.png" mode=""></image> |
| | | </view> |
| | | </view> |
| | | <!-- |
| | | <!-- |
| | | <view class="function-right"> |
| | | <u-icon name="thumb-up-fill" @click='clickLikes(item)' v-if="item.isLike" |
| | | color="#2468F2" size="40"></u-icon> |
| | |
| | | color="#2468F2" size="40"></u-icon> |
| | | <u-icon name="thumb-down" @click="clickDislikes(item)" v-else color="#98a1b2" |
| | | size="40"></u-icon> |
| | | </view> |
| | | </view> |
| | | --> |
| | | </view> |
| | | </view> |
| | |
| | | <view v-else class="tips"> |
| | | 我是财政AI助手,很高兴见到你!我可以回答项目文档中的各种问题,输入问题快来体验吧! |
| | | </view> |
| | | |
| | | |
| | | <audio id="audio" src=""></audio> |
| | | <view class="btmbox" :class="{'isOn':showKnow}"> |
| | | <!-- <view v-if="!voiceFlg" class="know-btn" :class="{'active-btn':showKnow}" @click="showKnow=true"> |
| | |
| | | this.appId = options.id || 1 |
| | | this.userId = options.userId || 1 |
| | | // this.toCheck(this.appId) |
| | | console.log(options) |
| | | if(options.knowId) { |
| | | this.knowIds = options.knowId.split(',') |
| | | } |
| | |
| | | let res = await checkAppScope({ |
| | | appId: e |
| | | }) |
| | | console.log(res, '验证'); |
| | | if (res.data) { |
| | | this.openRecord(); |
| | | this.getDetails() |
| | |
| | | pageSize: 10, |
| | | pageNum: 1 |
| | | }) |
| | | console.log(res); |
| | | this.talkList = res.rows; |
| | | }, |
| | | toBack() { |
| | |
| | | this.voicePageY = 0 |
| | | this.voiceText = '松开 发送' |
| | | this.startRec() |
| | | console.log('touchstartVoice', this.voicePageY) |
| | | }, |
| | | // 搜索知识库 |
| | | toSearch() { |
| | |
| | | }, |
| | | // 滑动触发 |
| | | touchmoveVoice(e) { |
| | | // console.log(e.changedTouches[0]) |
| | | if (!this.voicePageY) { |
| | | this.voicePageY = (e.changedTouches[0].pageY).toFixed(2) |
| | | } |
| | |
| | | // 松开触发 |
| | | touchendVoice() { |
| | | this.stopRec(this.voiceStop); //录音结束 |
| | | console.log('松开触发') |
| | | // console.log('松开触发') |
| | | }, |
| | | // 中止回答 |
| | | async isSuspend() { |
| | |
| | | // 打断触发 |
| | | touchcancelVoice() { |
| | | this.stopRec(this.voiceStop); //录音结束 |
| | | console.log('打断触发') |
| | | // console.log('打断触发') |
| | | }, |
| | | async tiWen() { |
| | | if (this.$u.test.isEmpty(this.msg) && this.$u.test.isEmpty(this.recMsg)) { |
| | |
| | | const reader = response.body.getReader(); |
| | | if (this.suspend) { |
| | | reader.cancel().then(() => { |
| | | console.log('流式响应已取消'); |
| | | if (controller) { |
| | | controller.abort(); |
| | | console.log('中止fetch请求'); |
| | | } |
| | | }) |
| | | return |
| | |
| | | let docIds = null |
| | | let isGetId = false |
| | | let isThink = false |
| | | let count = 0 |
| | | while (result) { |
| | | count++ |
| | | if (this.suspend) break |
| | | // done表示流是否已经完成读取 value包含读取到的数据块 |
| | | const { |
| | |
| | | let asIdx = this.getContainedIdx(value, ansCode) |
| | | if (asIdx !== -1) { |
| | | isThink = false |
| | | curMsg.thinkLog += textDecoder.decode(value.slice(0, asIdx)) |
| | | curMsg.thinkLog += textDecoder.decode(value.slice(thkCode.length, asIdx)) |
| | | dataArr = new Uint8Array([...value.slice(asIdx)]) |
| | | } else { |
| | | if(thkIdx===0){ |
| | |
| | | // 检查数据数组中是否包含值为10的元素,以确定是否需要获取文档ID |
| | | isGetId = dataArr.includes(10) |
| | | } |
| | | // dataArr = new Uint8Array([...dataArr, ...value]) |
| | | // isGetId = dataArr.includes(10) |
| | | } |
| | | if (count === 1) { |
| | | const idx = dataArr.indexOf(10) |
| | | // 将数据数组从索引位置+1开始的部分与当前值合并,并解码为字符串 |
| | | curMsg.aiLog = textDecoder.decode(dataArr.slice(idx + 1)) |
| | | } |
| | | curMsg.debug = 0 |
| | | this.intoView = ""; |
| | | this.$nextTick(() => { |
| | |
| | | this.msgList[this.msgList.length - 1].isPlay = 0 |
| | | this.resetRec() |
| | | } catch (err) { |
| | | console.log(err); |
| | | if (this.msgList[this.msgList.length - 1].aiLog === '' || !this.msgList[this.msgList.length - 1] |
| | | .isEnd) { |
| | | this.msgList.pop() |