commit
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="robot" @click="robotmax">
|
||||
<div class="robot" @mouseover="robotmax">
|
||||
<div class="robot_top" ref="robotDom" v-fade="robotTop,'block'">
|
||||
<div :class="[item.state == 1?'text_right':'text_left']" v-for="item in dialogue" ref="robotChildDom">
|
||||
<div :class="[item.state == 1?'text_right':'text_left']" v-for="item in record" ref="robotChildDom">
|
||||
<div class="robot_text">{{item.str}}</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,7 +44,7 @@ export default defineComponent({
|
||||
const robotInput = ref(false)
|
||||
let timeTop:any = 0;
|
||||
let timeInput:any = 0;
|
||||
let dialogue:any = ref([
|
||||
let record:any = ref([
|
||||
{
|
||||
state:1,
|
||||
str:"2222222 22222222 222"
|
||||
@@ -64,7 +64,7 @@ export default defineComponent({
|
||||
robotTop,
|
||||
robotInput,
|
||||
chatCentent,
|
||||
dialogue,
|
||||
record,
|
||||
robotDom,
|
||||
robotChildDom,
|
||||
timeTop,
|
||||
@@ -112,8 +112,6 @@ export default defineComponent({
|
||||
this.createTimer()
|
||||
},
|
||||
textScroll(){
|
||||
|
||||
|
||||
this.$nextTick(()=>{
|
||||
if(this.robotDom && this.robotChildDom){
|
||||
// const items = this.robotChildDom._rawValue
|
||||
@@ -131,21 +129,20 @@ export default defineComponent({
|
||||
this.createTimer()
|
||||
},
|
||||
roborSend (){
|
||||
this.createTimer()
|
||||
this.clearTimer()
|
||||
if(!this.chatCentent){
|
||||
message.error("Please enter content");
|
||||
return
|
||||
}
|
||||
this.dialogue.push({
|
||||
this.record.push({
|
||||
state:2,
|
||||
str:this.chatCentent
|
||||
})
|
||||
let a = true
|
||||
let data = {
|
||||
"user_id" : this.userInfo.userId,
|
||||
// "message" : this.chatCentent,
|
||||
"message" : "Hello, can you tell me what holiday is on July 1st",
|
||||
|
||||
"message" : this.chatCentent,
|
||||
// "message" : "Hello, can you tell me what holiday is on July 1st",
|
||||
"session_id":""
|
||||
}
|
||||
let interaction = {onDownloadProgress: (progressEvent:any) => {
|
||||
@@ -153,55 +150,30 @@ export default defineComponent({
|
||||
console.log(progressEvent.event.currentTarget.response);
|
||||
|
||||
// if(a){
|
||||
// this.dialogue.push({
|
||||
// this.record.push({
|
||||
// state:1,
|
||||
// str:progressEvent.event.currentTarget.response
|
||||
// })
|
||||
// a = false
|
||||
// }else{
|
||||
// this.dialogue[this.dialogue.length].str = progressEvent.event.currentTarget.response
|
||||
// this.record[this.record.length].str = progressEvent.event.currentTarget.response
|
||||
// }
|
||||
},
|
||||
}
|
||||
Https.axiosPost(Https.httpUrls.pythonChatStream, data,interaction).then(
|
||||
(rv: any) => {
|
||||
a = true
|
||||
this.createTimer()
|
||||
}
|
||||
).catch(res=>{
|
||||
this.createTimer()
|
||||
});
|
||||
|
||||
// new Promise((resolve, reject) => {
|
||||
|
||||
|
||||
|
||||
// axios.post("/api/python/chatStream", data,{
|
||||
// onDownloadProgress: (progressEvent:any) => {
|
||||
// // this.clearTimer()
|
||||
// console.log(progressEvent);
|
||||
|
||||
// // if(a){
|
||||
// // this.dialogue.push({
|
||||
// // state:1,
|
||||
// // // str:progressEvent.event.currentTarget.response
|
||||
// // })
|
||||
// // a = false
|
||||
// // }else{
|
||||
// // this.dialogue[this.dialogue.length].str = progressEvent.event.currentTarget.response
|
||||
// // }
|
||||
// },
|
||||
// }).then(response => {
|
||||
// // resolve(response)
|
||||
// console.log(response);
|
||||
|
||||
// }).catch((error) => {
|
||||
// console.log(error);
|
||||
|
||||
// })
|
||||
|
||||
// });
|
||||
|
||||
// Https.axiosPost(Https.httpUrls.pythonChatStream, data).then(
|
||||
// // Https.axiosPost(Https.httpUrls.pythonChatStream, data,interaction).then(
|
||||
// (rv: any) => {
|
||||
// // a = true
|
||||
// console.log(rv);
|
||||
// this.record.push({
|
||||
// state:1,
|
||||
// // str:rv.
|
||||
// })
|
||||
// this.createTimer()
|
||||
// }
|
||||
// ).catch(res=>{
|
||||
// this.createTimer()
|
||||
// });
|
||||
this.chatCentent = ""
|
||||
this.textScroll()
|
||||
|
||||
@@ -220,7 +192,6 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//清除定时器
|
||||
clearTimer() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user