|
@@ -2,6 +2,7 @@
|
|
<el-dialog title="AI生成PPT" :visible.sync="dialogVisibleAiCreate" :append-to-body="true" width="700px"
|
|
<el-dialog title="AI生成PPT" :visible.sync="dialogVisibleAiCreate" :append-to-body="true" width="700px"
|
|
:before-close="handleClose" class="dialog_diy">
|
|
:before-close="handleClose" class="dialog_diy">
|
|
<div style="height: 500px; padding: 15px" v-loading="loading" element-loading-text="小可正在努力生成中,请稍等...">
|
|
<div style="height: 500px; padding: 15px" v-loading="loading" element-loading-text="小可正在努力生成中,请稍等...">
|
|
|
|
+ <div class="c_pub_button_confirm stopBtn" v-if="loading && stopPpt" @click="cancelAjax()">停止</div>
|
|
<!-- <div class="t_box">
|
|
<!-- <div class="t_box">
|
|
<span>选择:</span>
|
|
<span>选择:</span>
|
|
<el-radio-group v-model="radio" @change="changeRadio">
|
|
<el-radio-group v-model="radio" @change="changeRadio">
|
|
@@ -107,6 +108,7 @@ export default {
|
|
},
|
|
},
|
|
detail: "",
|
|
detail: "",
|
|
loading: false,
|
|
loading: false,
|
|
|
|
+ stopPpt: null,
|
|
url: "",
|
|
url: "",
|
|
uJson: {},
|
|
uJson: {},
|
|
outline: "",
|
|
outline: "",
|
|
@@ -832,6 +834,12 @@ export default {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ cancelAjax(){
|
|
|
|
+ this.$message.success("已经成功停止")
|
|
|
|
+ this.stopPpt.cancel('Request canceled by the user.');
|
|
|
|
+ this.stopPpt = null;
|
|
|
|
+ this.loading = false
|
|
|
|
+ },
|
|
handleClose(done) {
|
|
handleClose(done) {
|
|
this.close();
|
|
this.close();
|
|
done();
|
|
done();
|
|
@@ -884,8 +892,6 @@ export default {
|
|
this.$message.error("正在生成中,请稍后");
|
|
this.$message.error("正在生成中,请稍后");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.url = "";
|
|
|
|
- this.uJson = {};
|
|
|
|
let _this = this;
|
|
let _this = this;
|
|
|
|
|
|
let fileid = [];
|
|
let fileid = [];
|
|
@@ -929,6 +935,10 @@ export default {
|
|
}
|
|
}
|
|
let message = "";
|
|
let message = "";
|
|
if (type == 1) {
|
|
if (type == 1) {
|
|
|
|
+ if(!_this.outline){
|
|
|
|
+ _this.$message.error("请先生成大纲内容");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
message = `NOTICE
|
|
message = `NOTICE
|
|
Role: 你是ppt内容设计大师,能力是从用户提供的文件资料中提取最重要的学科概念作为ppt参考内容,最后根据Context要求的流程要求输出ppt内容。
|
|
Role: 你是ppt内容设计大师,能力是从用户提供的文件资料中提取最重要的学科概念作为ppt参考内容,最后根据Context要求的流程要求输出ppt内容。
|
|
Output: Provide your output in json format.
|
|
Output: Provide your output in json format.
|
|
@@ -989,7 +999,8 @@ ${mclass.length ? "面向年级:" + mclass.join(",") : ""}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ this.url = "";
|
|
|
|
+ this.uJson = {};
|
|
// let params = JSON.stringify({
|
|
// let params = JSON.stringify({
|
|
// // "model": "Chat",
|
|
// // "model": "Chat",
|
|
// model: 'gpt-3.5-turbo',
|
|
// model: 'gpt-3.5-turbo',
|
|
@@ -1027,7 +1038,7 @@ ${mclass.length ? "面向年级:" + mclass.join(",") : ""}
|
|
// _this.loading = false
|
|
// _this.loading = false
|
|
// console.log(error);
|
|
// console.log(error);
|
|
// });
|
|
// });
|
|
-
|
|
|
|
|
|
+ _this.stopPpt = _this.ajax.setCancelSource();
|
|
let parm = {
|
|
let parm = {
|
|
assistant_id:
|
|
assistant_id:
|
|
type == 1
|
|
type == 1
|
|
@@ -1041,7 +1052,7 @@ ${mclass.length ? "面向年级:" + mclass.join(",") : ""}
|
|
};
|
|
};
|
|
_this.loading = true;
|
|
_this.loading = true;
|
|
this.ajax
|
|
this.ajax
|
|
- .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
|
|
|
|
|
|
+ .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm, _this.stopPpt)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
console.log(response);
|
|
console.log(response);
|
|
let data = response.data.FunctionResponse;
|
|
let data = response.data.FunctionResponse;
|
|
@@ -1083,18 +1094,21 @@ ${mclass.length ? "面向年级:" + mclass.join(",") : ""}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
_this.$message.error("生成失败,正在重新生成");
|
|
_this.$message.error("生成失败,正在重新生成");
|
|
_this.loading = false;
|
|
_this.loading = false;
|
|
|
|
+ _this.stopPpt = null
|
|
_this.aiGet(type);
|
|
_this.aiGet(type);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
_this.outline = data.message;
|
|
_this.outline = data.message;
|
|
_this.steps = 1;
|
|
_this.steps = 1;
|
|
|
|
+ _this.stopPpt = null
|
|
_this.loading = false;
|
|
_this.loading = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
_this.loading = false;
|
|
_this.loading = false;
|
|
|
|
+ _this.stopPpt = null
|
|
console.log(error);
|
|
console.log(error);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -1371,4 +1385,12 @@ ${mclass.length ? "面向年级:" + mclass.join(",") : ""}
|
|
height: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
object-fit: cover;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+.stopBtn{
|
|
|
|
+ z-index: 999999;
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: 50%;
|
|
|
|
+ top: calc(50% + 70px);
|
|
|
|
+ transform: translateX(-50%);
|
|
|
|
+}
|
|
</style>
|
|
</style>
|