improvement: 免责信息提示

main
lizhichao 9 months ago
parent 86037a4601
commit 7f4434220e
  1. 35
      components/v-voice.vue
  2. 79
      pages/index/detail.vue
  3. 26
      pages/knowledge/index.vue
  4. BIN
      pages/knowledge/warning.png

@ -1,6 +1,7 @@
<template>
<view class="input-content-com" :class="pointDown ? 'input-content-com-bg': ''" :textInfo="textInfo"
:change:textInfo="renderjs.getTextInfo" :taskId="taskId" :change:taskId="renderjs.getTaskId">
:change:textInfo="renderjs.getTextInfo" :taskId="taskId" :change:taskId="renderjs.getTaskId" :params="params"
:change:params="renderjs.getParams">
<view class="voice-content" v-if="pointDown">
<template v-if="speech">
<view class="voice-text font-family-SM">
@ -41,9 +42,10 @@
@touchcancel="handleCancel">
{{pointDown ? '松开 结束' : '按住 说话'}}
</view>
<uni-icons v-if="showUpload &&!inputValue" class="uni-icon" type="plus" size="30"
<uni-icons v-if=" showUpload &&!inputValue" class="uni-icon" type="plus" size="30"
@click="isExpanded = !isExpanded" :disabled="disabled"></uni-icons>
<button v-else class="sendBtn" @click="setTextInfo" :disabled="disabled">发送</button>
<button v-if=" !showUpload &&inputValue" class="sendBtn" @click="setTextInfo"
:disabled="disabled">发送</button>
</view>
<!-- <view style='font-size: 10rpx;width: 100%;text-align: center;color: #fff;position: absolute;bottom: 0%;transform:scale(0.7)'>
内容由AI大模型生成请仔细甄别</view> -->
@ -84,6 +86,10 @@
type: String,
default: ''
},
params: {
type: Object,
default: {}
},
},
computed: {
inputValue: {
@ -268,13 +274,17 @@
} from "@microsoft/fetch-event-source";
export default {
data() {
taskId:''
taskId: '';
params: {};
},
mounted() {},
methods: {
getTaskId(taskId) {
this.taskId = taskId
},
getParams(params) {
this.params = params
},
getTextInfo(info) {
if (info) {
this.newSSE(info, '1')
@ -294,27 +304,26 @@
},
body: JSON.stringify({
voiceText,
deptId: "3702000000",
id: "37020017407",
deptId: this.params.deptId && this.params.deptId != 'undefined' ? this.params
.deptId : "",
id: this.params.id || "",
multiType: "",
sceneFlag: "",
stream: true,
type: this.taskId ? '1' : '0',
userId: "admin1",
taskId:this.taskId
userId: this.params.userId || "",
taskId: this.taskId || "",
sectionId: this.params.sectionId || '',
sectionType: this.params.sectionType || ''
}),
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {
console.log('onopneSSE')
},
onopen: () => {},
onmessage: (ev) => {
//
this.$ownerInstance.callMethod('dataSend', ev);
},
onclose: () => {
console.log('输入框SSE关闭');
this.loading = false;
this.expandedFlag = false
if (this.isExpanded) {
this.isExpanded = !this.isExpanded;

@ -1,6 +1,6 @@
<template>
<view class="detail" :data="params" :change:data="renderjs.renderjsGet" :imgArr="imgArr"
:change:imgArr="renderjs.getImgArr">
:change:imgArr="renderjs.getImgArr" :check="check" :change:check="renderjs.checkGet" :taskId="taskId" :change:taskId="renderjs.taskIdGet" >
<!-- <view class="Content BorderBox Width100">
<top-title
:is-show-left="true"
@ -155,7 +155,7 @@
</view>
</view> -->
<vVoice :disabled="loading" v-model="inputValue" @confirm="handleSend" @imageChoose="chooseImage"
:showUpload="true" @dataSend="receiveRenderData" :taskId="taskId"/>
:showUpload="true" @dataSend="receiveRenderData" :taskId="taskId" :params="params" />
<u-popup :show="showYinDao" @close="showYinDao = false">
<view class="custom-pop-head">
<view class="title">{{ dataYinDao.title }}</view>
@ -230,7 +230,8 @@
timer: '',
tempStr: '',
imgArr: [],
taskId:''
taskId: '',
check: ''
};
},
@ -244,6 +245,7 @@
// params.taskId = "000001";
// params.userId = "admin1";
this.params = params;
console.log(this.params, 'paramsparamsparamsparamsparamsparamsparams')
this.getChatHistory()
let str = "";
if (params.roadName) {
@ -294,7 +296,6 @@
// watch
timerCount(newVal, oldVal) {
if (this.tempStr[newVal]) {
console.log('newValnewValnewValnewVal', this.tempStr, newVal, this.tempStr[newVal])
this.msgList[this.msgList.length - 1].data += this.tempStr[newVal]
} else {
@ -338,6 +339,7 @@
data: '',
},
];
console.log('contentcontentcontent', content)
this.tempStr = content
if (!this.timer) {
this.timer = setInterval(() => {
@ -391,7 +393,6 @@
sseBack(ev) {
let answerId = '1'
let res = JSON.parse(ev.data);
console.log('resresresresresresresres', res)
this.taskId = res.result.taskId
if (res?.code == 200 && res.result) {
let content = res.result.data.content
@ -563,7 +564,6 @@
// signal: ctrl.signal,
// openWhenHidden: true,
// onopen: () => {
// console.log('onopneSSE')
// uni.showToast({
// title: 'open'
// })
@ -984,6 +984,7 @@
filePath: url,
name: "file",
success: (res) => {
console.log('********************', res)
resolve(res.data);
},
});
@ -996,6 +997,8 @@
} else {
text = item;
}
this.check = text
return
this.handleSend(text);
},
handleGroup2(i) {
@ -1014,7 +1017,8 @@
data() {
return {
firstFlag: false,
params: {}
params: {},
taskId:''
}
},
mounted(option) {
@ -1022,28 +1026,51 @@
},
methods: {
getImgArr(res) {
console.log('图片变化', res)
if (res.length) {
this.newSSE(res.join(), '0')
}
},
renderjsGet(val) {
this.params = val;
let str = "";
if (this.params.roadName) {
str += "路段名:" + this.params.roadName;
this.title = this.params.roadName + "智能排查";
}
if (this.params.id != "undefined") {
str += ",id:" + this.params.id; //params.id
}
if (this.firstFlag) {
return
} else {
this.params = val;
let str = "";
if (this.params.roadName) {
str += "路段名:" + this.params.roadName;
this.title = this.params.roadName + "智能排查";
}
if (this.params.id != "undefined") {
str += ",id:" + this.params.id; //params.id
}
this.newSSE('开始隐患排查' + str, '1')
}
},
taskIdGet(taskId){
this.taskId = taskId
},
checkGet(check) {
if (check) {
this.newSSE(check, '0')
}
},
newSSE(voiceText, answerId = '') {
console.log('排查chat发送', voiceText, {
voiceText,
sceneFlag: "",
// sessionId: $.getData('sessionId'),
multiType: "",
userId: this.params.userId || '',
deptId: this.params.deptId && this.params.deptId != 'undefined' ? this.params
.deptId : '',
stream: true,
type: "1",
id: this.params.id || '',
taskId: this.taskId ,
sectionId: this.params.sectionId || '',
sectionType: this.params.sectionType || '',
})
// const ctrl = new AbortController();
fetchEventSource($.chatUrl + "/chat", {
method: "POST",
@ -1056,21 +1083,21 @@
sceneFlag: "",
// sessionId: $.getData('sessionId'),
multiType: "",
userId: this.params.userId,
deptId: this.params.deptId,
userId: this.params.userId || '',
deptId: this.params.deptId && this.params.deptId != 'undefined' ? this.params
.deptId : '',
stream: true,
type: "1",
id: this.params.id,
taskId: this.params.taskId,
sectionId: this.params.sectionId,
sectionType: this.params.sectionType,
id: this.params.id || '',
taskId: this.params.taskId || '',
sectionId: this.params.sectionId || '',
sectionType: this.params.sectionType || '',
}),
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {
console.log('onopneSSE')
},
onopen: () => {},
onmessage: (ev) => {
console.log('chat内容返回', ev);
//
this.$ownerInstance.callMethod('sseBack', ev);
},

@ -51,7 +51,14 @@
<view class="content">
<zeroMarkdownView :markdown="item.data" />
<!-- <ua-markdown :source="mdvalue" /> -->
<view class="icon" v-show="item.answerId != '0' && item.isOver && item.isSuccess">
<view class="icon" v-show="item.answerId != '0' && item.isOver && item.isSuccess && !loading">
<view v-show="item.answerId != '0'"
style="color: #5E6F8A ;font-size: 14px;text-align: center;display: flex;align-items: center;justify-content: center;position: relative;left: -20px;">
<image src="./warning.png" alt="" style="width: 14px;height: 14px;;margin-right: 5px;" />
<view>
内容由AI大模型生成请仔细甄别
</view>
</view>
<uni-icons
:type="item.iconsType == '' ? 'hand-up' : (item.iconsType == 'handUp' ? 'hand-up-filled' : 'hand-up')"
:color="item.iconsType == 'handUp' ? '#FFD131' : ''" size="22"
@ -95,7 +102,7 @@
</view> -->
<vVoice :disabled="loading" v-model="inputValue" :showUpload="true" @confirm="handleSend"
@dataSend="receiveRenderData" :expandedFlag="expandedFlag" @imageChoose="chooseImage"/>
@dataSend="receiveRenderData" :expandedFlag="expandedFlag" @imageChoose="chooseImage" />
<!-- <view class="downward" v-if="isToBottom" @click="toBottom">
<u-icon name="arrow-downward"></u-icon>
@ -166,6 +173,7 @@
timer: '',
tempStr: '',
imgArr: [],
qaId: '',
};
},
watch: {
@ -214,7 +222,6 @@
sizeType: ["original", "compressed"], //
sourceType: ["album", 'camera'], //
success: async (res) => {
console.log(res);
if (res.tempFilePaths && res.tempFilePaths.length) {
let str = "";
let jsonArr = [];
@ -262,7 +269,6 @@
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {
console.log('onopneSSE')
uni.showToast({
title: 'open触发'
})
@ -490,7 +496,7 @@
},
//
handleSend(text) {
console.log('handleSend触发',text)
console.log('handleSend触发', text)
if (!this.inputValue & !text) {
uni.showToast({
title: "请输入内容",
@ -671,17 +677,23 @@
},
];
this.tempStr += content
console.log('resresresresresres', res)
this.qaId = res.qaId
if (!this.timer) {
this.loading = true
this.timer = setInterval(() => {
this.timerCount = this.timerCount + 1
}, 50)
this.msgList[this.msgList.length - 1].isOver = true
this.msgList[this.msgList.length - 1].isSuccess = true
this.msgList[this.msgList.length - 1].qaId = this.qaId
}
}
}
// debugger
this.scrollBottom();
}else if (res?.code == 500 && res.message) {
} else if (res?.code == 500 && res.message) {
this.msgList = [
...this.msgList,
{
@ -1042,7 +1054,6 @@
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {
console.log('onopneSSE')
// uni.showToast({
// title: 'open'
// })
@ -1053,7 +1064,6 @@
},
onclose: () => {
console.log('关闭sse');
this.loading = false;
this.expandedFlag = false
if (this.isExpanded) {
this.isExpanded = !this.isExpanded;

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Loading…
Cancel
Save