11wqe1 6 months ago
parent
commit
d8dbec1eae

+ 118 - 88
src/components/easy2/commpont/markDialog.vue

@@ -434,7 +434,7 @@ export default {
           fullscreenToggle: true //全屏按钮
         }
       },
-      xianObj: ["DOCX", "MD", "TXT", "PDF"]
+      xianObj: ["DOCX", "MD", "TXT", "PDF" ,"PPTX"]
     };
   },
   watch: {
@@ -574,82 +574,6 @@ export default {
       // this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
     },
 
-    // async generateMsg(work) {
-    //   this.ScLoading = true;
-    //   let tit = this.scoTit;
-    //   tit.forEach((e, index) => {
-    //     if (!e.isai) {
-    //       e.isai = 1;
-    //     }
-    //   });
-    //   let _fileid = "";
-    //   if (work.type == 4 || work.type == 12) {
-    //     _fileid = await this.createFileid(work.content);
-    //   }
-    //   let con = this.cuScoCon;
-
-    //   let laws = "";
-    //   for (let i = 0; i < tit.length; i++) {
-    //     if (tit[i].isai == 1) {
-    //       laws += `评价维度:${tit[i].value} 评价细则:${tit[i].rule} \n`;
-    //     }
-    //   }
-    //   let msg = `NOTICE
-    //       Role:你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“六级评价细则”评价学生作业。
-    //       Language: Please use the same language as the user requirement, if the user speaks Chinese, the specific text of your answer should also be in Chinese.
-    //       ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
-    //       Instruction: Based on the context, follow "Format example", write content.
-
-    //       #Context
-    //       ##要求
-    //       根据<评价细则>和<作业内容>的相关性评价作业,只用输出作业的综合性“评语”,不要带标题,字数控制在150字左右,不要输出其他无关内容。
-
-
-    //       ##评分资料
-    //       评价细则:${laws}
-    //       作业内容:${_fileid ? "上传的文件内容" : con}
-
-
-    //       # Format example
-    //       学生能够全面且正确地描述光合作用中氧气和葡萄糖的生成过程,涵盖光反应和暗反应的每个阶段和主要反应物及产物。同时,学生也能够全面、准确地解释氧气和葡萄糖在植物生命活动中的重要作用,并展示了对光合作用的深入理解。论文结构良好,内容详实,逻辑清晰,论据充分。
-    //       `;
-    //   // return console.log(msg);
-
-    //   this.generateRemark(msg, _fileid);
-    // },
-    // 重新获取评语
-    // generateRemark(messages, _fileid) {
-    //   let _this = this;
-
-    //   let params = {
-    //     assistant_id: "f8e1ebb2-2e0d-11ef-8bf4-12e77c4cb76b",
-    //     message: [
-    //       {
-    //         type: "text",
-    //         text: messages.replaceAll("\n", " ").replaceAll("*", "")
-    //       }
-    //     ],
-    //     session_name: uuidv4(),
-    //     userId: this.cUserid,
-    //     file_ids: _fileid ? [_fileid] : [],
-    //     model: "gpt-4o-2024-08-06"
-    //   };
-    //   this.ajax
-    //     .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
-    //     .then(response => {
-    //       let data = response.data.FunctionResponse;
-    //       // console.log("data", data);
-    //       this.textarea = data.message;
-    //       // this.selectSWorksData()
-    //       this.ScLoading = false;
-    //     })
-    //     .catch(error => {
-    //       this.ScLoading = false;
-
-    //       _this.$message.error("评价失败");
-    //       console.log(error);
-    //     });
-    // },
     // ai评分
     async AIsubmit(work) {
       // return console.log("con", this.scoTit, this.cuScoCon);
@@ -770,7 +694,6 @@ export default {
               processedData[key] = value;
             });
 
-            console.log(JSON.parse(JSON.stringify(processedData)),this.scoTitList);
 
             let IsAIsuccess = 0
 
@@ -787,9 +710,19 @@ export default {
               }
               continue;
             }
-            if (IsAIsuccess != this.scoTitList.length) {
-              _this.$message.error("评价失败");
-              _this.ScLoading = false;
+
+            let scotNum = 0
+            this.scoTitList.forEach(e=>{
+              if (e.isai == 1) {
+                scotNum++
+              }
+            })
+
+
+            if (IsAIsuccess != scotNum) {
+              // _this.$message.error("评价失败");
+              // _this.ScLoading = false;
+              this.aiGet2(messages,_fileid)
               return
             }
 
@@ -819,8 +752,9 @@ export default {
                 _this.selectSWorksData();
               })
               .catch(err => {
-                _this.ScLoading = false;
-                _this.$message.error("评价失败");
+                // _this.ScLoading = false;
+                // _this.$message.error("评价失败");
+                this.aiGet2(messages,_fileid)
 
                 console.error(err);
               });
@@ -828,8 +762,9 @@ export default {
           this.$forceUpdate();
         })
         .catch(error => {
-          _this.$message.error("评价失败");
-          _this.ScLoading = false;
+          // _this.$message.error("评价失败");
+          // _this.ScLoading = false;
+          this.aiGet2(messages,_fileid)
 
           console.log(error);
         });
@@ -852,7 +787,7 @@ export default {
       if (this.current < this.workList.length - 1) {
         this.current++;
         this.DgUid = this.workList[this.current].userid;
-        this.selectSWorksData();
+        this.selectSWorksData2();
       } else {
         this.$message.info("已经是最后一位了");
       }
@@ -863,7 +798,7 @@ export default {
 
       this.current = index;
       this.DgUid = val;
-      this.selectSWorksData();
+      this.selectSWorksData2();
     },
     // 任务得分折叠
     revealBtn() {
@@ -995,7 +930,101 @@ export default {
               if (this.currentUid.type == 5) {
                 this.playerOptions.sources[0].src = this.currentUid.content;
               }
-              // this.current = index;
+              this.current = index;
+              this.workId = e.id;
+              this.appraise(e);
+            }
+          });
+
+          let likeData = res.data[1];
+          this.likeList = [];
+          likeData.forEach(e => {
+            if (e.workId == this.workId) {
+              this.likeList.push(e);
+            }
+          });
+
+          let commentData = res.data[2];
+          this.commentList = [];
+          commentData.forEach(e => {
+            if (e.workId == this.workId) {
+              this.commentList.push(e);
+            }
+          });
+          this.vLoading = false;
+        });
+    },
+
+    selectSWorksData2() {
+      this.vLoading = true;
+      this.textarea = "";
+
+      let params = {
+        uid: this.DgUid,
+        cid: this.cid,
+        s: this.stage,
+        t: this.task,
+        g: this.toolIndex
+      };
+      // return console.log(params);
+      this.ajax
+        .get(this.$store.state.api + "selectMarkDialogWorks", params)
+        .then(res => {
+          let data = res.data[0];
+
+          data.forEach(e => {
+            if (e.rate) {
+              let data2 = JSON.parse(e.rate);
+
+              e.markSco = 0;
+              let k = 0
+
+              for (const key in data2) {
+                if (data2[key] && key != "content" || data2[key] == "0" ) {
+                  e.markSco += data2[key] * 1;
+                }else{
+                  k += 1
+                }
+              }
+              
+              if (k > 1) {
+                e.markSco = null;
+              }else{
+                e.markSco = (e.markSco / this.scoTitList.length).toFixed(1);
+              }
+            } else {
+              e.markSco = null;
+            }
+          });
+          this.workList = data;
+
+          data.forEach((e, index) => {
+            if (e.userid == this.DgUid) {
+              this.currentUid = e;
+
+              if (
+                this.currentUid.type == 3 ||
+                this.currentUid.type == 10 ||
+                this.currentUid.type == 13
+                // this.currentUid.type == 15
+              ) {
+                this.currentUid.content = JSON.parse(e.content);
+                this.cuScoCon = this.currentUid.content.text;
+              }
+              if (this.currentUid.type == 4) {
+                let a = this.currentUid.content;
+                let data = a.slice(a.lastIndexOf(".") + 1);
+                this.cuScoCon = this.currentUid.content;
+
+                if (data == "pdf") {
+                  this.ifPdf = 1;
+                } else {
+                  this.ifPdf = 0;
+                }
+              }
+              if (this.currentUid.type == 5) {
+                this.playerOptions.sources[0].src = this.currentUid.content;
+              }
               this.workId = e.id;
               this.appraise(e);
             }
@@ -1019,6 +1048,7 @@ export default {
           this.vLoading = false;
         });
     },
+    
     downloadFile(url) {
       var credentials = {
         accessKeyId: "AKIATLPEDU37QV5CHLMH",

+ 34 - 29
src/components/easy2/commpont/markScore.vue

@@ -214,8 +214,6 @@ export default {
         });
     },
     markScoreDigBtn() {
-      // console.log('11112222');
-
       this.$emit("markScoreDig", {
         val: this.stUid,
         val2: this.toolIndex,
@@ -321,7 +319,7 @@ export default {
     },
 
     // ai打分
-    aiGet2(messages, callback) {
+    aiGet2(messages) {
       // console.log(this.toolIndex, this.wIndex);
       let _this = this;
 
@@ -439,7 +437,6 @@ export default {
           }
           this.$forceUpdate();
 
-          callback ? callback() : "";
         })
         .catch(error => {
           // _this.markScoPopover = false;
@@ -458,7 +455,7 @@ export default {
 
 
     // ai循环评分
-    async aiupdetaSco(messages, uid, stage, task,_fileid, callback) {
+    async aiupdetaSco(messages, uid, stage, task,_fileid) {
       let _this = this;
       let params = {
         assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
@@ -473,12 +470,12 @@ export default {
         file_ids: _fileid ? [_fileid] : [],
         model: "gpt-4o-2024-08-06"
       };
-      return new Promise(resolve => {
+      return new Promise((resolve,reject) => {
         this.ajax
           .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
-          .then(response => {
+          .then( response => {
             let data = response.data.FunctionResponse;
-            // console.log(data);
+            console.log(data);
 
             if (data.message) {
               let dArray = {};
@@ -505,6 +502,7 @@ export default {
                     dArray = JSON.parse(
                       data.message
                         .replaceAll("```json", "")
+                        .replaceAll("```javaScript", "")
                         .replaceAll("# Solution", "")
                         .replaceAll("```", "")
                         .replace(/\n/g, "")
@@ -540,25 +538,29 @@ export default {
                 }
                 continue;
               }
-              if (IsAIsuccess != this.scoTitList.length) {
-                _this.$message.error("评价失败");
-                resolve(1);
-                return
-              }
+              let scotNum = 0
+              this.scoTitList.forEach(e=>{
+                if (e.isai == 1) {
+                  scotNum++
+                }
+              })
 
 
+              if (IsAIsuccess != scotNum) {
+                console.log("评价失败");
+                _this.ScLoading = false;
+               return  _this.aiupdetaSco(messages, uid, stage, task,_fileid).then(_=>{
+                  resolve();
+                })
+              }
+
               for (const key in processedData) {
-                // if (!Number.isFinite(processedData[key] * 1)) {
-                //   processedData[key] = 0;
-                // }
                 if (key == "评语") {
                   processedData.content = processedData[key];
                 }
               }
               delete processedData["评语"];
 
-              // processedData.content = this.textarea;
-
               let params = {
                 cid: _this.id,
                 s: stage,
@@ -570,25 +572,28 @@ export default {
               _this.ajax
                 .get(_this.$store.state.api + "updateWorksEva", params)
                 .then(res => {
-                  resolve(1);
-                  _this.$message({
-                    message: "评价成功",
-                    type: "success"
-                  });
+                  console.log('999999999999999999999999999999999999999999999999999');
+                  
+                  return resolve(1);
+                  
                 })
                 .catch(err => {
-                  resolve(1);
-                  _this.$message.error("评价失败");
                   console.error(err);
+
+                  return _this.aiupdetaSco(messages, uid, stage, task,_fileid).then(_=>{
+                  resolve();
+                })
+
                 });
+                
             }
-            callback ? callback() : "";
           })
           .catch(error => {
-            resolve(1);
-            _this.$message.error("评价失败");
-            // _this.loading = false
             console.log(error);
+            
+            return _this.aiupdetaSco(messages, uid, stage, task,_fileid).then(_=>{
+                  resolve();
+                })
           });
       });
     },

+ 38 - 12
src/components/easy2/studyStudent.vue

@@ -13655,6 +13655,7 @@ export default {
         }
       }
 
+      let forAllList = []
        for (let i = 0; i < con.length; i++) {
         let _fileid = ''
         let wok = con[i].works
@@ -13696,24 +13697,49 @@ export default {
         `
        
         let mk = `markSco${toolIndex}${i}`
-        await this.$refs[mk][0].aiupdetaSco(msg,con[i].userid,stage,task,_fileid)
+        let mkAwit = this.$refs[mk][0].aiupdetaSco(msg,con[i].userid,stage,task,_fileid) 
        
+        forAllList.push(mkAwit)
 
-        // this.refreshKey++
-        this.$refs[mk][0].getData()
 
-        this.AIloading[toolIndex][i].loading=false
+
+        
+        // this.$refs[mk][0].getData()
+
+        // this.AIloading[toolIndex][i].loading=false
       }
-      this.loopLoading[toolIndex].loading = false;
+      // console.log('forAllList',forAllList);
+      
+      // Promise.allSettled(forAllList)
+      // .then(results => {
+      //   results.forEach(result => {
+      //     if (result.status === 'fulfilled') {
+      //       console.log('成功:', result.value);
+      //     } else if (result.status === 'rejected') {
+      //       console.log('失败:', result.reason);
+      //       // 在这里可以选择如何处理失败的 Promise,而不会中止整个 Promise.allSettled
+      //     }
+      //   });
+      // });
+      Promise.all(forAllList).then(values=>{
+        console.log('values',values)
+        this.$message({
+          message: "评价成功",
+          type: "success"
+        });
+        
+        this.refreshKey++
 
-      worksStudent.forEach((e,index)=>{
-          if(toolIndex != index){
-            e.forEach((i,inx)=>{
-              let mk = `markSco${index}${inx}`
-              this.$refs[mk][0].getData()
-            })
-          }
+        this.AIloading[toolIndex].forEach(e=>{
+          e.loading =false
         })
+        this.loopLoading[toolIndex].loading = false;
+
+      }).catch(reason=>{
+          console.error('reasonreasonreasonreasonreason',reason);
+          // 输出“失败原因”
+      })
+      
     },
     againEva(i,k){