|
@@ -0,0 +1,449 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div v-loading="loading">
|
|
|
+ <div class="scoreTit">
|
|
|
+ <div>任务得分</div>
|
|
|
+ <div>{{ totalScore ? totalScore : 0 }}分</div>
|
|
|
+ </div>
|
|
|
+ <div class="scoreStar">
|
|
|
+ <div v-for="(e, index) in scoTitList" :key="index">
|
|
|
+ <div class="scoreStarBack">
|
|
|
+ <el-tooltip
|
|
|
+ class="item"
|
|
|
+ effect="dark"
|
|
|
+ :content="e.value"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <div class="briefTit">{{ e.value }}</div>
|
|
|
+ </el-tooltip>
|
|
|
+
|
|
|
+ <el-rate v-model="e.cog"></el-rate>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- <div
|
|
|
+ v-if="scoTitList.length > 2"
|
|
|
+ style="color:#4188FC;cursor: pointer;width: 30%;"
|
|
|
+ @click="allList"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <span style="margin-right:5px;">{{
|
|
|
+ !showAll ? "全部" : "折叠"
|
|
|
+ }}</span>
|
|
|
+ <i
|
|
|
+ :class="!showAll ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
|
|
|
+ ></i>
|
|
|
+ </div>
|
|
|
+ </div> -->
|
|
|
+ </div>
|
|
|
+ <div style="width:100%;display:flex;justify-content: flex-end;">
|
|
|
+ <el-button size="mini" @click="reset">重置</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="submit">确认</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="AIsubmit"
|
|
|
+ >AI评分</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { v4 as uuidv4 } from "uuid";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "PblStudentTableMarkScore",
|
|
|
+ props: [
|
|
|
+ "scoTit",
|
|
|
+ "scoCon",
|
|
|
+ "task",
|
|
|
+ "stage",
|
|
|
+ "allData",
|
|
|
+ "loading",
|
|
|
+ "wIndex",
|
|
|
+ "toolIndex",
|
|
|
+ "toolDetail"
|
|
|
+ ],
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ homeworkVal: [],
|
|
|
+ scoTitList: [],
|
|
|
+ markScoPopover: false,
|
|
|
+ id: this.$route.query.courseId,
|
|
|
+ stUid: this.scoCon.userid,
|
|
|
+ userid: this.$route.query.userid,
|
|
|
+ total: 0
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ totalScore() {
|
|
|
+ let a = 0;
|
|
|
+ this.scoTitList.forEach(e => {
|
|
|
+ a += e.cog;
|
|
|
+ });
|
|
|
+ let data = 0
|
|
|
+ data = (a / this.scoTit.length).toFixed(1);
|
|
|
+ this.$emit("updateDocSco", {
|
|
|
+ val: this.toolIndex,
|
|
|
+ val2: this.wIndex,
|
|
|
+ val3: data
|
|
|
+ });
|
|
|
+
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ mounted() {
|
|
|
+ this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
|
|
|
+ console.log("scoCon", this.scoCon);
|
|
|
+ // console.log("scoTit", this.scoTit);
|
|
|
+
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ // 获取单个数据
|
|
|
+ getData() {
|
|
|
+ let params = {
|
|
|
+ uid: this.scoCon.userid,
|
|
|
+ cid: this.id
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "selectWorksEvaScore", params)
|
|
|
+ .then(res => {
|
|
|
+ // console.log(res);
|
|
|
+ if (res.data[0].length > 0) {
|
|
|
+ let data = JSON.parse(res.data[0][this.task].rate);
|
|
|
+ // console.log("data", data);
|
|
|
+ this.scoTitList.forEach((e, index) => {
|
|
|
+ e.cog = 0;
|
|
|
+ for (const key in data) {
|
|
|
+ if (e.value == key) {
|
|
|
+ e.cog = data[key] * 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ reset() {
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ // 老师提交评分
|
|
|
+ submit() {
|
|
|
+ let data = this.scoTitList.map(e => {
|
|
|
+ return e.value + ":" + e.cog;
|
|
|
+ });
|
|
|
+ // console.log("data", data);
|
|
|
+ const processedData = {};
|
|
|
+
|
|
|
+ data.forEach(item => {
|
|
|
+ const [key, value] = item.split(":");
|
|
|
+ processedData[key] = Number(value);
|
|
|
+ });
|
|
|
+ processedData.content = "";
|
|
|
+ // console.log(processedData);
|
|
|
+ let params = {
|
|
|
+ cid: this.id,
|
|
|
+ s: this.stage,
|
|
|
+ t: this.task,
|
|
|
+ rate: JSON.stringify(processedData),
|
|
|
+ uid: this.stUid
|
|
|
+ };
|
|
|
+ // return console.log(params);
|
|
|
+ this.ajax
|
|
|
+ .get(this.$store.state.api + "updateWorksEva", params)
|
|
|
+ .then(res => {
|
|
|
+ this.$message({
|
|
|
+ message: "评价成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.$message.error("评价失败");
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // ai评分
|
|
|
+ AIsubmit() {
|
|
|
+ let tit = this.scoTit;
|
|
|
+ let con = JSON.parse(this.scoCon.works);
|
|
|
+ // this.markScoPopover = true;
|
|
|
+ this.$emit("updateLoading", {
|
|
|
+ val: this.toolIndex,
|
|
|
+ val2: this.wIndex,
|
|
|
+ val3: true
|
|
|
+ });
|
|
|
+ let _text = "";
|
|
|
+ for (let i = 0; i < tit.length; i++) {
|
|
|
+ _text += `维度名称:${tit[i].value} 维度描述:${tit[i].detail} \n`;
|
|
|
+ }
|
|
|
+ // console.log(_text);
|
|
|
+ let msg = `NOTICE
|
|
|
+ Role: 你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“五级评价细则”给学生作品评分。
|
|
|
+ Language: Please use the same language as the user requirement, if the user speaks Chinese, the specific text of your answer should also be in Chinese.
|
|
|
+ ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
|
|
|
+ Instruction: Based on the context, follow "Format example", write content.
|
|
|
+
|
|
|
+ #Context
|
|
|
+ ## 评价细则
|
|
|
+ ${_text}
|
|
|
+
|
|
|
+ ## 作业题目
|
|
|
+ ${this.toolDetail}
|
|
|
+
|
|
|
+ ## 作业内容
|
|
|
+ ${con.text}
|
|
|
+
|
|
|
+ ## 要求
|
|
|
+ 根据评价细则和作业内容与作业题目的相关性评价作业,判断该作业属于五级中的哪个等级。
|
|
|
+ 具体的评价标准分为5级——1级,2级,3级,4级,5级。输出格式参考===输出范例===。
|
|
|
+ ===
|
|
|
+ 1 级,没有识别问题和需求;
|
|
|
+ 2 级,问题或需求没有被清晰理解或准确识别;
|
|
|
+ 3 级,问题或需求的一部分被识别;
|
|
|
+ 4 级,问题或需求的大部分被识别;
|
|
|
+ 5 级,问题或需求都被识别。
|
|
|
+ ===
|
|
|
+
|
|
|
+ ## Format example
|
|
|
+ 输出格式:[{'评价细则维度':'1'}],
|
|
|
+ 属性名为每个评价细则的维度名称
|
|
|
+ 不能不做评价,必须每个都有分数,分数只用数字来评分
|
|
|
+ `;
|
|
|
+ // console.log(msg);
|
|
|
+ this.aiGet2(msg);
|
|
|
+ },
|
|
|
+ // ai打分
|
|
|
+ aiGet2(messages, callback) {
|
|
|
+ let _this = this;
|
|
|
+ let parm = {
|
|
|
+ assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
+ message: [
|
|
|
+ {
|
|
|
+ type: "text",
|
|
|
+ text: messages.replaceAll("\n", " ").replaceAll("*", "")
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ session_name: uuidv4(),
|
|
|
+ userId: this.userid,
|
|
|
+ file_ids: ""
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
|
|
|
+ .then(response => {
|
|
|
+ let data = response.data.FunctionResponse;
|
|
|
+ // console.log("data", data);
|
|
|
+ if (data.message) {
|
|
|
+ let dArray = {};
|
|
|
+ try {
|
|
|
+ dArray = JSON.parse(
|
|
|
+ data.message.replaceAll("```json", "").replaceAll("```", "")
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error_________________" + error);
|
|
|
+ try {
|
|
|
+ let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
|
|
|
+ let match = data.message.match(regex);
|
|
|
+ dArray = JSON.parse(
|
|
|
+ match[0]
|
|
|
+ .replace(/\n/g, "")
|
|
|
+ .replace(/\s{2,}/g, "")
|
|
|
+ .replace(/\'/g, '"')
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error_________________" + error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log("dArray", dArray);
|
|
|
+ // _this.submit2(dArray);
|
|
|
+ // 提交评分
|
|
|
+ // if (!dArray) {
|
|
|
+ // _this.$emit("updateLoading", {val:_this.task,val2:_this.wIndex,val3:false});
|
|
|
+ // }
|
|
|
+ let processedData = {};
|
|
|
+
|
|
|
+ dArray.forEach(function(item) {
|
|
|
+ let key = Object.keys(item)[0];
|
|
|
+ let value = item[key];
|
|
|
+ processedData[key] = value;
|
|
|
+ });
|
|
|
+ processedData.content = "";
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ cid: _this.id,
|
|
|
+ s: _this.stage,
|
|
|
+ t: _this.task,
|
|
|
+ rate: JSON.stringify(processedData),
|
|
|
+ uid: _this.stUid
|
|
|
+ };
|
|
|
+ // console.log(params);
|
|
|
+ _this.ajax
|
|
|
+ .get(_this.$store.state.api + "updateWorksEva", params)
|
|
|
+ .then(res => {
|
|
|
+ _this.$message({
|
|
|
+ message: "评价成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ console.log(_this.wIndex, _this.task);
|
|
|
+ _this.$emit("updateLoading", {
|
|
|
+ val: _this.toolIndex,
|
|
|
+ val2: _this.wIndex,
|
|
|
+ val3: false
|
|
|
+ });
|
|
|
+
|
|
|
+ _this.getData();
|
|
|
+ // _this.markScoPopover = false;
|
|
|
+ // _this.$emit("update:loading", false);
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ _this.$message.error("评价失败");
|
|
|
+ _this.$emit("updateLoading", {
|
|
|
+ val: _this.toolIndex,
|
|
|
+ val2: _this.wIndex,
|
|
|
+ val3: false
|
|
|
+ });
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.$forceUpdate();
|
|
|
+
|
|
|
+ callback ? callback() : "";
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ // _this.markScoPopover = false;
|
|
|
+ // _this.$emit("update:loading", false);
|
|
|
+ _this.$emit("updateLoading", {
|
|
|
+ val: _this.toolIndex,
|
|
|
+ val2: _this.wIndex,
|
|
|
+ val3: false
|
|
|
+ });
|
|
|
+ _this.$message.error("评价失败");
|
|
|
+
|
|
|
+ // _this.loading = false
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // ai循环评分
|
|
|
+ aiupdetaSco(messages, uid, stage, task, callback) {
|
|
|
+ let _this = this;
|
|
|
+
|
|
|
+ let parm = {
|
|
|
+ assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
+ message: [
|
|
|
+ {
|
|
|
+ type: "text",
|
|
|
+ text: messages.replaceAll("\n", " ").replaceAll("*", "")
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ session_name: uuidv4(),
|
|
|
+ userId: this.userid,
|
|
|
+ file_ids: ""
|
|
|
+ };
|
|
|
+ return new Promise(resolve => {
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", parm)
|
|
|
+ .then(response => {
|
|
|
+ let data = response.data.FunctionResponse;
|
|
|
+ // console.log(data);
|
|
|
+
|
|
|
+ if (data.message) {
|
|
|
+ let dArray = {};
|
|
|
+ try {
|
|
|
+ dArray = JSON.parse(
|
|
|
+ data.message.replaceAll("```json", "").replaceAll("```", "")
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error_________________" + error);
|
|
|
+ try {
|
|
|
+ let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
|
|
|
+ let match = data.message.match(regex);
|
|
|
+ dArray = JSON.parse(
|
|
|
+ match[0]
|
|
|
+ .replace(/\n/g, "")
|
|
|
+ .replace(/\s{2,}/g, "")
|
|
|
+ .replace(/\'/g, '"')
|
|
|
+ );
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error_________________" + error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log("dArray", dArray);
|
|
|
+ let processedData = {};
|
|
|
+
|
|
|
+ dArray.forEach(function(item) {
|
|
|
+ let key = Object.keys(item)[0];
|
|
|
+ let value = item[key];
|
|
|
+ processedData[key] = value;
|
|
|
+ });
|
|
|
+ processedData.content = "";
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ cid: _this.id,
|
|
|
+ s: stage,
|
|
|
+ t: task,
|
|
|
+ rate: JSON.stringify(processedData),
|
|
|
+ uid: uid
|
|
|
+ };
|
|
|
+ // console.log("params", params);
|
|
|
+ _this.ajax
|
|
|
+ .get(_this.$store.state.api + "updateWorksEva", params)
|
|
|
+ .then(res => {
|
|
|
+ resolve(1);
|
|
|
+ _this.$message({
|
|
|
+ message: "评价成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ resolve(1);
|
|
|
+ _this.$message.error("评价失败");
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ callback ? callback() : "";
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ resolve(1);
|
|
|
+ _this.$message.error("评价失败");
|
|
|
+ // _this.loading = false
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped>
|
|
|
+.scoreTit {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 600;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
+.scoreStar {
|
|
|
+ background-color: #f3f7fd;
|
|
|
+ padding: 10px;
|
|
|
+ margin: 10px 0;
|
|
|
+ max-height: 100px;
|
|
|
+ min-height: 60px;
|
|
|
+ overflow: auto;
|
|
|
+}
|
|
|
+.scoreStarBack {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+.briefTit {
|
|
|
+ width: 150px;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ overflow: hidden;
|
|
|
+ white-space: nowrap;
|
|
|
+}
|
|
|
+</style>
|