11wqe1 7 месяцев назад
Родитель
Сommit
59a2acb9c3
2 измененных файлов с 200 добавлено и 31 удалено
  1. 191 9
      src/components/easy2/commpont/markDialog.vue
  2. 9 22
      src/components/easy2/studyStudent.vue

+ 191 - 9
src/components/easy2/commpont/markDialog.vue

@@ -91,6 +91,19 @@
               @blur="submit"
               @blur="submit"
             >
             >
             </el-input>
             </el-input>
+            <div
+              v-if="
+                (currentUid.type == 1 ||
+                  currentUid.type == 10 ||
+                  currentUid.type == 13 ||
+                  isMarkCom == 1) &&
+                  !isMarkSco
+              "
+              class="anewC"
+              @click="anewEva"
+            >
+              重新生成
+            </div>
           </div>
           </div>
 
 
           <div
           <div
@@ -577,6 +590,162 @@ export default {
     this.selectSWorksData();
     this.selectSWorksData();
   },
   },
   methods: {
   methods: {
+    async anewEva() {
+      // if (!this.textarea) {
+      //   return this.$message.info("请先进行AI评分获取评语~");
+      // }
+      // return console.log('this.scoTitList',this.scoTitList);
+
+      this.ScLoading = true;
+
+      let _fileid = "";
+      if (
+        this.currentUid.type == 1 ||
+        this.currentUid.type == 4 ||
+        this.currentUid.type == 12
+      ) {
+        _fileid = await this.createFileid(this.currentUid.content);
+      }
+
+      let sco = "";
+      this.scoTitList.forEach(e => {
+        sco += `${e.detail}:${e.cog}星,`;
+      });
+
+      let con = this.cuScoCon;
+
+      let std = "";
+      let tit = [];
+      let laws = "";
+      if (this.tool.eList && this.tool.eList.length) {
+        tit = JSON.parse(JSON.stringify(this.tool.eList));
+      } else {
+        tit = JSON.parse(JSON.stringify(this.scoTit));
+      }
+
+      if (this.tool.eList && this.tool.eList.length) {
+        for (let i = 0; i < this.tool.eList.length; i++) {
+          if (this.tool.eList[i].isai == 1) {
+            laws += `细则${i}:${this.tool.eList[i].rule}, \n`;
+          }
+        }
+        for (let i = 0; i < this.tool.eList.length; i++) {
+          if (this.tool.eList[i].isai == 1) {
+            let a = this.tool.eList[i].detail;
+            let result = "";
+
+            if (isNaN(parseFloat(a)) && a) {
+              result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
+            } else {
+              result = a;
+            }
+            std += `纬度${i}:“${result}”,  \n`;
+          }
+        }
+      } else {
+        for (let i = 0; i < tit.length; i++) {
+          if (tit[i].isai == 1) {
+            let a = tit[i].detail;
+            let result = "";
+
+            if (isNaN(parseFloat(a)) && a) {
+              result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
+            } else {
+              result = a;
+            }
+            laws += ` 细则${i}:${tit[i].rule}, \n`;
+          }
+        }
+        for (let i = 0; i < tit.length; i++) {
+          if (tit[i].isai == 1) {
+            let a = tit[i].detail;
+            let result = "";
+
+            if (isNaN(parseFloat(a)) && a) {
+              result = a.match(/[\u4e00-\u9fa5a-zA-Z]+/g).join("");
+            } else {
+              result = a;
+            }
+            std += `纬度${i}:“${result}”,  \n`;
+          }
+        }
+      }
+
+      let messages = `
+      #NOTICE#
+        Role: 你是一个资深的教师,你有丰富的项目式学习、跨学科学习、STEAM导师经验,你要对学生的评价高度负责。
+        Language: ${this.getLang()}
+        ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced the "Format example".
+        Instruction: Based on the context, follow "Format example", write content.
+
+        #目标#
+        你要结合<作业内容><评价标准>和该标准对应的<等级>写评语。
+        当作业内容与<评价细则>无关,或者缺乏原创性会被直接评为0星。此时你可以输出评语“==期待看到你自己的想法!必要时,可以请教老师哦~==”
+      
+          
+        #评分资料#
+        评价标准:${std}
+        等级:${sco}
+        作业内容:${_fileid ? "上传的文件内容" : con}
+
+
+        #输出要求#
+        “评语”字数控制在150字左右,参考输出范例。
+        只输出评价内容,不要输出其他无关内容!
+        
+          
+        #输出格式#
+        ==
+        学生能够全面且正确地描述光合作用中氧气和葡萄糖的生成过程,涵盖光反应和暗反应的每个阶段和主要反应物及产物。同时,学生也能够全面、准确地解释氧气和葡萄糖在植物生命活动中的重要作用,并展示了对光合作用的深入理解。论文结构良好,内容详实,逻辑清晰,论据充分。
+        ==
+
+        #输出范例#
+        学生能够全面且正确地描述光合作用中氧气和葡萄糖的生成过程,涵盖光反应和暗反应的每个阶段和主要反应物及产物。同时,学生也能够全面、准确地解释氧气和葡萄糖在植物生命活动中的重要作用,并展示了对光合作用的深入理解。论文结构良好,内容详实,逻辑清晰,论据充分。
+        `;
+
+      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] : [],
+        isImage: this.currentUid.type == 1 ? true : "",
+        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);
+          // 找到第一个等号的位置
+          const startIndex = data.message.indexOf("==") + 2;
+          // 找到最后一个等号的位置
+          const endIndex = data.message.lastIndexOf("==");
+
+          // 提取中间的文字
+          const extractedText = data.message
+            .substring(startIndex, endIndex)
+            .trim();
+
+          this.textarea = extractedText;
+          this.submit()
+          this.$message.success("重新生成完成");
+
+          this.ScLoading = false;
+        })
+        .catch(error => {
+          this.ScLoading = false;
+
+          this.$message.error("重新生成失败");
+
+          console.log(error);
+        });
+    },
     noIsAi() {
     noIsAi() {
       this.$message.info("您暂未设置AI评分,请修改该工具的评价设置后使用。");
       this.$message.info("您暂未设置AI评分,请修改该工具的评价设置后使用。");
     },
     },
@@ -618,7 +787,7 @@ export default {
       let data = this.scoTitList.map(e => {
       let data = this.scoTitList.map(e => {
         return e.detail + ":" + e.cog;
         return e.detail + ":" + e.cog;
       });
       });
-      // console.log("data", data);
+
       const processedData = {};
       const processedData = {};
 
 
       data.forEach(item => {
       data.forEach(item => {
@@ -656,7 +825,6 @@ export default {
         type: "warning"
         type: "warning"
       })
       })
         .then(() => {
         .then(() => {
-
           let params = [
           let params = [
             {
             {
               id: this.currentUid.id
               id: this.currentUid.id
@@ -821,7 +989,7 @@ export default {
       你要根据<评价细则>和<作业内容>的相关性评价作业,判断该作业属于六级中的哪个等级。
       你要根据<评价细则>和<作业内容>的相关性评价作业,判断该作业属于六级中的哪个等级。
       你要结合<评价标准><评价细则>和<你判断的等级>写评语。
       你要结合<评价标准><评价细则>和<你判断的等级>写评语。
       如果作业内容与评价细则无关,则直接评为0星。如果作业内容与<任务描述>或<工具描述>一致或者相似,则直接评为0星,并输出评语“期待看到你自己的想法!必要时,可以请教老师哦~”
       如果作业内容与评价细则无关,则直接评为0星。如果作业内容与<任务描述>或<工具描述>一致或者相似,则直接评为0星,并输出评语“期待看到你自己的想法!必要时,可以请教老师哦~”
-      ${work.type == 1 ? '提取图片内容进行评价' : ''}
+      ${work.type == 1 ? "提取图片内容进行评价" : ""}
 
 
       #评分资料#
       #评分资料#
       评价标准:${std}
       评价标准:${std}
@@ -837,7 +1005,9 @@ export default {
       评价标准要按原样输出,严格按照输出格式输出json格式。只输出json格式的内容,其他内容不要输出!
       评价标准要按原样输出,严格按照输出格式输出json格式。只输出json格式的内容,其他内容不要输出!
 
 
       #输出格式#
       #输出格式#
-      [${text}{'comment':'评语(150个汉字左右)'${work.type == 1 ? '{\'pic\':\'提取图片内容\'}' : ''}}]
+      [${text}{'comment':'评语(150个汉字左右)'${
+        work.type == 1 ? "{'pic':'提取图片内容'}" : ""
+      }}]
       `;
       `;
       // console.log(msg);
       // console.log(msg);
       this.aiGet2(msg, _fileid, work);
       this.aiGet2(msg, _fileid, work);
@@ -898,7 +1068,7 @@ export default {
                 } catch (error) {
                 } catch (error) {
                   console.log("error_________________" + error);
                   console.log("error_________________" + error);
 
 
-                  this.aiGet2(messages, _fileid,work);
+                  this.aiGet2(messages, _fileid, work);
                   return;
                   return;
                 }
                 }
                 console.log("error_________________" + error);
                 console.log("error_________________" + error);
@@ -957,7 +1127,7 @@ export default {
             if (IsAIsuccess != scotNum) {
             if (IsAIsuccess != scotNum) {
               console.log("评价失败");
               console.log("评价失败");
 
 
-              this.aiGet2(messages, _fileid,work);
+              this.aiGet2(messages, _fileid, work);
               return;
               return;
             }
             }
 
 
@@ -1026,14 +1196,14 @@ export default {
                 _this.selectSWorksData();
                 _this.selectSWorksData();
               })
               })
               .catch(err => {
               .catch(err => {
-                this.aiGet2(messages, _fileid,work);
+                this.aiGet2(messages, _fileid, work);
                 console.error(err);
                 console.error(err);
               });
               });
           }
           }
           this.$forceUpdate();
           this.$forceUpdate();
         })
         })
         .catch(error => {
         .catch(error => {
-          this.aiGet2(messages, _fileid,work);
+          this.aiGet2(messages, _fileid, work);
 
 
           console.log(error);
           console.log(error);
         });
         });
@@ -1475,7 +1645,7 @@ export default {
 .AreaCss >>> .el-textarea__inner {
 .AreaCss >>> .el-textarea__inner {
   min-height: 150px !important;
   min-height: 150px !important;
   /* max-height: 150px; */
   /* max-height: 150px; */
-  /* padding-bottom: 20px; */
+  padding-bottom: 20px;
 }
 }
 .AreaBtn {
 .AreaBtn {
   position: absolute;
   position: absolute;
@@ -1727,4 +1897,16 @@ export default {
   background: #f4f4f4;
   background: #f4f4f4;
   border-radius: 5px;
   border-radius: 5px;
 }
 }
+.anewC {
+  position: absolute;
+  width: 91%;
+  text-align: right;
+  background-color: #fff;
+  bottom: 3px;
+  right: 22px;
+  color: #12b0ff;
+  cursor: pointer;
+  font-size: 16px;
+  transform: translate(0px, 2px);
+}
 </style>
 </style>

+ 9 - 22
src/components/easy2/studyStudent.vue

@@ -3231,9 +3231,7 @@
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
                     </div>
                     </div>
-                    <div style="width:100%" v-if="courseDetail.userid == userid && courseDetail.state == 5 && tool.eList && tool.eList.length">
-                      <evaTable :eList="tool.eList"></evaTable>
-                    </div>
+                    
                   </div>
                   </div>
                   <div
                   <div
                     v-if="
                     v-if="
@@ -4194,9 +4192,7 @@
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
                     </div>
                     </div>
-                    <div style="width:100%" v-if="courseDetail.userid == userid && courseDetail.state == 5 && tool.eList && tool.eList.length">
-                      <evaTable :eList="tool.eList"></evaTable>
-                    </div>
+                    
                   </div>
                   </div>
                   <div
                   <div
                     v-if="
                     v-if="
@@ -5421,9 +5417,7 @@
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
                     </div>
                     </div>
-                    <div style="width:100%" v-if="courseDetail.userid == userid && courseDetail.state == 5 && tool.eList && tool.eList.length">
-                      <evaTable :eList="tool.eList"></evaTable>
-                    </div>
+                   
                   </div>
                   </div>
                   <div
                   <div
                     v-if="
                     v-if="
@@ -5783,10 +5777,6 @@
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
                     </div>
                     </div>
-                    <div style="width:100%" v-if="courseDetail.userid == userid && courseDetail.state == 5 && tool.eList && tool.eList.length">
-                      <evaTable :eList="tool.eList"></evaTable>
-                    </div>
-                    
                     
                     
                   </div>
                   </div>
                   <div
                   <div
@@ -6429,9 +6419,7 @@
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
                     </div>
                     </div>
-                    <div style="width:100%" v-if="courseDetail.userid == userid && courseDetail.state == 5 && tool.eList && tool.eList.length">
-                      <evaTable :eList="tool.eList"></evaTable>
-                    </div>
+                    
                   </div>
                   </div>
                   <div
                   <div
                     v-if="
                     v-if="
@@ -7320,9 +7308,7 @@
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
                     </div>
                     </div>
-                    <div style="width:100%" v-if="courseDetail.userid == userid && courseDetail.state == 5 && tool.eList && tool.eList.length">
-                      <evaTable :eList="tool.eList"></evaTable>
-                    </div>
+                    
                   </div>
                   </div>
                   <div
                   <div
                     v-if="
                     v-if="
@@ -7641,9 +7627,7 @@
                         </el-tooltip>
                         </el-tooltip>
                       </div>
                       </div>
                     </div>
                     </div>
-                    <div style="width:100%" v-if="courseDetail.userid == userid && courseDetail.state == 5 && tool.eList && tool.eList.length">
-                      <evaTable :eList="tool.eList"></evaTable>
-                    </div>
+                    
                   </div>
                   </div>
                   <div
                   <div
                     v-if="
                     v-if="
@@ -8064,6 +8048,9 @@
                       </div>
                       </div>
                     </div>
                     </div>
                   </div>
                   </div>
+                  <div style="width:92%;margin: 0 0 0 40px;" v-if="courseDetail.state == 5 && tool.eList && tool.eList.length">
+                    <evaTable :eList="tool.eList"></evaTable>
+                  </div>
                 </div>
                 </div>
                 <!-- <div class="upload_toolBtn" @click="addImg($event)">
                 <!-- <div class="upload_toolBtn" @click="addImg($event)">
                   上传文件
                   上传文件