11wqe1 1 year ago
parent
commit
f2a868c829
1 changed files with 21 additions and 11 deletions
  1. 21 11
      src/components/easy2/studyStudent.vue

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

@@ -12620,12 +12620,12 @@ export default {
         维度描述:${this.chapInfoList[0].chapterInfo[0].taskJson[i].eList[k].detail}
 
         # Format example
-        0 星,作业内容与作业要求无关;
+        == 0 星,作业内容与作业要求无关;
         1 星,没有识别问题和需求;
         2 星,问题或需求没有被清晰理解或准确识别;
         3 星,问题或需求的一部分被识别;
         4 星,问题或需求的大部分被识别;
-        5 星,问题或需求都被识别。 
+        5 星,问题或需求都被识别。 ==
         
         `
       let params = {
@@ -12655,17 +12655,27 @@ export default {
             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);
+              var regex = new RegExp('==([^=]+)==');
+              let match = content.match(regex);
+              if (match) { 
+                content = match[1].trim().replaceAll(' ','');
+                 // 获取匹配到的内容并去除两端空格 
+                 console.log('contentInsideDoubleEquals', content); 
+                 if(content.indexOf('0星') == -1 || content.indexOf('2星') == -1 || content.indexOf('3星') == -1 || content.indexOf('4星') == -1 || content.indexOf('5星') == -1){
+                  console.log("未有星级。"); 
+                  this.againEva(i,k)
+                  return 
+                 }
+                //  return 
+              } else {
+                  console.log("未找到匹配的内容。"); 
+                  this.againEva(i,k)
+                  return 
+              }
+             
               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("#", "")))
+              elist.rule = JSON.parse(JSON.stringify(content))
               this.$set(this.chapInfoList[0].chapterInfo[0].taskJson[i].eList,k,elist)
               this.$forceUpdate();
               let params2 = [