qgt 2 月之前
父節點
當前提交
064eca747a
共有 1 個文件被更改,包括 111 次插入70 次删除
  1. 111 70
      src/components/components/intelligentAnalysis/checkAi/aiLeader.vue

+ 111 - 70
src/components/components/intelligentAnalysis/checkAi/aiLeader.vue

@@ -405,9 +405,11 @@ export default {
       type: Array,
       type: Array,
       default: () => []
       default: () => []
     },
     },
-    testData:{
-      type:Object,
-      default:()=>{return {}}
+    testData: {
+      type: Object,
+      default: () => {
+        return {};
+      }
     }
     }
   },
   },
   directives: {
   directives: {
@@ -556,8 +558,35 @@ export default {
       curRequestController: null,
       curRequestController: null,
       continuousDialogue: true,
       continuousDialogue: true,
       copyWorksStudent: [],
       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: {
   watch: {
@@ -583,7 +612,7 @@ export default {
   },
   },
   methods: {
   methods: {
     async guessAskJson(fileData) {
     async guessAskJson(fileData) {
-      if(!this.getWanDataFlag)return;
+      if (!this.getWanDataFlag) return;
       this.getWanDataFlag = false;
       this.getWanDataFlag = false;
       let _uid = uuidv4();
       let _uid = uuidv4();
       this.getWangLoading = true;
       this.getWangLoading = true;
@@ -591,7 +620,7 @@ export default {
       this.wangData = "";
       this.wangData = "";
       let fileText = ``;
       let fileText = ``;
       // fileData.forEach(i => {
       // fileData.forEach(i => {
-        fileText += `作业类别:${fileData.name}
+      fileText += `作业类别:${fileData.name}
 作业数据:
 作业数据:
 ${JSON.stringify(fileData.data)}
 ${JSON.stringify(fileData.data)}
 
 
@@ -984,19 +1013,18 @@ ${fileText}
 
 
         if (this.continuousDialogue) {
         if (this.continuousDialogue) {
           this.array.forEach(i => {
           this.array.forEach(i => {
-            if(i.content!=0){
+            if (i.content != 0) {
               _history.push(
               _history.push(
-              {
-                role: "user",
-                content: i.content
-              },
-              {
-                role: "assistant",
-                content: i.aiContent
-              }
-            );
+                {
+                  role: "user",
+                  content: i.content
+                },
+                {
+                  role: "assistant",
+                  content: i.aiContent
+                }
+              );
             }
             }
-            
           });
           });
 
 
           _history.pop();
           _history.pop();
@@ -1172,12 +1200,11 @@ ${fileText}
           let _fileData = [];
           let _fileData = [];
           let _workData = {};
           let _workData = {};
           let _fileContext = ``;
           let _fileContext = ``;
-          console.log("👉xxxx",_array)
+          console.log("👉xxxx", _array);
           _array.forEach((i, index) => {
           _array.forEach((i, index) => {
             let _obj = {
             let _obj = {
-                姓名: i.sName,
-
-              };
+              姓名: i.sName
+            };
             if ([4].includes(this.toolType)) {
             if ([4].includes(this.toolType)) {
               let _json = JSON.parse(i.works);
               let _json = JSON.parse(i.works);
               //问卷调查
               //问卷调查
@@ -1186,76 +1213,94 @@ ${fileText}
                 _obj[
                 _obj[
                   `${i2.type == "2" ? "多选题" : "单选题"}${index2 + 1}:${
                   `${i2.type == "2" ? "多选题" : "单选题"}${index2 + 1}:${
                     i2.askstitle
                     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"
                   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]];
                     : 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);
               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 _json = JSON.parse(i.works);
               let _testData = JSON.parse(JSON.stringify(this.testData));
               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;
               _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 _text = [];
               let _testData = JSON.parse(JSON.stringify(this.testData));
               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
               // _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);
               let _json = JSON.parse(i.works);
               _json[0].testJson.testJson.forEach((i2, index2) => {
               _json[0].testJson.testJson.forEach((i2, index2) => {
                 _obj[
                 _obj[
                   `${i2.type == "2" ? "多选题" : "单选题"}${index2 + 1}:${
                   `${i2.type == "2" ? "多选题" : "单选题"}${index2 + 1}:${
                     i2.teststitle
                     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"
                   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]];
                     : this.optionTypeList[_json[0].anwer[index2]];
               });
               });
-            }else if([47].includes(this.toolType)){
+            } else if ([47].includes(this.toolType)) {
               let _json = JSON.parse(i.works);
               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);
               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);
             _fileData.push(_obj);
           });
           });
 
 
-
           if (_fileData.length > 0) {
           if (_fileData.length > 0) {
             let _getKeyObj = _fileData[0];
             let _getKeyObj = _fileData[0];
             let keys = Object.keys(_getKeyObj);
             let keys = Object.keys(_getKeyObj);
@@ -1265,16 +1310,13 @@ ${fileText}
               let values = Object.values(item);
               let values = Object.values(item);
               _fileContext += values.join(",") + "\n";
               _fileContext += values.join(",") + "\n";
             });
             });
-          }else if(_fileData.length<=0){
+          } else if (_fileData.length <= 0) {
             return;
             return;
           }
           }
 
 
-          
-
           let name = this.toolList.find(i => i.value == this.toolType).label;
           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);
           console.log("👉", _fileContext);
           // 创建Blob对象
           // 创建Blob对象
@@ -1499,7 +1541,6 @@ ${fileText}
           this.array = [];
           this.array = [];
           this.$message.success("清除聊天记录成功");
           this.$message.success("清除聊天记录成功");
           this.loading = false;
           this.loading = false;
-
         })
         })
         .catch(_ => {});
         .catch(_ => {});
     },
     },