Browse Source

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-student-table into beta

SanHQin 7 months ago
parent
commit
e2b4038731

+ 1 - 1
dist/index.html

@@ -27,7 +27,7 @@
     html,
     body{
       font-family: '黑体';
-    }</style><link href=./static/css/app.9010df89b8e3b1902d92235f43fc56d4.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.0eb3ff1f4c979300a113.js></script><script type=text/javascript src=./static/js/app.ed97b9131fb027bc9900.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.377094b0fd36f6a704cef71e62c31b09.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.0eb3ff1f4c979300a113.js></script><script type=text/javascript src=./static/js/app.038ddfc22acf21e94d2f.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.377094b0fd36f6a704cef71e62c31b09.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.377094b0fd36f6a704cef71e62c31b09.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.9010df89b8e3b1902d92235f43fc56d4.css.map


BIN
dist/static/img/alarmClock.d70699d.png


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.038ddfc22acf21e94d2f.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.038ddfc22acf21e94d2f.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map


+ 148 - 43
src/components/easy2/commpont/markScore.vue

@@ -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) {

+ 21 - 49
src/components/easy2/studyStudent.vue

@@ -6557,7 +6557,7 @@
                           展开
                         </div>
                       </div>
-                      <div v-if="chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].eList && courseDetail.state == 5">
+                      <div v-if="courseDetail.userid == userid && chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].eList && courseDetail.state == 5">
                         <div class="ScoreBtn" v-if="!loopLoading[toolIndex].loading" @click="loopEva(worksStudent[toolIndex],chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].eList,courseType,taskCount,toolIndex,tool.toolDetail)" >
                           <img src="../../assets/icon/newIcons/rootImg.png" alt="">
                           AI评分
@@ -6635,20 +6635,22 @@
                               :disabled="AIloading[toolIndex][wIndex].loading"
                               trigger="click"
                               >
+                              <!-- {{w}} -->
                             <markScore 
                               :loading="AIloading[toolIndex][wIndex].loading" 
                               ref="markSco" 
                               @updateLoading=updateLoading
                               @updateDocSco=updateDocSco
-                              :wIndex=wIndex
+                              :wIndex="wIndex"
                               :scoCon="w" 
                               :TotalScore="AIloading[toolIndex][wIndex].sco"
                               :toolIndex="toolIndex" 
                               :key="refreshKey" 
-                              :toolDetail=tool.toolDetail
+                              :refreshKey="refreshKey"
+                              :toolDetail="tool.toolDetail"
                               :stage="courseType"
                               :task="taskCount"  
-                              :scoTit=chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].eList>
+                              :scoTit="chapInfoList[courseType].chapterInfo[0].taskJson[taskCount].eList">
                             </markScore>
                               <div
                                 class="answerScore"
@@ -6662,7 +6664,9 @@
                                     w.ateacher == userid,
                                 }"
                               >
-                              <span v-if="AIloading[toolIndex][wIndex].sco">{{ AIloading[toolIndex][wIndex].loading? '评分中' : AIloading[toolIndex][wIndex].sco + "分" }}</span>
+                              <span v-if="AIloading[toolIndex][wIndex].sco">
+                                {{ AIloading[toolIndex][wIndex].loading? '评分中' : AIloading[toolIndex][wIndex].sco + "分" }}
+                              </span>
                               <span v-else>
                                 {{AIloading[toolIndex][wIndex].loading? '评分中' :'评分'}}{{w.Total}}
                               </span>    
@@ -12443,43 +12447,14 @@ export default {
 			},
 			classRoomHelperWidth: '85px',
 			orgArray:['1973f6c7-1561-11ee-91d8-005056b86db5','777559d2-7239-11ee-b98c-005056b86db5','884c5665-a453-46f3-b7b6-01d575290aa9','0fec3a8a-ad04-11ed-b13d-005056b86db5','c9a6de59-8b4f-4be1-8565-a08081f649d3'],
-      oidArray:['f297fbdc-f0a0-11ee-b534-005056b86db5','45facc0a-1211-11ec-80ad-005056b86db5']
+      oidArray:['f297fbdc-f0a0-11ee-b534-005056b86db5','45facc0a-1211-11ec-80ad-005056b86db5'],
+      refreshKey:0,
+      AIloading:[],
+      worksStudentCopy:[],
+      loopLoading:[],
     };
   },
   methods: {
-    // 获取单个分数
-    // getTotal( ) {
-    //   let params = {
-    //     uid: this.scoCon.userid,
-    //     cid: this.id
-    //   };
-
-    //   return new Promise(resolve => { this.ajax
-    //     .get(this.$store.state.api + "selectWorksEvaScore", params)
-    //     .then(res => {
-    //       if (res.data[0].length > 0) {
-    //         let data = JSON.parse(res.data[0][this.task].rate);
-    //         console.log(data);
-    //         resolve(data)
-    //         // this.scoTitList.forEach((e, index) => {
-    //         //   e.cog = 0;
-    //         //   for (const key in data) {
-    //         //     if (e.value == key) {
-    //         //       e.cog = data[key] * 1;
-    //         //     }
-    //         //   }
-    //         // });
-    //       }
-    //     })
-    //     .catch(err => {
-    //       console.error(err);
-    //     });
-    //   })
-    //   .catch(error => {
-    //     console.log(error);
-    //   });
-    // },
-
     async loopEva(con,tit,stage,task,toolIndex,toolDetail){
         console.log(con,tit,stage,task,toolIndex,toolDetail);
 
@@ -12507,11 +12482,11 @@ 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`
       }
        for (let i = 0; i < con.length; i++) {
         let msg = `NOTICE
-        Role: 你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“五级评价细则”给学生作品评分。
+        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.
@@ -12528,19 +12503,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(数字)'}]
         `
         await this.$refs.markSco[0].aiupdetaSco(msg,con[i].userid,stage,task)
         this.refreshKey++
@@ -12553,7 +12524,7 @@ export default {
     // 组件刷新
     refreshAssembly(val){
       this.refreshKey++
-      // console.log(this.refreshKey)
+      console.log(this.refreshKey)
     },
     updateLoading(payload){
       // console.log('payloadpayloadpayloadpayload',payload);
@@ -12563,6 +12534,7 @@ export default {
       // console.log('payloadpayloadpayloadpayload',payload);
 
       this.AIloading[payload.val][payload.val2].sco=payload.val3*1
+      this.$forceUpdate();
     },
     gx(){
       this.$forceUpdate();

Some files were not shown because too many files changed in this diff