|
@@ -27,7 +27,9 @@
|
|
|
:style="{ height: `calc(100% - ${topHeight}px)` }"
|
|
|
>
|
|
|
<div class="oldBox">
|
|
|
- <div class="oldMes">原文( 作者:{{ evaEngJson.username }} )</div>
|
|
|
+ <div class="oldMes">
|
|
|
+ 原文( 作者:{{ evaEngJson.message.username }} )
|
|
|
+ </div>
|
|
|
<div class="oldText">
|
|
|
<div class="detailBox">
|
|
|
<div class="oldDetail">
|
|
@@ -53,7 +55,11 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="oldBox" style="position: relative">
|
|
|
+ <div
|
|
|
+ class="oldBox"
|
|
|
+ style="position: relative; overflow: hidden"
|
|
|
+ :style="{ height: `calc(100% - ${topHeight}px)` }"
|
|
|
+ >
|
|
|
<div
|
|
|
class="oldMes"
|
|
|
style="
|
|
@@ -79,57 +85,61 @@
|
|
|
教师评价
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div v-if="type == 0">
|
|
|
- <el-button
|
|
|
+ <div
|
|
|
+ v-if="type == 0"
|
|
|
+ style="
|
|
|
+ height: calc(100% - 45px);
|
|
|
+ margin: 10px 0 0 0;
|
|
|
+ overflow: auto;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <!-- <el-button
|
|
|
type="primary"
|
|
|
@click="getAiPj"
|
|
|
v-if="!isPj"
|
|
|
style="margin: 10px 0 0 0"
|
|
|
>AI评价</el-button
|
|
|
- >
|
|
|
- <div class="oldText" style="margin-top: 10px" v-else>
|
|
|
+ > -->
|
|
|
+ <div class="oldText loadingText" style="margin-top: 10px">
|
|
|
<div class="detailBox" style="min-width: 300px">
|
|
|
<div class="oldDetail" style="min-width: 300px">
|
|
|
- <div>作业批改:</div>
|
|
|
- <el-input
|
|
|
+ <div>作业原文:</div>
|
|
|
+ <div v-html="evaEngJson.studentJson.engText"></div>
|
|
|
+ <!-- <el-input
|
|
|
type="textarea"
|
|
|
:rows="10"
|
|
|
resize="none"
|
|
|
v-model="aiList.engTitle"
|
|
|
disabled
|
|
|
- />
|
|
|
+ /> -->
|
|
|
</div>
|
|
|
<div class="oldDetail" style="min-width: 300px">
|
|
|
<div>作业评价:</div>
|
|
|
- <el-input
|
|
|
+ <div v-if="!aiList.engText">暂无AI评价</div>
|
|
|
+ <div v-else v-html="html"></div>
|
|
|
+ <!-- <el-input
|
|
|
type="textarea"
|
|
|
:rows="10"
|
|
|
resize="none"
|
|
|
v-model="aiList.engText"
|
|
|
disabled
|
|
|
- />
|
|
|
+ /> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
- @click="isPj = false"
|
|
|
- v-if="isPj"
|
|
|
+ @click="getAiPj"
|
|
|
style="position: absolute; top: 50px; right: 20px"
|
|
|
- >返回评价</el-button
|
|
|
+ >AI评价</el-button
|
|
|
>
|
|
|
</div>
|
|
|
<div v-if="type == 1" style="margin: 10px 0 0 0">
|
|
|
<div class="oldText" style="margin-top: 10px">
|
|
|
<div class="detailBox" style="min-width: 300px">
|
|
|
<div class="oldDetail" style="min-width: 300px">
|
|
|
- <div>作业批改:</div>
|
|
|
- <el-input
|
|
|
- type="textarea"
|
|
|
- :rows="10"
|
|
|
- resize="none"
|
|
|
- v-model="teacherList.engTitle"
|
|
|
- />
|
|
|
+ <div>作业原文:</div>
|
|
|
+ <div v-html="evaEngJson.studentJson.engText"></div>
|
|
|
</div>
|
|
|
<div class="oldDetail" style="min-width: 300px">
|
|
|
<div>作业评价:</div>
|
|
@@ -152,29 +162,35 @@
|
|
|
style="z-index: 999; position: relative"
|
|
|
>
|
|
|
<el-button @click="close()">取 消</el-button>
|
|
|
- <el-button type="primary">确 定</el-button>
|
|
|
+ <el-button type="primary" @click="addCode">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import MarkdownIt from "markdown-it";
|
|
|
export default {
|
|
|
- props: ["engEvaDialogVisible", "evaEngJson", "userid"],
|
|
|
+ props: ["engEvaDialogVisible", "evaEngJson", "uid"],
|
|
|
data() {
|
|
|
return {
|
|
|
topHeight: 0,
|
|
|
type: 0,
|
|
|
- isPj: false,
|
|
|
aiList: {
|
|
|
- engTitle: "这是题目",
|
|
|
- engText: "这是内容",
|
|
|
+ engTitle: "",
|
|
|
+ engText: "",
|
|
|
},
|
|
|
teacherList: {
|
|
|
engTitle: "",
|
|
|
engText: "",
|
|
|
},
|
|
|
+ md: new MarkdownIt(),
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ html() {
|
|
|
+ return this.aiList.engText ? this.md.render(this.aiList.engText) : "";
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
handleClose(done) {
|
|
|
this.close();
|
|
@@ -211,38 +227,80 @@ export default {
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
getAiPj() {
|
|
|
- let param = [
|
|
|
- {
|
|
|
- model: "gpt-3.5-turbo",
|
|
|
- temperature: 0,
|
|
|
- max_tokens: 2048,
|
|
|
- top_p: 1,
|
|
|
- frequency_penalty: 0,
|
|
|
- presence_penalty: 0,
|
|
|
- message: [
|
|
|
- {
|
|
|
- role: "user",
|
|
|
- content:
|
|
|
- "英语写作批改是这样的:你的任务是为文字内容进行批注,请依照以下步骤完成任务,并仅显示第二步完成的内容:1.校对并更正:" + this.evaEngJson.studentJson.engText + "2.通过文本批注的形式,即将错误的单词用删除线划去,并将正确内容补充在后面,将前一段文字修改为后一段文字,并以markdown的形式呈现。",
|
|
|
- },
|
|
|
- ],
|
|
|
- uid: this.userid,
|
|
|
- stream: false,
|
|
|
- },
|
|
|
- ];
|
|
|
+ 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.校对并更正:" +
|
|
|
+ this.evaEngJson.studentJson.engText +
|
|
|
+ "2.通过文本批注的形式,即将错误的单词用删除线划去,并将正确内容补充在后面,将前一段文字修改为后一段文字,并以markdown的形式呈现。",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ uid: this.uid,
|
|
|
+ stream: false,
|
|
|
+ };
|
|
|
this.ajax.post("https://gpt.cocorobo.cn/chat", param).then(
|
|
|
(res) => {
|
|
|
- console.log(res);
|
|
|
- this.isPj = true;
|
|
|
+ if (
|
|
|
+ res.data.FunctionResponse &&
|
|
|
+ res.data.FunctionResponse.result &&
|
|
|
+ res.data.FunctionResponse.result == "无效请求,请重新发起对话"
|
|
|
+ ) {
|
|
|
+ this.$message.error("你的作文内容太长,无法使用Ai评价!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.aiList.engText =
|
|
|
+ res.data.FunctionResponse.choices[0].message.content;
|
|
|
+ loading.close();
|
|
|
},
|
|
|
(err) => {
|
|
|
console.log(err);
|
|
|
+ loading.close();
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
+ addCode() {
|
|
|
+ let params = {
|
|
|
+ id: this.evaEngJson.message.id,
|
|
|
+ aic: this.aiList.engText,
|
|
|
+ tc: this.teacherList.engText,
|
|
|
+ t: this.type,
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "addEngEva", params)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success("评价成功");
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ this.$message.error("网络不佳");
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.topHeight = document.querySelectorAll(".engUpTop")[0].offsetHeight;
|
|
|
+ mounted() {},
|
|
|
+ watch: {
|
|
|
+ engEvaDialogVisible: {
|
|
|
+ handler(newVal) {
|
|
|
+ if (newVal == true) {
|
|
|
+ this.aiList.engText = this.evaEngJson.message.aiCode;
|
|
|
+ this.teacherList.engText = this.evaEngJson.message.teacherCode;
|
|
|
+ this.topHeight =
|
|
|
+ document.querySelectorAll(".engUpTop")[0].offsetHeight;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -352,7 +410,6 @@ export default {
|
|
|
flex-direction: column;
|
|
|
flex-wrap: nowrap;
|
|
|
align-content: center;
|
|
|
- justify-content: center;
|
|
|
align-items: center;
|
|
|
}
|
|
|
|