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