|
@@ -548,7 +548,7 @@
|
|
|
'c_pub_button_confirm',
|
|
|
courseText ? '' : 'c_pub_button_confirmDisabled'
|
|
|
]"
|
|
|
- v-if="!faloading && !isVoice"
|
|
|
+ v-if="!curRequestController && !isVoice"
|
|
|
@click="addContent"
|
|
|
>
|
|
|
发送
|
|
@@ -601,8 +601,8 @@
|
|
|
<div v-if="!faloading && isVoice"></div>
|
|
|
<div
|
|
|
class="c_pub_button_confirm"
|
|
|
- v-if="faloading && stopTalkToken"
|
|
|
- @click="stopSend"
|
|
|
+ v-if="curRequestController"
|
|
|
+ @click="stopCurRequestController"
|
|
|
>
|
|
|
终止
|
|
|
</div>
|
|
@@ -821,7 +821,8 @@ export default {
|
|
|
wangData: [],
|
|
|
canUseWangData: true,
|
|
|
hasGeneratedGuess: false,
|
|
|
- showPopoverUid: null
|
|
|
+ showPopoverUid: null,
|
|
|
+ curRequestController:null,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -1565,14 +1566,21 @@ ${fileText}
|
|
|
let _addText = "";
|
|
|
const md = new MarkdownIt();
|
|
|
let _this = this;
|
|
|
- const curRequestController = new AbortController();
|
|
|
+ // const curRequestController = new AbortController();
|
|
|
+ this.curRequestController = new AbortController();
|
|
|
+ // this.stopTalkToken = () => {
|
|
|
+ // curRequestController.abort();
|
|
|
+ // this.getMessageLoading = false;
|
|
|
+ // console.log("请求已终止");
|
|
|
+ // };
|
|
|
+ // this.getMessageLoading = true;
|
|
|
fetchEventSource("https://gpt4.cocorobo.cn/csvaimessagestream",{
|
|
|
method: "POST",
|
|
|
headers: {
|
|
|
"Content-Type": "application/json"
|
|
|
},
|
|
|
body: JSON.stringify(params),
|
|
|
- signal: curRequestController.signal,
|
|
|
+ signal: _this.curRequestController.signal,
|
|
|
onmessage(ev){
|
|
|
let _data = JSON.parse(ev.data);
|
|
|
console.log("👉>>>",_data)
|
|
@@ -1599,6 +1607,7 @@ ${fileText}
|
|
|
_this.array.find(i => i.uid == _uuid).mdText = _text;
|
|
|
_this.generateChart(_this.array.find(i => i.uid == _uuid));
|
|
|
_this.insertChat(_uuid);
|
|
|
+ _this.curRequestController = null;
|
|
|
}
|
|
|
_this.$nextTick(() => {
|
|
|
_this.$refs.chatDialog.scrollTop = _this.$refs.chatDialog.scrollHeight;
|
|
@@ -1608,9 +1617,11 @@ ${fileText}
|
|
|
_this.$forceUpdate();
|
|
|
_this.stopTalkToken = null;
|
|
|
_this.faloading = false;
|
|
|
+ _this.curRequestController = null;
|
|
|
console.log("连接关闭")
|
|
|
},
|
|
|
onerror(err){
|
|
|
+
|
|
|
console.log("连接错误",err)
|
|
|
}
|
|
|
})
|
|
@@ -1695,6 +1706,13 @@ ${fileText}
|
|
|
// });
|
|
|
}
|
|
|
},
|
|
|
+ stopCurRequestController(){
|
|
|
+ if(this.curRequestController){
|
|
|
+ this.curRequestController.abort();
|
|
|
+ console.log("请求已终止");
|
|
|
+ this.curRequestController = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
async getData() {
|
|
|
return new Promise(resolve => {
|
|
|
if (this.cid) {
|
|
@@ -2591,7 +2609,12 @@ ${_echartsType[type].text}
|
|
|
},
|
|
|
async addNewChat(){
|
|
|
this.array = [];
|
|
|
- await this.addChat(this.formList.map(i=>i.name).join(','))
|
|
|
+ this.fileId = [];
|
|
|
+ this.fileList = [];
|
|
|
+ this.cid = "";
|
|
|
+ this.$parent.menuList = []
|
|
|
+ this.$parent.userAsk = "";
|
|
|
+ //await this.addChat(this.formList.map(i=>i.name).join(','))
|
|
|
this.$message.success("新建会话成功")
|
|
|
}
|
|
|
},
|