|
@@ -405,9 +405,11 @@ export default {
|
|
|
type: Array,
|
|
|
default: () => []
|
|
|
},
|
|
|
- testData:{
|
|
|
- type:Object,
|
|
|
- default:()=>{return {}}
|
|
|
+ testData: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {
|
|
|
+ return {};
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
directives: {
|
|
@@ -556,8 +558,35 @@ export default {
|
|
|
curRequestController: null,
|
|
|
continuousDialogue: true,
|
|
|
copyWorksStudent: [],
|
|
|
- optionTypeList:['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
|
|
|
- getWanDataFlag:true,
|
|
|
+ optionTypeList: [
|
|
|
+ "A",
|
|
|
+ "B",
|
|
|
+ "C",
|
|
|
+ "D",
|
|
|
+ "E",
|
|
|
+ "F",
|
|
|
+ "G",
|
|
|
+ "H",
|
|
|
+ "I",
|
|
|
+ "J",
|
|
|
+ "K",
|
|
|
+ "L",
|
|
|
+ "M",
|
|
|
+ "N",
|
|
|
+ "O",
|
|
|
+ "P",
|
|
|
+ "Q",
|
|
|
+ "R",
|
|
|
+ "S",
|
|
|
+ "T",
|
|
|
+ "U",
|
|
|
+ "V",
|
|
|
+ "W",
|
|
|
+ "X",
|
|
|
+ "Y",
|
|
|
+ "Z"
|
|
|
+ ],
|
|
|
+ getWanDataFlag: true
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -583,7 +612,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
async guessAskJson(fileData) {
|
|
|
- if(!this.getWanDataFlag)return;
|
|
|
+ if (!this.getWanDataFlag) return;
|
|
|
this.getWanDataFlag = false;
|
|
|
let _uid = uuidv4();
|
|
|
this.getWangLoading = true;
|
|
@@ -591,7 +620,7 @@ export default {
|
|
|
this.wangData = "";
|
|
|
let fileText = ``;
|
|
|
// fileData.forEach(i => {
|
|
|
- fileText += `作业类别:${fileData.name}
|
|
|
+ fileText += `作业类别:${fileData.name}
|
|
|
作业数据:
|
|
|
${JSON.stringify(fileData.data)}
|
|
|
|
|
@@ -611,15 +640,37 @@ ${JSON.stringify(fileData.data)}
|
|
|
${fileText}
|
|
|
## Format example
|
|
|
[{"index": 1,"title": "垃圾分类标准","label": "不同国家的垃圾分类标准和方法?"},{"index": 2,"title":"可回收垃圾处理","label": "可回收垃圾的处理流程和再利用方法?"},{ "index": 3, "title": "有害垃圾的影响", "label": "有害垃圾对环境和人体健康的潜在影响?"},{ "index": 4, "title": "垃圾分类标准", "label": "不同国家的垃圾分类标准和方法?"},{ "index": 5, "title": "可回收垃圾处理", "label": "可回收垃圾的处理流程和再利用方法?"},{ "index": 6, "title": "有害垃圾的影响", "label": "有害垃圾对环境和人体健康的潜在影响?"}]`;
|
|
|
- let params = {
|
|
|
- assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
- userId: this.userid,
|
|
|
- message: _msg,
|
|
|
- session_name: _uid,
|
|
|
- // uid: _uuid,
|
|
|
- file_ids: this.fileId,
|
|
|
- model: "gpt-4o-2024-08-06"
|
|
|
- };
|
|
|
+ // let params = {
|
|
|
+ // assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
+ // userId: this.userid,
|
|
|
+ // message: _msg,
|
|
|
+ // session_name: _uid,
|
|
|
+ // // uid: _uuid,
|
|
|
+ // file_ids: this.fileId,
|
|
|
+ // model: "gpt-4o-2024-08-06"
|
|
|
+ // };
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ // assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
+ // userId: this.userid,
|
|
|
+ // message: _msg,
|
|
|
+ // session_name: `${_uid}_session_name`,
|
|
|
+ // uid: _uid,
|
|
|
+ // file_ids: [],
|
|
|
+ // model: "gpt-4o-2024-11-20"
|
|
|
+ id:"6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
+ max_completion_tokens:4096,
|
|
|
+ message: _msg,
|
|
|
+ model: "gpt-4o-2024-11-20",
|
|
|
+ userId: this.userid,
|
|
|
+ sound_url:"",
|
|
|
+ file_ids:[],
|
|
|
+ temperature:0.2,
|
|
|
+ top_p:1,
|
|
|
+ stream:false,
|
|
|
+ session_name:uuidv4(),
|
|
|
+ uid:_uid,
|
|
|
+ }
|
|
|
this.array.push({
|
|
|
loading: false,
|
|
|
role: "user",
|
|
@@ -639,10 +690,11 @@ ${fileText}
|
|
|
this.ajax
|
|
|
// .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
// .post("https://claude3.cocorobo.cn/chat", params)
|
|
|
- .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
|
|
|
+ // .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
|
|
|
+ .post("https://appapi.cocorobo.cn/api/agentchats/ai_agent_chat", params)
|
|
|
.then(res => {
|
|
|
- // console.log(res);
|
|
|
- let _data = res.data.FunctionResponse.message;
|
|
|
+ console.log("👉====",res);
|
|
|
+ let _data = res.data.message;
|
|
|
_data = _data.replaceAll("```json", "").replaceAll("```", "");
|
|
|
const match = _data.match(/\[\s*{[^]*}\s*\]/);
|
|
|
// console.log("this.wangData",this.wangData);
|
|
@@ -984,19 +1036,18 @@ ${fileText}
|
|
|
|
|
|
if (this.continuousDialogue) {
|
|
|
this.array.forEach(i => {
|
|
|
- if(i.content!=0){
|
|
|
+ if (i.content != 0) {
|
|
|
_history.push(
|
|
|
- {
|
|
|
- role: "user",
|
|
|
- content: i.content
|
|
|
- },
|
|
|
- {
|
|
|
- role: "assistant",
|
|
|
- content: i.aiContent
|
|
|
- }
|
|
|
- );
|
|
|
+ {
|
|
|
+ role: "user",
|
|
|
+ content: i.content
|
|
|
+ },
|
|
|
+ {
|
|
|
+ role: "assistant",
|
|
|
+ content: i.aiContent
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
-
|
|
|
});
|
|
|
|
|
|
_history.pop();
|
|
@@ -1172,12 +1223,11 @@ ${fileText}
|
|
|
let _fileData = [];
|
|
|
let _workData = {};
|
|
|
let _fileContext = ``;
|
|
|
- console.log("👉xxxx",_array)
|
|
|
+ console.log("👉xxxx", _array);
|
|
|
_array.forEach((i, index) => {
|
|
|
let _obj = {
|
|
|
- 姓名: i.sName,
|
|
|
-
|
|
|
- };
|
|
|
+ 姓名: i.sName
|
|
|
+ };
|
|
|
if ([4].includes(this.toolType)) {
|
|
|
let _json = JSON.parse(i.works);
|
|
|
//问卷调查
|
|
@@ -1186,76 +1236,94 @@ ${fileText}
|
|
|
_obj[
|
|
|
`${i2.type == "2" ? "多选题" : "单选题"}${index2 + 1}:${
|
|
|
i2.askstitle
|
|
|
- }(选项:${i2.checkList.map((i3,index3)=>`${this.optionTypeList[index3]}:${i3}`).join('、')})`
|
|
|
+ }(选项:${i2.checkList
|
|
|
+ .map((i3, index3) => `${this.optionTypeList[index3]}:${i3}`)
|
|
|
+ .join("、")})`
|
|
|
] =
|
|
|
typeof _json[0].anwer[index2] == "object"
|
|
|
- ? _json[0].anwer[index2].map((i3)=>`${this.optionTypeList[i3]}`).join('、')
|
|
|
+ ? _json[0].anwer[index2]
|
|
|
+ .map(i3 => `${this.optionTypeList[i3]}`)
|
|
|
+ .join("、")
|
|
|
: this.optionTypeList[_json[0].anwer[index2]];
|
|
|
});
|
|
|
-
|
|
|
- }else if([1,7,3].includes(this.toolType)){
|
|
|
- _obj['链接地址'] = i.works
|
|
|
- }else if([15].includes(this.toolType)){
|
|
|
+ } else if ([1, 7, 3].includes(this.toolType)) {
|
|
|
+ _obj["链接地址"] = i.works;
|
|
|
+ } else if ([15].includes(this.toolType)) {
|
|
|
let _json = JSON.parse(i.works);
|
|
|
- _obj[`问题:${_json[0].answerTitle}`] = _json[0].answer
|
|
|
- }else if([40].includes(this.toolType)){
|
|
|
+ _obj[`问题:${_json[0].answerTitle}`] = _json[0].answer;
|
|
|
+ } else if ([40].includes(this.toolType)) {
|
|
|
let _json = JSON.parse(i.works);
|
|
|
let _testData = JSON.parse(JSON.stringify(this.testData));
|
|
|
- _testData.rateJson.forEach((i2,index2)=>{
|
|
|
- _obj[`个人评价${index2+1}:${i2.value}(描述:${i2.detail})`] = _json.eStar[index2];
|
|
|
-
|
|
|
- })
|
|
|
+ _testData.rateJson.forEach((i2, index2) => {
|
|
|
+ _obj[`个人评价${index2 + 1}:${i2.value}(描述:${i2.detail})`] =
|
|
|
+ _json.eStar[index2];
|
|
|
+ });
|
|
|
_obj[`个人评价内容`] = _json.eBzText;
|
|
|
- }else if([41].includes(this.toolType)){
|
|
|
- let selectData = i.works.split(',');
|
|
|
+ } else if ([41].includes(this.toolType)) {
|
|
|
+ let selectData = i.works.split(",");
|
|
|
let _text = [];
|
|
|
let _testData = JSON.parse(JSON.stringify(this.testData));
|
|
|
- selectData.forEach((i2,index2)=>{
|
|
|
- _text.push(_testData.selectJson.select[i2])
|
|
|
- })
|
|
|
+ selectData.forEach((i2, index2) => {
|
|
|
+ _text.push(_testData.selectJson.select[i2]);
|
|
|
+ });
|
|
|
|
|
|
// _testData.selectJson.select
|
|
|
- _obj['选择匹配'] = _text.join('-')
|
|
|
- }else if([45].includes(this.toolType)){
|
|
|
+ _obj["选择匹配"] = _text.join("-");
|
|
|
+ } else if ([45].includes(this.toolType)) {
|
|
|
let _json = JSON.parse(i.works);
|
|
|
_json[0].testJson.testJson.forEach((i2, index2) => {
|
|
|
_obj[
|
|
|
`${i2.type == "2" ? "多选题" : "单选题"}${index2 + 1}:${
|
|
|
i2.teststitle
|
|
|
- }(答案:${typeof i2.answer=='object'?i2.answer.map((i3)=>`${this.optionTypeList[i3]}`).join('、'):this.optionTypeList[i2.answer]} 选项:${i2.checkList.map((i3,index3)=>`${this.optionTypeList[index3]}:${i3}`).join('、')})`
|
|
|
+ }(答案:${
|
|
|
+ typeof i2.answer == "object"
|
|
|
+ ? i2.answer
|
|
|
+ .map(i3 => `${this.optionTypeList[i3]}`)
|
|
|
+ .join("、")
|
|
|
+ : this.optionTypeList[i2.answer]
|
|
|
+ } 选项:${i2.checkList
|
|
|
+ .map((i3, index3) => `${this.optionTypeList[index3]}:${i3}`)
|
|
|
+ .join("、")})`
|
|
|
] =
|
|
|
typeof _json[0].anwer[index2] == "object"
|
|
|
- ? _json[0].anwer[index2].map((i3)=>`${this.optionTypeList[i3]}`).join('、')
|
|
|
+ ? _json[0].anwer[index2]
|
|
|
+ .map(i3 => `${this.optionTypeList[i3]}`)
|
|
|
+ .join("、")
|
|
|
: this.optionTypeList[_json[0].anwer[index2]];
|
|
|
});
|
|
|
- }else if([47].includes(this.toolType)){
|
|
|
+ } else if ([47].includes(this.toolType)) {
|
|
|
let _json = JSON.parse(i.works);
|
|
|
- _json.forEach((i,index)=>{
|
|
|
- _obj[`排序${index+1}(正确排序:${i.rightAnswer.join('、')})`] = i.chooseSenList.join('、')
|
|
|
- })
|
|
|
- }else if([48,52].includes(this.toolType)){
|
|
|
+ _json.forEach((i, index) => {
|
|
|
+ _obj[
|
|
|
+ `排序${index + 1}(正确排序:${i.rightAnswer.join("、")})`
|
|
|
+ ] = i.chooseSenList.join("、");
|
|
|
+ });
|
|
|
+ } else if ([48, 52].includes(this.toolType)) {
|
|
|
let _json = JSON.parse(i.works);
|
|
|
- _obj['内容'] = _json.text;
|
|
|
- }else if([57].includes(this.toolType)){
|
|
|
- _obj['提交内容'] = i.works
|
|
|
- }else if([72].includes(this.toolType)){
|
|
|
- let _data = JSON.parse(i.works)
|
|
|
- let _text = ''
|
|
|
- _data.forEach((i2)=>{
|
|
|
- i2.messages.forEach(i3=>{
|
|
|
- if(i3.sender){
|
|
|
- _text+=`(${i3.sender}:${i3.content})`
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- _obj['聊天内容'] = _text;
|
|
|
+ _obj["内容"] = _json.text;
|
|
|
+ } else if ([57].includes(this.toolType)) {
|
|
|
+ _obj["提交内容"] = i.works;
|
|
|
+ } else if ([72].includes(this.toolType)) {
|
|
|
+ if (i.works && i.works != "undefined" && i.works != undefined) {
|
|
|
+ let _data = JSON.parse(i.works);
|
|
|
+ let _text = "";
|
|
|
+ _data.forEach(i2 => {
|
|
|
+ i2.messages.forEach(i3 => {
|
|
|
+ if (i3.sender || i3.role) {
|
|
|
+ _text += `(${i3.sender?i3.sender:i3.role}:${i3.content.replaceAll(',',",").replaceAll('\n',' ')})`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ _obj["聊天内容"] = _text;
|
|
|
+ }else{
|
|
|
+ _obj["聊天内容"] = "";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- _obj['提交时间'] = i.time
|
|
|
+ _obj["提交时间"] = i.time;
|
|
|
_fileData.push(_obj);
|
|
|
});
|
|
|
|
|
|
-
|
|
|
if (_fileData.length > 0) {
|
|
|
let _getKeyObj = _fileData[0];
|
|
|
let keys = Object.keys(_getKeyObj);
|
|
@@ -1265,16 +1333,13 @@ ${fileText}
|
|
|
let values = Object.values(item);
|
|
|
_fileContext += values.join(",") + "\n";
|
|
|
});
|
|
|
- }else if(_fileData.length<=0){
|
|
|
+ } else if (_fileData.length <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
let name = this.toolList.find(i => i.value == this.toolType).label;
|
|
|
|
|
|
- this.guessAskJson({name:name,data:_fileData})
|
|
|
-
|
|
|
+ this.guessAskJson({ name: name, data: _fileData });
|
|
|
|
|
|
console.log("👉", _fileContext);
|
|
|
// 创建Blob对象
|
|
@@ -1499,7 +1564,6 @@ ${fileText}
|
|
|
this.array = [];
|
|
|
this.$message.success("清除聊天记录成功");
|
|
|
this.loading = false;
|
|
|
-
|
|
|
})
|
|
|
.catch(_ => {});
|
|
|
},
|