Explorar el Código

1、英语写作功能修改
2、build

zengyicheng hace 1 año
padre
commit
9a92f616bf

+ 1 - 3
src/components/components/englishEva.vue

@@ -362,9 +362,7 @@ export default {
           {
             role: "user",
             content:
-              "你的任务是为文字内容进行批注,请依照以下步骤完成任务,并仅显示第二步完成的内容:1.校对并更正:" +
-              this.evaEngJson.studentJson.engText +
-              "2.通过文本批注的形式,即将错误的单词用删除线划去,并将正确内容补充在后面,将前一段文字修改为后一段文字,并以markdown的形式呈现。",
+              "请对这篇文章进行评价:" + this.evaEngJson.studentJson.engText
           },
         ],
         uid: this.uid,

+ 0 - 7
src/components/components/onlineWrite.vue

@@ -39,7 +39,6 @@
             <el-input
               v-model="myAnswerList.engTitle"
               placeholder="请填写你的作文题目"
-              @change="setEngList"
             ></el-input>
           </div>
         </div>
@@ -51,7 +50,6 @@
               :rows="20"
               resize="none"
               v-model="myAnswerList.engText"
-              @change="setEngList"
             ></el-input>
           </div>
         </div>
@@ -156,7 +154,6 @@ export default {
     },
     deleteImgList() {
       this.myAnswerList.imgList = [];
-      this.setEngList();
     },
     uploadIsType() {
       if (this.type == 2) {
@@ -164,9 +161,6 @@ export default {
       }
       this.uploadDialogVisible = false;
     },
-    setEngList() {
-      this.$emit("setEnglish", this.myAnswerList);
-    },
     async beforeUpload(event) {
       // this.$message.success('进入上传')
       var file = event.target.files[0];
@@ -244,7 +238,6 @@ export default {
                 url: data.Location,
               });
               _this.imgChange();
-              this.setEngList();
               console.log(data.Location);
               // _this.$message.success('上传成功'+data.Location)
             }

+ 0 - 7
src/components/easy2/commpont/onlineWrite.vue

@@ -39,7 +39,6 @@
             <el-input
               v-model="myAnswerList.engTitle"
               placeholder="请填写你的作文题目"
-              @change="setEngList"
             ></el-input>
           </div>
         </div>
@@ -51,7 +50,6 @@
               :rows="20"
               resize="none"
               v-model="myAnswerList.engText"
-              @change="setEngList"
             ></el-input>
           </div>
         </div>
@@ -156,7 +154,6 @@ export default {
     },
     deleteImgList() {
       this.myAnswerList.imgList = [];
-      this.setEngList();
     },
     uploadIsType() {
       if (this.type == 2) {
@@ -164,9 +161,6 @@ export default {
       }
       this.uploadDialogVisible = false;
     },
-    setEngList() {
-      this.$emit("setEnglish", this.myAnswerList);
-    },
     async beforeUpload(event) {
       // this.$message.success('进入上传')
       var file = event.target.files[0];
@@ -244,7 +238,6 @@ export default {
                 url: data.Location,
               });
               _this.imgChange();
-              this.setEngList();
               console.log(data.Location);
               // _this.$message.success('上传成功'+data.Location)
             }

+ 85 - 5
src/components/easy2/studyStudent.vue

@@ -11315,9 +11315,9 @@
     >
       <onlineWrite
         v-if="engDialogVisible"
-        @setEnglish="setEnglishList"
         :englishList="englishList"
         :myAnswerList1="myAnswerList1"
+        ref="engJson"
       ></onlineWrite>
       <span slot="footer" class="dialog-footer" style="text-align: center;">
         <el-button @click="engDialogVisible = false">取 消</el-button>
@@ -11363,7 +11363,7 @@
               </div>
             </div>
           </div>
-          <div class="oldBox" v-if="userMes[0].type == 2">
+          <div class="oldBox loadingText" v-if="userMes[0].type == 2">
             <div class="oldMes" style="background: #aacaff;">{{ userMes[0].username }}</div>
             <div class="oldText">
               <div class="detailBox" style="position: relative;">
@@ -11379,11 +11379,12 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList.engText,1)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList.engText,1)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
           </div>
-          <div class="oldBox" v-else-if="userMes[0].type == 1">
+          <div class="oldBox loadingText" v-else-if="userMes[0].type == 1">
             <div class="oldMes" style="background: rgb(224 236 255);display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center;overflow-x: auto;overflow-y: hidden;" v-if="newEnglishList1.length > 0">
               <div v-if="isNoUserid" class="allName" :style="{minWidth: `calc(100% / ${engListLength})`,background: newEngIndex == -1 ? '#aacaff' : ''}" @click="setEngText(-1)" style="background: #aacaff;">{{ userMes[0].username }}</div>
               <div v-for="(item,index) in newEnglishList1" :key="index" class="allName" :style="{minWidth: `calc(100% / ${engListLength})`,background: index == newEngIndex ? '#aacaff' : ''}" @click="setEngText(index)">{{ item.username }}</div>
@@ -11403,6 +11404,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(oldEnglishJson1.engText,2)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(oldEnglishJson1.engText,2)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11420,6 +11422,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList.engText,3)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList.engText,3)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11443,6 +11446,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList1[newEngIndex].cWork.engText,4)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList1[newEngIndex].cWork.engText,4)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11973,8 +11977,82 @@ export default {
         this.greyType = false
       }
     },
-    setEnglishList(engList) {
-      this.myAnList = engList;
+    aiCorrect(t,p){
+      let aiText = "";
+      const loading = this.$loading.service({
+        background: "rgba(255, 255, 255)",
+        target: document.querySelectorAll(".loadingText")[0],
+      });
+      let param = {
+        model: "gpt-3.5-turbo",
+        temperature: 0,
+        max_tokens: 2048,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [
+          {
+            role: "user",
+            content:
+              "你的任务是为文字内容进行批注,请依照以下步骤完成任务,并仅显示第二步完成的内容:1.校对并更正:" + t,
+          },
+        ],
+        uid: this.userid,
+        stream: false,
+      };
+      this.ajax.post("https://gpt.cocorobo.cn/chat", param).then(
+        (res) => {
+          if (
+            res.data.FunctionResponse &&
+            res.data.FunctionResponse.result &&
+            res.data.FunctionResponse.result == "无效请求,请重新发起对话"
+          ) {
+            this.$message.error("你的作文内容太长,无法使用Ai批注!");
+            return;
+          }
+          aiText =
+            res.data.FunctionResponse.choices[0].message.content;
+          aiText = aiText.replace(/%/g,"%25");
+          // let w = "";
+          // let a = Diff.diffWordsWithSpace(this.oldEnglishJson.engText,aiText);
+          // for(var k = 0;k<a.length;k++){
+          //   //diffWordsWithSpace
+          //   if(a.length > 1){
+          //       if(a[k].added == true){
+          //         w += '<span style="background-color: green;color:#fff">' + a[k].value + '</span>';
+          //       }else if(a[k].removed == true){
+          //         w += '<span style="text-decoration: line-through;color:red">' + a[k].value + '</span>';
+          //       }else{
+          //         w += '<span>' + a[k].value + '</span>';
+          //       }
+          //   }else{
+          //     if(p == 1){
+          //       w = this.newEnglishList.engText;
+          //     }else if(p == 2){
+          //       w = this.oldEnglishJson1.engText;
+          //     }else if(p == 3){
+          //       w = this.newEnglishList.engText;
+          //     }else{
+          //       w = this.newEnglishList1[this.newEngIndex].cWork.engText;
+          //     }
+          //   }
+          // }
+          if(p == 1){
+            this.newEnglishList.engText = aiText;
+          }else if(p == 2){
+            this.oldEnglishJson1.engText = aiText;
+          }else if(p == 3){
+            this.newEnglishList.engText = aiText;
+          }else{
+            this.newEnglishList1[this.newEngIndex].cWork.engText = aiText;
+          }
+          loading.close();
+        },
+        (err) => {
+          console.log(err);
+          loading.close();
+        }
+      );      
     },
     addToolChoose() {
       if (!this.checktoolArray.length) {
@@ -12739,6 +12817,7 @@ export default {
         });
     },
     addEnglishWork() {
+      this.myAnList = this.$refs['engJson'].myAnswerList;
       if (!this.myAnList.engTitle || !this.myAnList.engText || this.myAnList.engTitle == "" || this.myAnList.engText == "") {
         this.$message.error("请输入作文标题和正文!");
         return;
@@ -17537,6 +17616,7 @@ export default {
           : {};
         
         this.englishToolIndex = i;
+        this.myAnList = this.myAnswerList1;
         this.engDialogVisible = true;
       } else if (t == 65) {
         if (this.tType == 2) {

+ 0 - 7
src/components/easy3/commpont/onlineWrite.vue

@@ -39,7 +39,6 @@
             <el-input
               v-model="myAnswerList.engTitle"
               placeholder="请填写你的作文题目"
-              @change="setEngList"
             ></el-input>
           </div>
         </div>
@@ -51,7 +50,6 @@
               :rows="20"
               resize="none"
               v-model="myAnswerList.engText"
-              @change="setEngList"
             ></el-input>
           </div>
         </div>
@@ -156,7 +154,6 @@ export default {
     },
     deleteImgList() {
       this.myAnswerList.imgList = [];
-      this.setEngList();
     },
     uploadIsType() {
       if (this.type == 2) {
@@ -164,9 +161,6 @@ export default {
       }
       this.uploadDialogVisible = false;
     },
-    setEngList() {
-      this.$emit("setEnglish", this.myAnswerList);
-    },
     async beforeUpload(event) {
       // this.$message.success('进入上传')
       var file = event.target.files[0];
@@ -244,7 +238,6 @@ export default {
                 url: data.Location,
               });
               _this.imgChange();
-              this.setEngList();
               console.log(data.Location);
               // _this.$message.success('上传成功'+data.Location)
             }

+ 85 - 5
src/components/easy3/studyStudent.vue

@@ -11302,9 +11302,9 @@
     >
       <onlineWrite
         v-if="engDialogVisible"
-        @setEnglish="setEnglishList"
         :englishList="englishList"
         :myAnswerList1="myAnswerList1"
+        ref="engJson"
       ></onlineWrite>
       <span slot="footer" class="dialog-footer" style="text-align: center;">
         <el-button @click="engDialogVisible = false">取 消</el-button>
@@ -11350,7 +11350,7 @@
               </div>
             </div>
           </div>
-          <div class="oldBox" v-if="userMes[0].type == 2">
+          <div class="oldBox loadingText" v-if="userMes[0].type == 2">
             <div class="oldMes" style="background: #aacaff;">{{ userMes[0].username }}</div>
             <div class="oldText">
               <div class="detailBox" style="position: relative;">
@@ -11366,11 +11366,12 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList.engText,1)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList.engText,1)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
           </div>
-          <div class="oldBox" v-else-if="userMes[0].type == 1">
+          <div class="oldBox loadingText" v-else-if="userMes[0].type == 1">
             <div class="oldMes" style="background: rgb(224 236 255);display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center;overflow-x: auto;overflow-y: hidden;" v-if="newEnglishList1.length > 0">
               <div v-if="isNoUserid" class="allName" :style="{minWidth: `calc(100% / ${engListLength})`,background: newEngIndex == -1 ? '#aacaff' : ''}" @click="setEngText(-1)" style="background: #aacaff;">{{ userMes[0].username }}</div>
               <div v-for="(item,index) in newEnglishList1" :key="index" class="allName" :style="{minWidth: `calc(100% / ${engListLength})`,background: index == newEngIndex ? '#aacaff' : ''}" @click="setEngText(index)">{{ item.username }}</div>
@@ -11390,6 +11391,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(oldEnglishJson1.engText,2)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(oldEnglishJson1.engText,2)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11407,6 +11409,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList.engText,3)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList.engText,3)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11431,6 +11434,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList1[newEngIndex].cWork.engText,4)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList1[newEngIndex].cWork.engText,4)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11962,8 +11966,82 @@ export default {
         this.greyType = false
       }
     },
-    setEnglishList(engList) {
-      this.myAnList = engList;
+    aiCorrect(t,p){
+      let aiText = "";
+      const loading = this.$loading.service({
+        background: "rgba(255, 255, 255)",
+        target: document.querySelectorAll(".loadingText")[0],
+      });
+      let param = {
+        model: "gpt-3.5-turbo",
+        temperature: 0,
+        max_tokens: 2048,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [
+          {
+            role: "user",
+            content:
+              "你的任务是为文字内容进行批注,请依照以下步骤完成任务,并仅显示第二步完成的内容:1.校对并更正:" + t,
+          },
+        ],
+        uid: this.userid,
+        stream: false,
+      };
+      this.ajax.post("https://gpt.cocorobo.cn/chat", param).then(
+        (res) => {
+          if (
+            res.data.FunctionResponse &&
+            res.data.FunctionResponse.result &&
+            res.data.FunctionResponse.result == "无效请求,请重新发起对话"
+          ) {
+            this.$message.error("你的作文内容太长,无法使用Ai批注!");
+            return;
+          }
+          aiText =
+            res.data.FunctionResponse.choices[0].message.content;
+          aiText = aiText.replace(/%/g,"%25");
+          // let w = "";
+          // let a = Diff.diffWordsWithSpace(this.oldEnglishJson.engText,aiText);
+          // for(var k = 0;k<a.length;k++){
+          //   //diffWordsWithSpace
+          //   if(a.length > 1){
+          //       if(a[k].added == true){
+          //         w += '<span style="background-color: green;color:#fff">' + a[k].value + '</span>';
+          //       }else if(a[k].removed == true){
+          //         w += '<span style="text-decoration: line-through;color:red">' + a[k].value + '</span>';
+          //       }else{
+          //         w += '<span>' + a[k].value + '</span>';
+          //       }
+          //   }else{
+          //     if(p == 1){
+          //       w = this.newEnglishList.engText;
+          //     }else if(p == 2){
+          //       w = this.oldEnglishJson1.engText;
+          //     }else if(p == 3){
+          //       w = this.newEnglishList.engText;
+          //     }else{
+          //       w = this.newEnglishList1[this.newEngIndex].cWork.engText;
+          //     }
+          //   }
+          // }
+          if(p == 1){
+            this.newEnglishList.engText = aiText;
+          }else if(p == 2){
+            this.oldEnglishJson1.engText = aiText;
+          }else if(p == 3){
+            this.newEnglishList.engText = aiText;
+          }else{
+            this.newEnglishList1[this.newEngIndex].cWork.engText = aiText;
+          }
+          loading.close();
+        },
+        (err) => {
+          console.log(err);
+          loading.close();
+        }
+      );      
     },
     addToolChoose() {
       if (!this.checktoolArray.length) {
@@ -12728,6 +12806,7 @@ export default {
         });
     },
     addEnglishWork() {
+      this.myAnList = this.$refs['engJson'].myAnswerList;
       if (!this.myAnList.engTitle || !this.myAnList.engText || this.myAnList.engTitle == "" || this.myAnList.engText == "") {
         this.$message.error("请输入作文标题和正文!");
         return;
@@ -17531,6 +17610,7 @@ export default {
           : {};
         
         this.englishToolIndex = i;
+        this.myAnList = this.myAnswerList1;
         this.engDialogVisible = true;
       } else if (t == 65) {
         if (this.tType == 2) {

+ 85 - 5
src/components/studyStudent.vue

@@ -11287,9 +11287,9 @@
     >
       <onlineWrite
         v-if="engDialogVisible"
-        @setEnglish="setEnglishList"
         :englishList="englishList"
         :myAnswerList1="myAnswerList1"
+        ref="engJson"
       ></onlineWrite>
       <span slot="footer" class="dialog-footer">
         <el-button @click="engDialogVisible = false">取 消</el-button>
@@ -11335,7 +11335,7 @@
               </div>
             </div>
           </div>
-          <div class="oldBox" v-if="userMes[0].type == 2">
+          <div class="oldBox loadingText" v-if="userMes[0].type == 2">
             <div class="oldMes" style="background: #aacaff;">{{ userMes[0].username }}</div>
             <div class="oldText">
               <div class="detailBox" style="position: relative;">
@@ -11351,11 +11351,12 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList.engText,1)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList.engText,1)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
           </div>
-          <div class="oldBox" v-else-if="userMes[0].type == 1">
+          <div class="oldBox loadingText" v-else-if="userMes[0].type == 1">
             <div class="oldMes" style="background: rgb(224 236 255);display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center;overflow-x: auto;overflow-y: hidden;" v-if="newEnglishList1.length > 0">
               <div v-if="isNoUserid" class="allName" :style="{minWidth: `calc(100% / ${engListLength})`,background: newEngIndex == -1 ? '#aacaff' : ''}" @click="setEngText(-1)" style="background: #aacaff;">{{ userMes[0].username }}</div>
               <div v-for="(item,index) in newEnglishList1" :key="index" class="allName" :style="{minWidth: `calc(100% / ${engListLength})`,background: index == newEngIndex ? '#aacaff' : ''}" @click="setEngText(index)">{{ item.username }}</div>
@@ -11375,6 +11376,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(oldEnglishJson1.engText,2)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(oldEnglishJson1.engText,2)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11392,6 +11394,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList.engText,3)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList.engText,3)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11415,6 +11418,7 @@
                 </div>
                 <div style="position: absolute;bottom: -25px;">注:红色划线字为删除,绿色背景白色字为新添加.</div>
                 <el-button @click="isUpdateCorrect(newEnglishList1[newEngIndex].cWork.engText,4)" class="correctCss" :style="{right: greyType == false ? '0' : '80px' }">{{ greyType == false ? '添加批注' : '取消添加' }}</el-button>
+                <el-button @click="aiCorrect(newEnglishList1[newEngIndex].cWork.engText,4)" style="position: absolute;bottom: -70px;right: 110px;background: #409eff;color: #fff;" v-if="!greyType">AI批注</el-button>
                 <el-button @click="addCorrect" style="position: absolute;bottom: -70px;right: 0;background: #409eff;color: #fff;" v-if="greyType">确定</el-button>
               </div>
             </div>
@@ -11944,8 +11948,82 @@ export default {
         this.greyType = false
       }
     },
-    setEnglishList(engList) {
-      this.myAnList = engList;
+    aiCorrect(t,p){
+      let aiText = "";
+      const loading = this.$loading.service({
+        background: "rgba(255, 255, 255)",
+        target: document.querySelectorAll(".loadingText")[0],
+      });
+      let param = {
+        model: "gpt-3.5-turbo",
+        temperature: 0,
+        max_tokens: 2048,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [
+          {
+            role: "user",
+            content:
+              "你的任务是为文字内容进行批注,请依照以下步骤完成任务,并仅显示第二步完成的内容:1.校对并更正:" + t,
+          },
+        ],
+        uid: this.userid,
+        stream: false,
+      };
+      this.ajax.post("https://gpt.cocorobo.cn/chat", param).then(
+        (res) => {
+          if (
+            res.data.FunctionResponse &&
+            res.data.FunctionResponse.result &&
+            res.data.FunctionResponse.result == "无效请求,请重新发起对话"
+          ) {
+            this.$message.error("你的作文内容太长,无法使用Ai批注!");
+            return;
+          }
+          aiText =
+            res.data.FunctionResponse.choices[0].message.content;
+          aiText = aiText.replace(/%/g,"%25");
+          // let w = "";
+          // let a = Diff.diffWordsWithSpace(this.oldEnglishJson.engText,aiText);
+          // for(var k = 0;k<a.length;k++){
+          //   //diffWordsWithSpace
+          //   if(a.length > 1){
+          //       if(a[k].added == true){
+          //         w += '<span style="background-color: green;color:#fff">' + a[k].value + '</span>';
+          //       }else if(a[k].removed == true){
+          //         w += '<span style="text-decoration: line-through;color:red">' + a[k].value + '</span>';
+          //       }else{
+          //         w += '<span>' + a[k].value + '</span>';
+          //       }
+          //   }else{
+          //     if(p == 1){
+          //       w = this.newEnglishList.engText;
+          //     }else if(p == 2){
+          //       w = this.oldEnglishJson1.engText;
+          //     }else if(p == 3){
+          //       w = this.newEnglishList.engText;
+          //     }else{
+          //       w = this.newEnglishList1[this.newEngIndex].cWork.engText;
+          //     }
+          //   }
+          // }
+          if(p == 1){
+            this.newEnglishList.engText = aiText;
+          }else if(p == 2){
+            this.oldEnglishJson1.engText = aiText;
+          }else if(p == 3){
+            this.newEnglishList.engText = aiText;
+          }else{
+            this.newEnglishList1[this.newEngIndex].cWork.engText = aiText;
+          }
+          loading.close();
+        },
+        (err) => {
+          console.log(err);
+          loading.close();
+        }
+      );      
     },
     addToolChoose() {
       if (!this.checktoolArray.length) {
@@ -12709,6 +12787,7 @@ export default {
         });
     },
     addEnglishWork() {
+      this.myAnList = this.$refs['engJson'].myAnswerList;
       if (!this.myAnList.engTitle || !this.myAnList.engText || this.myAnList.engTitle == "" || this.myAnList.engText == "") {
         this.$message.error("请输入作文标题和正文!");
         return;
@@ -17512,6 +17591,7 @@ export default {
           : {};
         
         this.englishToolIndex = i;
+        this.myAnList = this.myAnswerList1;
         this.engDialogVisible = true;
       } else if (t == 65) {
         if (this.tType == 2) {