11wqe1 hai 11 meses
pai
achega
2e6b08da04
Modificáronse 2 ficheiros con 247 adicións e 61 borrados
  1. 44 34
      src/components/easy2/commpont/markScore.vue
  2. 203 27
      src/components/easy2/studyStudent.vue

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

@@ -65,18 +65,17 @@ export default {
   computed: {
     totalScore() {
       let a = 0;
-     
       let isPing = 0;
       this.scoTitList.forEach(e => {
-        console.log(e.cog);
         if (!e.cog && e.cog != 0) {
           isPing += 1;
         } else {
-          a += e.cog;
+          a += e.cog * 1;
         }
       });
+
       let data = 0;
-      if (isPing != 0) {
+      if (isPing == this.scoTit.length) {
         this.$emit("updateDocSco", {
           val: this.toolIndex,
           val2: this.wIndex,
@@ -110,32 +109,34 @@ export default {
       this.ajax
         .get(this.$store.state.api + "selectWorksEvaScore", params)
         .then(res => {
+          // console.log("res", res.data);
+
           if (res.data[0].length > 0) {
             var data2 = [];
             res.data[0].forEach((val, index) => {
               if (val.task == this.task) {
                 data2 = res.data[0][index];
+                this.homeworkVal = res.data[0][index];
               }
             });
             if (data2.length == 0) {
               this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
-              // this.$emit("updateDocSco", {
-              //   val: this.toolIndex,
-              //   val2: this.wIndex,
-              //   val3: ''
-              // });
             } else {
               let data = JSON.parse(data2.rate);
               this.scoTitList.forEach((e, index) => {
-                e.cog = 0;
+                e.cog = null;
                 for (const key in data) {
                   if (e.value == key) {
                     e.cog = data[key] * 1;
                   }
                 }
               });
+              this.scoTitList = JSON.parse(JSON.stringify(this.scoTitList));
+
+              // console.log(this.scoTitList);
             }
-            // console.log('this.scoTitList',this.scoTitList);
+          } else {
+            this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
           }
         })
         .catch(err => {
@@ -144,11 +145,12 @@ export default {
     },
     // 重置
     reset() {
-      // console.log("this.scoTitList", this.scoTitList);
       this.scoTitList.forEach(e => {
         e.cog = 0;
+        console.log(e.cog);
       });
     },
+
     // 老师提交评分
     submit() {
       let data = this.scoTitList.map(e => {
@@ -159,8 +161,9 @@ export default {
 
       data.forEach(item => {
         const [key, value] = item.split(":");
-        processedData[key] = Number(value);
+        processedData[key] = Number(value) ? Number(value) : 0;
       });
+
       processedData.content = "";
       // console.log(processedData);
       let params = {
@@ -178,6 +181,7 @@ export default {
             message: "评价成功",
             type: "success"
           });
+          this.$emit("refreshOther", this.toolIndex);
         })
         .catch(err => {
           this.$message.error("评价失败");
@@ -188,8 +192,12 @@ export default {
     // ai评分
     AIsubmit() {
       let tit = this.scoTit;
+      tit.forEach((e,index)=>{
+          if(!e.isai){
+            e.isai=1
+          }
+        })
       let con = JSON.parse(this.scoCon.works);
-      // this.markScoPopover = true;
       this.$emit("updateLoading", {
         val: this.toolIndex,
         val2: this.wIndex,
@@ -197,39 +205,43 @@ export default {
       });
       let _text = "";
       for (let i = 0; i < tit.length; i++) {
-        _text += `评价名称:${tit[i].value} 评价描述:${tit[i].detail} \n`;
+        if (tit[i].isai == 1) {
+          _text += `评价名称:${tit[i].value} 评价描述:${tit[i].detail} \n`;
+        }
+      }
+      let laws = ""
+      for (let i = 0; i < tit.length; i++) {
+        if(tit[i].isai == 1){
+          laws += `评价维度:${tit[i].value} 评价细则:${tit[i].rule} \n`
+        }
       }
-      // console.log(_text);
+      
+    //  console.log(_text);
       let msg = `NOTICE
-      Role: 你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“五级评价细则”给学生作品评分,并生成需要的JSON数据。
+      Role: 你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“级评价细则”给学生作品评分,并生成需要的JSON数据。
       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
       ##要求
-      根据<评价细则>和<作业内容>与<作业题目>的相关性评价作业,判断该作业属于五级中的哪个等级。
-      具体的评价标准分为5级——1级,2级,3级,4级,5级。
-      1 级,没有识别问题和需求;
-      2 级,问题或需求没有被清晰理解或准确识别;
-      3 级,问题或需求的一部分被识别;
-      4 级,问题或需求的大部分被识别;
-      5 级,问题或需求都被识别。
+      根据<评价细则>和<作业内容>的相关性评价作业,判根据细则评价作业,判断该作业属于六级中的哪个等级。如果作业内容与评价细则无关,则直接评为0星。
+      
+
       
       ##评分资料
-      评价细则:${_text}
-      作业题目:${this.toolDetail}
+      评价细则:${laws}
       作业内容:${con.text}
 
       # Format example
       [{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'}]
       `;
-      // console.log(msg);
+      console.log(msg);
       this.aiGet2(msg);
     },
     // ai打分
     aiGet2(messages, callback) {
-      console.log(this.toolIndex, this.wIndex);
+      // console.log(this.toolIndex, this.wIndex);
       let _this = this;
       // let parm = {
       //   assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
@@ -265,7 +277,7 @@ export default {
         .post("https://gpt4.cocorobo.cn/chat", params)
         .then(response => {
           let data = response.data.FunctionResponse;
-          // console.log("data", data);
+          console.log("data", data);
           if (data.choices && data.choices.length && data.choices[0].message) {
             let dArray = {};
             try {
@@ -278,17 +290,14 @@ export default {
               console.log("error_________________" + error);
               try {
                 let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
-                // 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(
@@ -313,6 +322,7 @@ export default {
             //   _this.$emit("updateLoading", {val:_this.task,val2:_this.wIndex,val3:false});
             // }
             let processedData = {};
+            // return console.log(dArray);
 
             dArray.forEach(function(item) {
               let key = Object.keys(item)[0];
@@ -343,13 +353,13 @@ export default {
                   message: "评价成功",
                   type: "success"
                 });
-                console.log(_this.wIndex, _this.task);
+                // console.log(_this.wIndex, _this.task);
                 _this.$emit("updateLoading", {
                   val: _this.toolIndex,
                   val2: _this.wIndex,
                   val3: false
                 });
-
+                _this.$emit("refreshOther", _this.toolIndex);
                 _this.getData();
                 // _this.markScoPopover = false;
                 // _this.$emit("update:loading", false);

+ 203 - 27
src/components/easy2/studyStudent.vue

@@ -6642,6 +6642,7 @@
                               :ref="`markSco${toolIndex}${wIndex}`"
                               @updateLoading=updateLoading
                               @updateDocSco=updateDocSco
+                              @refreshOther=refreshOther
                               :wIndex="wIndex"
                               :scoCon="w" 
                               :TotalScore="AIloading[toolIndex][wIndex].sco"
@@ -6681,7 +6682,7 @@
                             v-if="
                               w.userid == userid || tType == 1 || tType == 4
                             "
-                            @click.stop="deleteWorks(w.wid)"
+                            @click.stop="deleteWorksTwo(w.wid,toolIndex,wIndex)"
                             alt
                           />
                         </div>
@@ -7863,8 +7864,19 @@
                     stripe
                     style="width: 100%"
                   >
+                  <el-table-column width="150" label="目标" align="center">
+                      <template slot-scope="scope"
+                        ><div>
+                          {{
+                            scope.row.target
+                              ? scope.row.target[scope.row.target.length - 1]
+                              : "-"
+                          }}
+                        </div></template
+                      ></el-table-column
+                    >
                     <el-table-column
-                      label="评价名称"
+                      label="评价维度"
                       align="center"
                     >
                       <template slot-scope="scope"
@@ -7872,7 +7884,7 @@
                       >
                     </el-table-column>
                     <el-table-column
-                      label="评价描述"
+                      label="维度描述"
                       align="center"
                     >
                       <template slot-scope="scope"
@@ -7881,17 +7893,27 @@
                         </div></template
                       >
                     </el-table-column>
-                    <el-table-column label="目标" align="center">
-                      <template slot-scope="scope"
-                        ><div>
-                          {{
-                            scope.row.target
-                              ? scope.row.target[scope.row.target.length - 1]
-                              : "-"
-                          }}
-                        </div></template
-                      ></el-table-column
+
+                    <el-table-column
+                      label="细则"
+                      align="center"
+                      v-if="courseDetail.state == 5"
                     >
+                      <template slot-scope="scope"
+                        ><div style="display:flex;justify-content: space-around;margin:auto" v-if="scope.row.rule">
+                          <el-popover
+                            placement="top"
+                            width="350"
+                            trigger="hover"
+                            >
+                            <div v-html="scope.row.rule" style="white-space:pre-wrap"></div>
+                            <div slot="reference" style="color:#4383FF;cursor: pointer;">查看</div>
+                          </el-popover>
+                        </div>
+                        <div v-else>-</div>
+                        </template
+                      >
+                    </el-table-column>
                   </el-table>
                   <!-- <div
                     v-for="(eItem, eIndex) in chapInfoList[courseType]
@@ -12494,6 +12516,12 @@ export default {
 		},
     async loopEva(con,tit,stage,task,toolIndex,toolDetail,worksStudent){
         // console.log(con,tit,stage,task,toolIndex,toolDetail);
+        tit.forEach((e,index)=>{
+          if(!e.isai){
+            e.isai=1
+          }
+        })
+        // return console.log(tit)
 
         let jude = false
         this.AIloading.forEach((e,index)=>{
@@ -12519,24 +12547,29 @@ export default {
       
       let _text = ''
       for (let i = 0; i < tit.length; i++) {
+        if(tit[i].isai == 1){
           _text += `评价名称:${tit[i].value} 评价描述:${tit[i].detail} \n`
+        }
       }
+      let laws = ""
+      for (let i = 0; i < tit.length; i++) {
+        if(tit[i].isai == 1){
+          laws += `评价维度:${tit[i].value} 评价标准:${tit[i].rule} \n`
+        }
+      }
+
        for (let i = 0; i < con.length; i++) {
         let msg = `NOTICE
-        Role: 你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“五级评价细则”给学生作品评分,并生成需要的JSON数据。
+        Role: 你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“级评价细则”给学生作品评分,并生成需要的JSON数据。
         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
         ##要求
-        根据<评价细则>和<作业内容>与<作业题目>的相关性评价作业,判断该作业属于五级中的哪个等级。
-        具体的评价标准分为5级——1级,2级,3级,4级,5级。
-        1 级,没有识别问题和需求;
-        2 级,问题或需求没有被清晰理解或准确识别;
-        3 级,问题或需求的一部分被识别;
-        4 级,问题或需求的大部分被识别;
-        5 级,问题或需求都被识别。
+        根据<评价细则>和<作业内容>与<作业题目>的相关性评价作业,判断该作业对应的评价维度标准属于六级中的哪个等级。
+        具体的评价标准分为6级——0级,1级,2级,3级,4级,5级。
+        ${laws}
 
         ##评分资料
         评价细则:${_text}
@@ -12554,8 +12587,6 @@ export default {
 
         this.AIloading[toolIndex][i].loading=false
       }
-      // console.log('666666666');
-      // console.log('this.loopLoading', this.loopLoading);
       this.loopLoading[toolIndex].loading = false;
 
       worksStudent.forEach((e,index)=>{
@@ -12566,14 +12597,106 @@ export default {
             })
           }
         })
+    },
+    againEva(i,k){
+      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
+        ##要求
+        根据<评价维度>和<维度描述>,制定具体的评价标准。
+        具体的评价标准分为6级——0星,1星,2星,3星,4星,5星。
+
+        ##制定标准资料
+        评价维度:${this.chapInfoList[0].chapterInfo[0].taskJson[i].eList[k].value}
+        维度描述:${this.chapInfoList[0].chapterInfo[0].taskJson[i].eList[k].detail}
+
+        # Format example
+        0 星,作业内容与作业要求无关;
+        1 星,没有识别问题和需求;
+        2 星,问题或需求没有被清晰理解或准确识别;
+        3 星,问题或需求的一部分被识别;
+        4 星,问题或需求的大部分被识别;
+        5 星,问题或需求都被识别。 
+        
+        `
+      let params = {
+        // "model": "Chat",
+        model: "gpt-4o",
+        temperature: 0,
+        max_tokens: 4096,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [
+          {
+            content: msg.replaceAll("\n", " ").replaceAll("*", ""),
+            role: "user"
+          }
+        ],
+        stream: false,
+        uid: this.userid,
+        mind_map_question: ""
+      };
+      
+        this.ajax
+          .post("https://gpt4.cocorobo.cn/chat", params)
+          .then(response => {
+            let data = response.data.FunctionResponse;
+            console.log("data", data);
+            if (data.choices && data.choices.length && data.choices[0].message) {
+              let content = data.choices[0].message.content;
+              
+              // 使用正则表达式匹配# Output段落的内容
+              const outputRegex = /# Output([\s\S]*?)(?:#|$)/;
+              const outputMatch = content.match(outputRegex);
+              
+              // if (outputMatch) {
+              // let outputContent = outputMatch[1].trim(); // 提取# Output段落的内容并去除首尾空格
+              console.log('outputContent',content);
+              console.log('this.chapInfoList',this.chapInfoList);
+              let elist = JSON.parse(JSON.stringify(this.chapInfoList[0].chapterInfo[0].taskJson[i].eList[k]))
+              // this.chapInfoList[0].chapterInfo[0].taskJson[i].eList[k].rule=JSON.parse(JSON.stringify(content.replaceAll("#", "")))
+              elist.rule = JSON.parse(JSON.stringify(content.replaceAll("#", "")))
+              this.$set(this.chapInfoList[0].chapterInfo[0].taskJson[i].eList,k,elist)
+              this.$forceUpdate();
+              let params2 = [
+                {
+                  cid: this.id,
+                  chapters: JSON.stringify(this.chapInfoList),
+                  uid: this.userid,
+                  unitIndex: this.courseType,
+                },
+              ];
+              this.ajax
+                .post(this.$store.state.api + "updateWorkNew4", params2)
+                .then((res) => {
+                  this.getCourseDetail(2);
+                  this.$forceUpdate();
+                })
+                .catch((err) => {
+                  this.$message.error("网络不佳");
+                  console.error(err);
+                });
+                  // 进行进一步处理或解析outputContent
+              // } else {
+              //     console.log("No match found for # Output section.");
+              // }
+            }
+          })
+          .catch(error => {
+            console.log(error);
+          });
 
     },
 
     // 组件刷新
     refreshAssembly(val){
       this.refreshKey++
-      console.log(this.refreshKey)
+      // console.log(this.refreshKey)
     },
     updateLoading(payload){
       this.AIloading[payload.val][payload.val2].loading=payload.val3
@@ -12584,11 +12707,14 @@ export default {
       this.$refs[mk][0].getData()
     },
     handleHide(toolIndex,val,worksStudent) {
-      // console.log(worksStudent)
       let mk = `markSco${toolIndex}${val}`
       this.$refs[mk][0].getData()
+    },
 
-      worksStudent.forEach((e,index)=>{
+    // 刷新其他组件分数
+    refreshOther(toolIndex){
+
+      this.worksStudent.forEach((e,index)=>{
         if(toolIndex != index){
           e.forEach((i,inx)=>{
             let mk = `markSco${index}${inx}`
@@ -14545,7 +14671,7 @@ export default {
         .then(() => {
           let params = [
             {
-              id: id,
+              id: id
             },
           ];
           this.ajax
@@ -14566,6 +14692,43 @@ export default {
         })
         .catch(() => {});
     },
+    deleteWorksTwo(id,toolIndex,wIndex) {
+      console.log(id)
+      let mk = `markSco${toolIndex}${wIndex}`
+      console.log(this.$refs[mk][0].homeworkVal)
+
+      let wid = this.$refs[mk][0].homeworkVal.id
+      this.$confirm("确定删除此作业吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          let params = [
+            {
+              id: id,
+              wid: wid ? wid : 1
+            },
+          ];
+          // return console.log(params)
+          this.ajax
+            .post(this.$store.state.api + "deleteCourseWorkTwo", params)
+            .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              this.selectStudent();
+              this.selectSWorks();
+              this.selectSLook();
+            })
+            .catch((err) => {
+              this.$message.error("网络异常");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
+    },
     selectSWorks(gindex) {
       //教师查看全部作业
       let params = {
@@ -16707,6 +16870,8 @@ export default {
               this.courseType
             ];
             this.chapInfoList = JSON.parse(this.courseDetail.chapters);
+            console.log('this.chapInfoList22222',this.chapInfoList);
+
             if (this.tcid && res.data[1].length) {
               let _inviteA = [];
               for (var ik = 0; ik < res.data[1].length; ik++) {
@@ -16940,6 +17105,16 @@ export default {
             this.vChapterData = _chapterData;
             this.$forceUpdate();
           }
+          if(this.courseDetail.state == 5){
+            let chapInfoListCopy = this.chapInfoList[0].chapterInfo[0].taskJson;
+           
+            for (let k = 0; k < chapInfoListCopy[this.taskCount].eList.length; k++) {
+              if(!chapInfoListCopy[this.taskCount].eList[k].rule){
+                this.againEva(this.taskCount,k)
+              }
+            }
+          }
+
           //  else {
           //   this.courseDetail = res.data[0][0];
           //   this.chapInfoList = JSON.parse(this.courseDetail.chapters);
@@ -17503,6 +17678,7 @@ export default {
         .then((res) => {
           if (res.data[0].length > 0 && this.IsLookOpen && type == 1) {
             this.chapInfoList = JSON.parse(res.data[0][0].state);
+            console.log('this.chapInfoList',this.chapInfoList);
             this.setNavList();
             this.$forceUpdate();
           } else if (res.data[0].length > 0 && this.IsLookOpen && type == 2) {