This commit is contained in:
WangXiaoDong
2023-09-25 10:09:00 +08:00
parent 173f35042d
commit d9868d5cf0
37 changed files with 1618 additions and 1146 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="robot" @mouseover="robotmax">
<div class="robot" @mousemove="robotmax">
<div class="robot_top" ref="robotDom" v-fade="robotTop,'block'">
<div :class="[item.state == 1?'text_right':'text_left']" v-for="item in record" ref="robotChildDom">
<div class="robot_text">{{item.str}}</div>
@@ -45,18 +45,7 @@ export default defineComponent({
let timeTop:any = 0;
let timeInput:any = 0;
let record:any = ref([
{
state:1,
str:"2222222 22222222 222"
},
{
state:2,
str:"2222 22222 22 2222 22"
},
{
state:1,
str:"222 22222 222 2222 222"
},
])
const userInfo:any = {}
@@ -131,24 +120,26 @@ export default defineComponent({
roborSend (){
this.clearTimer()
if(!this.chatCentent){
message.error("Please enter content");
message.warning("Please enter content");
return
}
this.record.push({
state:2,
str:this.chatCentent
})
this.textScroll()
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",
// "session_id":""
"session_id":"session_1",
"message" : this.chatCentent,
// "message" : "Hello, can you tell me what holiday is on July 1st",
"session_id":""
}
let interaction = {onDownloadProgress: (progressEvent:any) => {
this.clearTimer()
console.log(progressEvent.event.currentTarget.response);
// console.log(progressEvent.event.currentTarget.response);
// if(a){
// this.record.push({
// state:1,
@@ -160,23 +151,22 @@ export default defineComponent({
// }
},
}
// 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()
// });
Https.axiosPost(Https.httpUrls.chatStreamTest, data).then(
// Https.axiosPost(Https.httpUrls.pythonChatStream, data,interaction).then(
(rv) => {
if(rv){
this.record.push({
state:1,
str:rv.output
})
this.createTimer()
this.textScroll()
}
}
).catch(res=>{
// console.log(res,'res');
});
this.chatCentent = ""
this.textScroll()
},
//创建定时器
createTimer() {