|
@@ -61,7 +61,8 @@ export default {
|
|
|
"loading",
|
|
|
"wIndex",
|
|
|
"toolIndex",
|
|
|
- "toolDetail"
|
|
|
+ "toolDetail",
|
|
|
+ "refreshKey"
|
|
|
],
|
|
|
|
|
|
data() {
|
|
@@ -81,7 +82,7 @@ export default {
|
|
|
this.scoTitList.forEach(e => {
|
|
|
a += e.cog;
|
|
|
});
|
|
|
- let data = 0
|
|
|
+ let data = 0;
|
|
|
data = (a / this.scoTit.length).toFixed(1);
|
|
|
this.$emit("updateDocSco", {
|
|
|
val: this.toolIndex,
|
|
@@ -92,10 +93,14 @@ export default {
|
|
|
return data;
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ watch: {
|
|
|
+ refreshKey(newV, old) {
|
|
|
+ this.getData();
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
|
|
|
- console.log("scoCon", this.scoCon);
|
|
|
+ // console.log("scoCon", this.scoCon);
|
|
|
// console.log("scoTit", this.scoTit);
|
|
|
|
|
|
this.getData();
|
|
@@ -111,10 +116,20 @@ export default {
|
|
|
this.ajax
|
|
|
.get(this.$store.state.api + "selectWorksEvaScore", params)
|
|
|
.then(res => {
|
|
|
- // console.log(res);
|
|
|
+ console.log(res);
|
|
|
if (res.data[0].length > 0) {
|
|
|
- let data = JSON.parse(res.data[0][this.task].rate);
|
|
|
- // console.log("data", data);
|
|
|
+ let data2 = [];
|
|
|
+ res.data[0].forEach((val, index) => {
|
|
|
+ if (val.task == this.task) {
|
|
|
+ data2 = res.data[0][index];
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log("this.task", this.task);
|
|
|
+ console.log("data2", data2);
|
|
|
+
|
|
|
+ let data = JSON.parse(data2.rate);
|
|
|
+
|
|
|
this.scoTitList.forEach((e, index) => {
|
|
|
e.cog = 0;
|
|
|
for (const key in data) {
|
|
@@ -131,7 +146,35 @@ export default {
|
|
|
},
|
|
|
// 重置
|
|
|
reset() {
|
|
|
- this.getData();
|
|
|
+ let data = this.scoTitList.map(e => {
|
|
|
+ return e.value + ":" + e.cog;
|
|
|
+ });
|
|
|
+ // console.log("data", data);
|
|
|
+ const processedData = {};
|
|
|
+
|
|
|
+ data.forEach(item => {
|
|
|
+ const [key, value] = item.split(":");
|
|
|
+ processedData[key] = 0;
|
|
|
+ });
|
|
|
+ processedData.content = "";
|
|
|
+ // return console.log(processedData);
|
|
|
+ let params = {
|
|
|
+ cid: this.id,
|
|
|
+ s: this.stage,
|
|
|
+ t: this.task,
|
|
|
+ rate: JSON.stringify(processedData),
|
|
|
+ uid: this.stUid
|
|
|
+ };
|
|
|
+ // return console.log(params);
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "updateWorksEva", params)
|
|
|
+ .then(res => {
|
|
|
+ this.getData();
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.$message.error("重置失败");
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
},
|
|
|
// 老师提交评分
|
|
|
submit() {
|
|
@@ -181,7 +224,7 @@ export default {
|
|
|
});
|
|
|
let _text = "";
|
|
|
for (let i = 0; i < tit.length; i++) {
|
|
|
- _text += `维度名称:${tit[i].value} 维度描述:${tit[i].detail} \n`;
|
|
|
+ _text += `评价名称:${tit[i].value} 评价描述:${tit[i].detail} \n`;
|
|
|
}
|
|
|
// console.log(_text);
|
|
|
let msg = `NOTICE
|
|
@@ -202,19 +245,15 @@ export default {
|
|
|
|
|
|
## 要求
|
|
|
根据评价细则和作业内容与作业题目的相关性评价作业,判断该作业属于五级中的哪个等级。
|
|
|
- 具体的评价标准分为5级——1级,2级,3级,4级,5级。输出格式参考===输出范例===。
|
|
|
- ===
|
|
|
+ 具体的评价标准分为5级——1级,2级,3级,4级,5级。
|
|
|
1 级,没有识别问题和需求;
|
|
|
2 级,问题或需求没有被清晰理解或准确识别;
|
|
|
3 级,问题或需求的一部分被识别;
|
|
|
4 级,问题或需求的大部分被识别;
|
|
|
5 级,问题或需求都被识别。
|
|
|
- ===
|
|
|
|
|
|
- ## Format example
|
|
|
- 输出格式:[{'评价细则维度':'1'}],
|
|
|
- 属性名为每个评价细则的维度名称
|
|
|
- 不能不做评价,必须每个都有分数,分数只用数字来评分
|
|
|
+ # Format example
|
|
|
+ [{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'}]
|
|
|
`;
|
|
|
// console.log(msg);
|
|
|
this.aiGet2(msg);
|
|
@@ -222,45 +261,82 @@ export default {
|
|
|
// ai打分
|
|
|
aiGet2(messages, callback) {
|
|
|
let _this = this;
|
|
|
- let parm = {
|
|
|
- assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
- message: [
|
|
|
+ // let parm = {
|
|
|
+ // assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
+ // message: [
|
|
|
+ // {
|
|
|
+ // type: "text",
|
|
|
+ // text: messages.replaceAll("\n", " ").replaceAll("*", "")
|
|
|
+ // }
|
|
|
+ // ],
|
|
|
+ // session_name: uuidv4(),
|
|
|
+ // userId: this.userid,
|
|
|
+ // file_ids: ""
|
|
|
+ // };
|
|
|
+ let params = {
|
|
|
+ // "model": "Chat",
|
|
|
+ model: "gpt-3.5-turbo",
|
|
|
+ temperature: 0,
|
|
|
+ max_tokens: 4096,
|
|
|
+ top_p: 1,
|
|
|
+ frequency_penalty: 0,
|
|
|
+ presence_penalty: 0,
|
|
|
+ messages: [
|
|
|
{
|
|
|
- type: "text",
|
|
|
- text: messages.replaceAll("\n", " ").replaceAll("*", "")
|
|
|
+ content: messages.replaceAll("\n", " ").replaceAll("*", ""),
|
|
|
+ role: "user"
|
|
|
}
|
|
|
],
|
|
|
- session_name: uuidv4(),
|
|
|
- userId: this.userid,
|
|
|
- file_ids: ""
|
|
|
+ stream: false,
|
|
|
+ uid: this.userid,
|
|
|
+ mind_map_question: ""
|
|
|
};
|
|
|
this.ajax
|
|
|
- .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
|
|
|
+ .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
.then(response => {
|
|
|
let data = response.data.FunctionResponse;
|
|
|
- // console.log("data", data);
|
|
|
- if (data.message) {
|
|
|
+ console.log("data", data);
|
|
|
+ if (data.choices && data.choices.length && data.choices[0].message) {
|
|
|
let dArray = {};
|
|
|
try {
|
|
|
dArray = JSON.parse(
|
|
|
- data.message.replaceAll("```json", "").replaceAll("```", "")
|
|
|
+ data.choices[0].message.content
|
|
|
+ .replaceAll("```json", "")
|
|
|
+ .replaceAll("```", "")
|
|
|
);
|
|
|
} catch (error) {
|
|
|
console.log("error_________________" + error);
|
|
|
try {
|
|
|
let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
|
|
|
- let match = data.message.match(regex);
|
|
|
+ console.log("dArray666", data.choices[0].message.content);
|
|
|
+
|
|
|
+ let match = data.choices[0].message.content.match(regex);
|
|
|
+ // console.log("dArray2", match);
|
|
|
dArray = JSON.parse(
|
|
|
match[0]
|
|
|
.replace(/\n/g, "")
|
|
|
.replace(/\s{2,}/g, "")
|
|
|
.replace(/\'/g, '"')
|
|
|
);
|
|
|
+ // dArray = data.choices[0].message.content
|
|
|
} catch (error) {
|
|
|
+ try {
|
|
|
+ dArray = JSON.parse(
|
|
|
+ data.choices[0].message.content
|
|
|
+ .replaceAll("```json", "")
|
|
|
+ .replaceAll("# Solution", "")
|
|
|
+ .replaceAll("```", "")
|
|
|
+ .replace(/\n/g, "")
|
|
|
+ .replace(/\s{2,}/g, "")
|
|
|
+ .replace(/\'/g, '"')
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error_________________" + error);
|
|
|
+ }
|
|
|
console.log("error_________________" + error);
|
|
|
}
|
|
|
}
|
|
|
- // console.log("dArray", dArray);
|
|
|
+ console.log("dArray3", dArray);
|
|
|
// _this.submit2(dArray);
|
|
|
// 提交评分
|
|
|
// if (!dArray) {
|
|
@@ -273,7 +349,9 @@ export default {
|
|
|
let value = item[key];
|
|
|
processedData[key] = value;
|
|
|
});
|
|
|
+
|
|
|
processedData.content = "";
|
|
|
+ console.log("processedData", processedData);
|
|
|
|
|
|
let params = {
|
|
|
cid: _this.id,
|
|
@@ -333,47 +411,74 @@ export default {
|
|
|
aiupdetaSco(messages, uid, stage, task, callback) {
|
|
|
let _this = this;
|
|
|
|
|
|
- let parm = {
|
|
|
- assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
- message: [
|
|
|
+ let params = {
|
|
|
+ // "model": "Chat",
|
|
|
+ model: "gpt-3.5-turbo",
|
|
|
+ temperature: 0,
|
|
|
+ max_tokens: 4096,
|
|
|
+ top_p: 1,
|
|
|
+ frequency_penalty: 0,
|
|
|
+ presence_penalty: 0,
|
|
|
+ messages: [
|
|
|
{
|
|
|
- type: "text",
|
|
|
- text: messages.replaceAll("\n", " ").replaceAll("*", "")
|
|
|
+ content: messages.replaceAll("\n", " ").replaceAll("*", ""),
|
|
|
+ role: "user"
|
|
|
}
|
|
|
],
|
|
|
- session_name: uuidv4(),
|
|
|
- userId: this.userid,
|
|
|
- file_ids: ""
|
|
|
+ stream: false,
|
|
|
+ uid: this.userid,
|
|
|
+ mind_map_question: ""
|
|
|
};
|
|
|
return new Promise(resolve => {
|
|
|
this.ajax
|
|
|
- .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
|
|
|
+ .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
.then(response => {
|
|
|
let data = response.data.FunctionResponse;
|
|
|
// console.log(data);
|
|
|
|
|
|
- if (data.message) {
|
|
|
+ if (
|
|
|
+ data.choices &&
|
|
|
+ data.choices.length &&
|
|
|
+ data.choices[0].message
|
|
|
+ ) {
|
|
|
let dArray = {};
|
|
|
try {
|
|
|
dArray = JSON.parse(
|
|
|
- data.message.replaceAll("```json", "").replaceAll("```", "")
|
|
|
+ data.choices[0].message.content
|
|
|
+ .replaceAll("```json", "")
|
|
|
+ .replaceAll("```", "")
|
|
|
);
|
|
|
} catch (error) {
|
|
|
console.log("error_________________" + error);
|
|
|
try {
|
|
|
let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
|
|
|
- let match = data.message.match(regex);
|
|
|
+
|
|
|
+ let match = data.choices[0].message.content.match(regex);
|
|
|
+ // console.log("dArray2", match);
|
|
|
dArray = JSON.parse(
|
|
|
match[0]
|
|
|
.replace(/\n/g, "")
|
|
|
.replace(/\s{2,}/g, "")
|
|
|
.replace(/\'/g, '"')
|
|
|
);
|
|
|
+ // dArray = data.choices[0].message.content
|
|
|
} catch (error) {
|
|
|
+ try {
|
|
|
+ dArray = JSON.parse(
|
|
|
+ data.choices[0].message.content
|
|
|
+ .replaceAll("```json", "")
|
|
|
+ .replaceAll("# Solution", "")
|
|
|
+ .replaceAll("```", "")
|
|
|
+ .replace(/\n/g, "")
|
|
|
+ .replace(/\s{2,}/g, "")
|
|
|
+ .replace(/\'/g, '"')
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error_________________" + error);
|
|
|
+ }
|
|
|
console.log("error_________________" + error);
|
|
|
}
|
|
|
}
|
|
|
- // console.log("dArray", dArray);
|
|
|
let processedData = {};
|
|
|
|
|
|
dArray.forEach(function(item) {
|