|
@@ -63,7 +63,7 @@ export default {
|
|
|
aiStatus: 0,
|
|
|
aiText: "您好,我是小可,有什么可以帮助您的?",
|
|
|
userText: "",
|
|
|
- showTextIndex: 0, //0:ai,1:用户, 2:组织语言
|
|
|
+ showTextIndex: 0, //0:ai,1:用户, 2:组织语言 3: 无
|
|
|
timer: null,
|
|
|
isOpen:false,
|
|
|
userId:this.$route.query.userid,
|
|
@@ -102,15 +102,17 @@ export default {
|
|
|
// let _msg = _text;
|
|
|
console.log("👇");
|
|
|
console.log(_msg);
|
|
|
+ if(!_msg)return console.log('输出为空');
|
|
|
if (_msg.indexOf("可可同学") != -1 && !this.show) {
|
|
|
this.aiText = "您好,我是小可,有什么可以帮助您的?";
|
|
|
this.aiStatus = 0;
|
|
|
this.showIndex = 0;
|
|
|
this.show = true;
|
|
|
console.log("已唤醒");
|
|
|
+ return;
|
|
|
} else if (this.show == true) {
|
|
|
if (this.showTextIndex == 2 || this.chatLoading || this.talkLoading) {
|
|
|
- console.log("组织语言中");
|
|
|
+ return console.log("组织语言中");
|
|
|
} else {
|
|
|
this.showTextIndex = 1;
|
|
|
this.aiText = "";
|
|
@@ -128,13 +130,14 @@ export default {
|
|
|
this.aiStatus = 2;
|
|
|
this.aiText = "";
|
|
|
this.userText = "";
|
|
|
+ this.stopRecord();
|
|
|
return;
|
|
|
// },1000)
|
|
|
}
|
|
|
this.showTextIndex = 2;
|
|
|
this.aiText = "";
|
|
|
if (/计时(.+)分钟/.test(this.userText)) {
|
|
|
- setTimeout(() => {
|
|
|
+ // setTimeout(() => {
|
|
|
let _number = this.userText.match(/计时(.+)分钟/)[1]
|
|
|
let _time = 0;
|
|
|
if(!/^\d+$/.test(_number)){
|
|
@@ -152,8 +155,8 @@ export default {
|
|
|
this.aiStatus = 2;
|
|
|
this.aiText = "";
|
|
|
this.userText = "";
|
|
|
- }, 2000);
|
|
|
- }, 2000);
|
|
|
+ }, 3000);
|
|
|
+ // }, 2000);
|
|
|
} else {
|
|
|
this.chatLoading = true;
|
|
|
const _uuid = uuidv4();
|
|
@@ -161,7 +164,7 @@ export default {
|
|
|
assistant_id: 'f8e1ebb2-2e0d-11ef-8bf4-12e77c4cb76b',
|
|
|
userId: this.userId,
|
|
|
message: this.userText,
|
|
|
- session_name: _uuid,
|
|
|
+ session_name: _uuid+"-qgt",
|
|
|
uid:_uuid,
|
|
|
file_ids: [],
|
|
|
};
|
|
@@ -172,7 +175,18 @@ export default {
|
|
|
.then(res => {
|
|
|
if (res.data.FunctionResponse.result == "发送成功") {
|
|
|
} else {
|
|
|
- this.$message.warning(res.data.FunctionResponse.result);
|
|
|
+ // this.$message.warning(res.data.FunctionResponse.result);
|
|
|
+ console.log(res.data.FunctionResponse.result)
|
|
|
+ this.chatLoading = false;
|
|
|
+ this.aiStatus = 0;
|
|
|
+ this.showTextIndex = 0;
|
|
|
+ this.aiText = "对不起,我无法理解您的问题,请重新提问";
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
+ this.showTextIndex = 3;
|
|
|
+ this.aiStatus = 2;
|
|
|
+ this.aiText = "";
|
|
|
+ this.userText = "";
|
|
|
+ }, 3000);
|
|
|
}
|
|
|
})
|
|
|
.catch(e => {
|
|
@@ -302,17 +316,9 @@ export default {
|
|
|
}
|
|
|
_mdText = _mdText.replace("_", "");
|
|
|
this.aiText = _mdText;
|
|
|
- _talkIndex = 0;
|
|
|
if(_talkText!=''){
|
|
|
this.talkTextList.push(_talkText)
|
|
|
- }
|
|
|
- if(!this.talkLoading){
|
|
|
- this.timer = setTimeout(() => {
|
|
|
- this.showTextIndex = 3;
|
|
|
- this.aiStatus = 2;
|
|
|
- this.aiText = "";
|
|
|
- this.userText = "";
|
|
|
- }, 3000);
|
|
|
+ if(!this.talkLoading)this.talkText();
|
|
|
}
|
|
|
this.chatLoading = false;
|
|
|
this.source.close();
|
|
@@ -348,6 +354,10 @@ export default {
|
|
|
|
|
|
if(_text){
|
|
|
this.talkLoading = true;
|
|
|
+ if (this.timer) {
|
|
|
+ clearTimeout(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
console.log(`👉转语音:${_text}`)
|
|
|
// setTimeout(()=>{
|
|
|
// this.talkText();
|
|
@@ -356,16 +366,14 @@ export default {
|
|
|
}else{
|
|
|
console.log("👉转语音结束👈")
|
|
|
_talkTextIiframe2.contentWindow.closesynthesizer()
|
|
|
- this.chatLoading = false;
|
|
|
this.talkLoading = false;
|
|
|
- this.talkTextList = [];
|
|
|
- this.timer = setTimeout(() => {
|
|
|
- this.showTextIndex = 3;
|
|
|
- this.aiStatus = 2;
|
|
|
- this.aiText = "";
|
|
|
- this.userText = "";
|
|
|
- }, 3000);
|
|
|
- return
|
|
|
+ // this.timer = setTimeout(() => {
|
|
|
+ // this.showTextIndex = 3;
|
|
|
+ // this.aiStatus = 2;
|
|
|
+ // this.aiText = "";
|
|
|
+ // this.userText = "";
|
|
|
+ // this.time = null;
|
|
|
+ // }, 5000);
|
|
|
}
|
|
|
},
|
|
|
},
|