|
|
@ -1,10 +1,17 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<view class="detail"> |
|
|
|
<view class="detail"> |
|
|
|
<headerNavBar title="智能排查" :isBack="true"> |
|
|
|
<view class="Content BorderBox Width100"> |
|
|
|
|
|
|
|
<top-title :is-show-left="true" :title="'智能排查'" :rightWidth="40" class="custom_bg"> |
|
|
|
|
|
|
|
<template slot="right"> |
|
|
|
|
|
|
|
<image :src="$.imgurl + '/knowledge.png'" mode="" class="knowledge" @click="goToKnowledge"></image> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</top-title> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- <headerNavBar title="智能排查" :isBack="true"> |
|
|
|
<template v-slot:right> |
|
|
|
<template v-slot:right> |
|
|
|
<image :src="$.imgurl + '/knowledge.png'" mode="" class="knowledge" @click="goToKnowledge"></image> |
|
|
|
<image :src="$.imgurl + '/knowledge.png'" mode="" class="knowledge" @click="goToKnowledge"></image> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</headerNavBar> |
|
|
|
</headerNavBar> --> |
|
|
|
<view class="stepBox"> |
|
|
|
<view class="stepBox"> |
|
|
|
<view class="step" v-for="(item, index) in tablist" :key="index"> |
|
|
|
<view class="step" v-for="(item, index) in tablist" :key="index"> |
|
|
|
<view class="stepItem"> |
|
|
|
<view class="stepItem"> |
|
|
@ -63,13 +70,14 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import AbortController from 'abort-controller/dist/abort-controller' |
|
|
|
import AbortController from 'abort-controller/dist/abort-controller' |
|
|
|
|
|
|
|
import TopTitle from "../../components/top-title.vue"; |
|
|
|
import headerNavBar from '../../components/headerNavBar/headerNavBar.vue' |
|
|
|
// import headerNavBar from '../../components/headerNavBar/headerNavBar.vue' |
|
|
|
import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView.vue' |
|
|
|
import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView.vue' |
|
|
|
// import { |
|
|
|
// import { |
|
|
|
// EventSourcePolyfill |
|
|
|
// EventSourcePolyfill |
|
|
|
// } from 'event-source-polyfill'; |
|
|
|
// } from 'event-source-polyfill'; |
|
|
|
|
|
|
|
import $ from '../../common/globalJs/globalJs.js' |
|
|
|
import { |
|
|
|
import { |
|
|
|
fetchEventSource |
|
|
|
fetchEventSource |
|
|
|
} from '@microsoft/fetch-event-source' |
|
|
|
} from '@microsoft/fetch-event-source' |
|
|
@ -78,7 +86,10 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
// } from '../../utils/config.js'; |
|
|
|
// } from '../../utils/config.js'; |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { headerNavBar,zeroMarkdownView }, |
|
|
|
components: { |
|
|
|
|
|
|
|
TopTitle, |
|
|
|
|
|
|
|
zeroMarkdownView |
|
|
|
|
|
|
|
}, |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
active: 0, |
|
|
|
active: 0, |
|
|
@ -105,16 +116,16 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
id: '', |
|
|
|
id: '', |
|
|
|
allContent: '', |
|
|
|
allContent: '', |
|
|
|
params: {}, |
|
|
|
params: {}, |
|
|
|
tabkey:0, |
|
|
|
tabkey: 0, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
onLoad() { |
|
|
|
let params = { |
|
|
|
let params = { |
|
|
|
sessionId:'12121212', |
|
|
|
sessionId: '12121212', |
|
|
|
id:'12121212', |
|
|
|
id: '12121212', |
|
|
|
roadName:'金水路与合川路' |
|
|
|
roadName: '金水路与合川路' |
|
|
|
} |
|
|
|
} |
|
|
|
this.params = params |
|
|
|
this.params = params |
|
|
|
this.sessionId = params.sessionId |
|
|
|
this.sessionId = params.sessionId |
|
|
@ -182,8 +193,7 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
}), |
|
|
|
}), |
|
|
|
signal: ctrl.signal, |
|
|
|
signal: ctrl.signal, |
|
|
|
openWhenHidden: true, |
|
|
|
openWhenHidden: true, |
|
|
|
onopen:()=> { |
|
|
|
onopen: () => {}, |
|
|
|
}, |
|
|
|
|
|
|
|
onmessage: (ev) => { |
|
|
|
onmessage: (ev) => { |
|
|
|
console.log(ev) |
|
|
|
console.log(ev) |
|
|
|
this.loading = true |
|
|
|
this.loading = true |
|
|
@ -195,18 +205,24 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
if (this.tabkey - 1 != this.active) { |
|
|
|
if (this.tabkey - 1 != this.active) { |
|
|
|
this.active = this.tabkey - 1 > 0 ? this.tabkey - 1 : 0; |
|
|
|
this.active = this.tabkey - 1 > 0 ? this.tabkey - 1 : 0; |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.msgList.length==0){ |
|
|
|
if (this.msgList.length == 0) { |
|
|
|
this.msgList = [{answerId,data:res.result.data.content}] |
|
|
|
this.msgList = [{ |
|
|
|
} else{ |
|
|
|
answerId, |
|
|
|
|
|
|
|
data: res.result.data.content |
|
|
|
|
|
|
|
}] |
|
|
|
|
|
|
|
} else { |
|
|
|
// debugger |
|
|
|
// debugger |
|
|
|
//回答 |
|
|
|
//回答 |
|
|
|
if(this.msgList[this.msgList.length-1].answerId=='1'){ |
|
|
|
if (this.msgList[this.msgList.length - 1].answerId == '1') { |
|
|
|
//最后一个是回答 |
|
|
|
//最后一个是回答 |
|
|
|
this.msgList[this.msgList.length-1].data +=res.result.data.content |
|
|
|
this.msgList[this.msgList.length - 1].data += res.result.data.content |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
//最后一个是问题 |
|
|
|
//最后一个是问题 |
|
|
|
this.msgList = [...this.msgList,{answerId:'1',data:res.result.data.content}] |
|
|
|
this.msgList = [...this.msgList, { |
|
|
|
|
|
|
|
answerId: '1', |
|
|
|
|
|
|
|
data: res.result.data.content |
|
|
|
|
|
|
|
}] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -239,7 +255,7 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
this.loading = true; |
|
|
|
this.loading = true; |
|
|
|
const [err, res] = await uni.request({ |
|
|
|
const [err, res] = await uni.request({ |
|
|
|
// url: 'http://10.16.3.159:8777/api/local_doc_qa/local_doc_chat', |
|
|
|
// url: 'http://10.16.3.159:8777/api/local_doc_qa/local_doc_chat', |
|
|
|
url: 'http://219.147.31.25:30001/hitap/chat', |
|
|
|
url: $.chatUrl+'/chat', |
|
|
|
dataType: 'json', |
|
|
|
dataType: 'json', |
|
|
|
method: 'POST', |
|
|
|
method: 'POST', |
|
|
|
// responseType: 'arraybuffer', |
|
|
|
// responseType: 'arraybuffer', |
|
|
@ -297,10 +313,10 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
onKeyInput(event) { |
|
|
|
onKeyInput(event) { |
|
|
|
this.inputValue = event.detail.value |
|
|
|
this.inputValue = event.detail.value |
|
|
|
}, |
|
|
|
}, |
|
|
|
addQuestion(q,answerId) { |
|
|
|
addQuestion(q, answerId) { |
|
|
|
const newQuestion = { |
|
|
|
const newQuestion = { |
|
|
|
answerId, |
|
|
|
answerId, |
|
|
|
data:q |
|
|
|
data: q |
|
|
|
}; |
|
|
|
}; |
|
|
|
this.msgList.push(newQuestion); // 将问题添加到消息列表 |
|
|
|
this.msgList.push(newQuestion); // 将问题添加到消息列表 |
|
|
|
// this.$store.commit('setMSg_List', this.msgList); |
|
|
|
// this.$store.commit('setMSg_List', this.msgList); |
|
|
@ -324,11 +340,11 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
} |
|
|
|
} |
|
|
|
if (text || this.inputValue) { |
|
|
|
if (text || this.inputValue) { |
|
|
|
if (this.params.id == 12121212) { |
|
|
|
if (this.params.id == 12121212) { |
|
|
|
this.changeMsgList('0', this.inputValue||text); |
|
|
|
this.changeMsgList('0', this.inputValue || text); |
|
|
|
this.queryChat(this.inputValue || text); |
|
|
|
this.queryChat(this.inputValue || text); |
|
|
|
this.scrollBottom() |
|
|
|
this.scrollBottom() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.addQuestion(this.inputValue || text,'0') |
|
|
|
this.addQuestion(this.inputValue || text, '0') |
|
|
|
this.SSE(this.inputValue || text, '0'); |
|
|
|
this.SSE(this.inputValue || text, '0'); |
|
|
|
} |
|
|
|
} |
|
|
|
this.inputValue = ''; |
|
|
|
this.inputValue = ''; |
|
|
@ -336,7 +352,7 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
// 更新列表信息 |
|
|
|
// 更新列表信息 |
|
|
|
changeMsgList(answerId, data,answerOptions) { |
|
|
|
changeMsgList(answerId, data, answerOptions) { |
|
|
|
let id = 1; |
|
|
|
let id = 1; |
|
|
|
if (this.msgList.length > 0) { |
|
|
|
if (this.msgList.length > 0) { |
|
|
|
id = this.msgList[this.msgList.length - 1].id + 1; |
|
|
|
id = this.msgList[this.msgList.length - 1].id + 1; |
|
|
@ -415,11 +431,11 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
str += ``; |
|
|
|
str += ``; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(this.id == 12121212){ |
|
|
|
if (this.id == 12121212) { |
|
|
|
this.changeMsgList('0', str); |
|
|
|
this.changeMsgList('0', str); |
|
|
|
this.queryChat(res.tempFilePaths); |
|
|
|
this.queryChat(res.tempFilePaths); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
this.addQuestion(str,'0') |
|
|
|
this.addQuestion(str, '0') |
|
|
|
this.SSE(res.tempFilePaths, '0'); |
|
|
|
this.SSE(res.tempFilePaths, '0'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -444,7 +460,8 @@ import zeroMarkdownView from '../../components/zeroMarkdownView/zeroMarkdownView |
|
|
|
|
|
|
|
|
|
|
|
.stepBox { |
|
|
|
.stepBox { |
|
|
|
width: 100%; |
|
|
|
width: 100%; |
|
|
|
height: 150rpx; |
|
|
|
// height: 150rpx; |
|
|
|
|
|
|
|
padding-top: 110rpx ; |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
align-items: center; |
|
|
|