markDialog.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245
  1. <template>
  2. <div class="markDialog" v-loading="vLoading">
  3. <div
  4. style="overflow: auto;overflow-x: hidden;width: 315px;box-sizing: content-box;border-right: 1px rgba(231, 231, 231, 1) solid;"
  5. >
  6. <div class="left">
  7. <div v-loading="ScLoading">
  8. <div class="scoreTit">
  9. <div>任务得分</div>
  10. <div>
  11. <span style="color: rgba(54, 129, 252, 1);">{{
  12. totalScore ? totalScore : 0
  13. }}</span
  14. >分
  15. </div>
  16. </div>
  17. <div class="allD">
  18. <div class="scoreStar">
  19. <div
  20. v-show="reveal"
  21. v-for="(e, index) in scoTitList"
  22. :key="index + 'a'"
  23. >
  24. <div class="scoreStarBack">
  25. <el-tooltip
  26. class="item"
  27. effect="dark"
  28. :content="e.value"
  29. placement="top"
  30. >
  31. <div class="briefTit">
  32. {{ e.value }}
  33. </div>
  34. </el-tooltip>
  35. <el-rate v-model="e.cog"></el-rate>
  36. </div>
  37. </div>
  38. <div
  39. v-show="!reveal"
  40. v-for="(e, index) in scoTitList.slice(0, 3)"
  41. :key="index + 'b'"
  42. >
  43. <div class="scoreStarBack">
  44. <el-tooltip
  45. class="item"
  46. effect="dark"
  47. :content="e.value"
  48. placement="top"
  49. >
  50. <div class="briefTit">
  51. {{ e.value }}
  52. </div>
  53. </el-tooltip>
  54. <el-rate v-model="e.cog"></el-rate>
  55. </div>
  56. </div>
  57. </div>
  58. <div
  59. v-if="reveal && scoTitList.length > 3"
  60. class="scoreStar2"
  61. @click="revealBtn"
  62. >
  63. 折叠 <i class="el-icon-arrow-up"></i>
  64. </div>
  65. <div
  66. v-if="!reveal && scoTitList.length > 3"
  67. class="scoreStar2"
  68. @click="revealBtn"
  69. >
  70. 全部 <i class="el-icon-arrow-down"></i>
  71. </div>
  72. </div>
  73. <div class="AreaCss">
  74. <el-input
  75. type="textarea"
  76. placeholder="您可在此输入评语"
  77. v-model="textarea"
  78. style="padding-bottom: 10px;"
  79. >
  80. </el-input>
  81. <div
  82. class="AreaBtn"
  83. v-if="currentUid.type == 10 || currentUid.type == 13 || isMarkCom == 1"
  84. @click="generateMsg(currentUid)"
  85. >
  86. <span>重新生成</span>
  87. </div>
  88. </div>
  89. <div
  90. style="width:100%;display:flex;height: 25px;;justify-content: space-between;"
  91. >
  92. <div
  93. class="ScrBtn"
  94. @click="AIsubmit(currentUid)"
  95. v-if="
  96. currentUid.type == 10 || currentUid.type == 13 || isMarkCom == 1
  97. "
  98. >
  99. <img
  100. src="../../../assets/icon/newIcons/Brootper.svg"
  101. alt=""
  102. />AI评分
  103. </div>
  104. <div v-else></div>
  105. <div style="display: flex;">
  106. <div
  107. class="ScrBtn"
  108. @click="reset"
  109. style="color: rgba(0, 0, 0, 0.6);background-color: rgba(243, 247, 253, 1);border: none;"
  110. >
  111. 重置
  112. </div>
  113. <div
  114. class="ScrBtn"
  115. @click="submit"
  116. style="margin-left: 10px;color:#fff;border: none;background-color: rgba(54, 129, 252, 1);"
  117. >
  118. 确认
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. <!-- 提交列表 -->
  124. <div>
  125. <div class="workListTit" @click="workListTitBtn">
  126. <i class="el-icon-arrow-down"></i>提交列表({{ workList.length }})
  127. </div>
  128. <div
  129. v-if="workListShow"
  130. v-for="(i, index) in workList"
  131. :key="index"
  132. :class="['schPer', i.userid == DgUid ? 'selBlock' : '']"
  133. style="cursor: pointer;"
  134. @click="cutPer(i.userid)"
  135. >
  136. <img v-if="i.headportrait" :src="i.headportrait" alt="" />
  137. <img
  138. v-else
  139. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  140. alt=""
  141. />
  142. <div class="con">
  143. <div class="tit">
  144. <span
  145. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;"
  146. >{{ i.name }}</span
  147. >
  148. <span
  149. style="font-size: 14px;color:rgba(0, 0, 0, 0.4);"
  150. v-if="i.markSco == null"
  151. >未评分</span
  152. >
  153. <span
  154. v-else
  155. style="font-size: 16px;color: rgba(0, 0, 0, 0.9);font-weight: 600;"
  156. >{{ i.markSco }}</span
  157. >
  158. </div>
  159. <div class="Timer">{{ i.time }}</div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. <!-- 作业展示区 -->
  166. <div class="Rig">
  167. <div class="RigTop">
  168. <div
  169. style="display: flex;align-items: center;justify-content: space-between;width: 100%;"
  170. >
  171. <div
  172. class="schPer"
  173. style="border: none;width: 300px;padding: 0;margin: 0;"
  174. >
  175. <img
  176. v-if="currentUid.headportrait"
  177. :src="currentUid.headportrait"
  178. alt=""
  179. />
  180. <img
  181. v-else
  182. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  183. alt=""
  184. />
  185. <div class="con">
  186. <div class="tit">
  187. <span
  188. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;"
  189. >{{ currentUid.name }}</span
  190. >
  191. </div>
  192. <div class="Timer">{{ currentUid.time }}</div>
  193. </div>
  194. </div>
  195. <div class="cutStuBtn">
  196. <div>
  197. <span @click="prevStu" style="cursor: pointer;">上一个</span>
  198. </div>
  199. <div>
  200. <span @click="nextStu" style="cursor: pointer;">下一个</span>
  201. </div>
  202. <!-- <div><span @click="prevStu" v-if="this.current > 0">上一个</span></div>
  203. <div><span @click="nextStu" v-if="this.current < this.workList.length-1">下一个</span></div> -->
  204. </div>
  205. </div>
  206. </div>
  207. <div class="RigConTit">
  208. <div :class="[cutNum ? '' : 'RigConTitOn']" @click="cutPage(0)">
  209. 学生作业
  210. </div>
  211. <div :class="[cutNum ? 'RigConTitOn' : '']" @click="cutPage(1)">
  212. 点赞与评论
  213. </div>
  214. </div>
  215. <div class="RigCon">
  216. <!-- 作业内容 -->
  217. <div v-if="cutNum == 0" style="height: 100%;">
  218. <div
  219. v-if="
  220. currentUid.type == 13 || currentUid.type == 10
  221. // currentUid.type == 15
  222. "
  223. >
  224. <div class="cont" v-html="currentUid.content.text"></div>
  225. </div>
  226. <div v-if="currentUid.type == 1">
  227. <img
  228. @click="previewImg(currentUid.content)"
  229. style="max-width: 100%;object-fit: cover;"
  230. :src="currentUid.content"
  231. alt=""
  232. />
  233. </div>
  234. <div v-if="currentUid.type == 3">
  235. <div style="width: 100%;text-align: center;">
  236. <div
  237. style="margin-bottom: 20px;font-weight: 600;font-size: 16px;"
  238. >
  239. {{ currentUid.content[0].answerTitle }}
  240. </div>
  241. <div>{{ currentUid.content[0].answer }}</div>
  242. </div>
  243. </div>
  244. <div v-if="currentUid.type == 4" style="height: 100%;">
  245. <iframe
  246. v-if="ifPdf == 1"
  247. style="width: 100%; height: 99%; border: none"
  248. :src="
  249. 'https://cloud.cocorobo.cn/pdf.js/web/viewer.html?file=' +
  250. encodeURIComponent(currentUid.content)
  251. "
  252. ></iframe>
  253. <iframe
  254. v-else
  255. style="width: 100%; height: 100%; border: none"
  256. :src="
  257. 'https://view.officeapps.live.com/op/view.aspx?src=' +
  258. encodeURIComponent(currentUid.content)
  259. "
  260. frameborder="0"
  261. ></iframe>
  262. </div>
  263. <div v-if="currentUid.type == 12" style="height: 100%;">
  264. txt
  265. </div>
  266. <div v-if="currentUid.type == 15">
  267. <div
  268. class="worksAnswer"
  269. v-if="currentUid.content && currentUid.type == 15"
  270. @click="
  271. openCocoPi(
  272. 57,
  273. this.toolIndex,
  274. currentUid.userid,
  275. currentUid.name
  276. )
  277. "
  278. >
  279. <img src="../../../assets/icon/codeFile.png" />
  280. <div>点击打开CocoPi</div>
  281. </div>
  282. </div>
  283. <div v-if="currentUid.type == 5" style="height: 100%;">
  284. <video-player
  285. class="video-player vjs-custom-skin"
  286. :playsinline="true"
  287. :options="playerOptions"
  288. @play="onPlayerPlay($event)"
  289. style="width: 90%; height: 95%; margin: 0 0 0 30px"
  290. ></video-player>
  291. </div>
  292. </div>
  293. <!-- 点赞与评论 -->
  294. <div v-if="cutNum == 1">
  295. <div style="display: flex;align-items: center;">
  296. <img
  297. style="margin-right: 3px;"
  298. src="../../../assets/icon/newIcons/likeG.png"
  299. alt=""
  300. />点赞({{ likeList.length }})
  301. </div>
  302. <div class="likeList">
  303. <div v-for="i in likeList" :key="i.id">{{ i.username }}</div>
  304. </div>
  305. <div style="display: flex;align-items: center;">
  306. <img
  307. style="margin-right: 3px;"
  308. src="../../../assets/icon/newIcons/commG.png"
  309. alt=""
  310. />评论({{ commentList.length }})
  311. </div>
  312. <div class="commentListCss" v-if="commentList.length">
  313. <div
  314. style="padding-bottom: 25px;display: flex;justify-content: space-between;"
  315. v-for="i in commentList"
  316. :key="i.id"
  317. >
  318. <div
  319. class="schPer2"
  320. style="border: none;width: 270px;padding: 0;"
  321. >
  322. <img v-if="i.headportrait" :src="i.headportrait" alt="" />
  323. <img
  324. v-else
  325. src="https://beta.pbl.cocorobo.cn/pbl-teacher-table/dist/static/img/portal.b3cf7fa.png"
  326. alt=""
  327. />
  328. <div class="con">
  329. <div class="tit">
  330. <div class="TitName">{{ i.username }}</div>
  331. <span
  332. style="font-size: 14px;color: rgba(0, 0, 0, 0.9);font-weight: 400;"
  333. >{{ i.time }}</span
  334. >
  335. </div>
  336. <div class="Timer">{{ i.comment }}</div>
  337. </div>
  338. </div>
  339. <div>
  340. <span
  341. v-if="cUserid == i.likesId"
  342. style="color: #3B7BD7;cursor: pointer;"
  343. @click="deleteComment(i.id)"
  344. >删除</span
  345. >
  346. </div>
  347. </div>
  348. </div>
  349. </div>
  350. </div>
  351. </div>
  352. </div>
  353. </template>
  354. <script>
  355. import { v4 as uuidv4 } from "uuid";
  356. export default {
  357. props: ["uid", "stage", "toolIndex", "task", "scoTit", "markScoreVisible"],
  358. data() {
  359. return {
  360. textarea: "",
  361. reveal: false, //得分详情框全部与折叠
  362. workListShow: true, //作业显示
  363. cutNum: 0, //作业与评论切换
  364. scoTitList: [], //得分详情框数据
  365. workList: [], //作业列表
  366. cid: this.$route.query.courseId,
  367. cUserid: this.$route.query.userid, //账号登录人id
  368. cuScoCon: "",
  369. currentUid: {}, //当前评分框学生信息
  370. current: "", //上一位下一位中的第几位
  371. DgUid: this.uid, //当前评分框学生id
  372. likeList: [], //喜欢list
  373. commentList: [], //评分list
  374. workId: "", //作业id。用于分类评论与点赞list
  375. vLoading: false,
  376. allSco: 0,
  377. ifPdf: 1,
  378. ScLoading: false,
  379. playerOptions: {
  380. playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
  381. autoplay: false, //如果true,浏览器准备好时开始回放。
  382. muted: false, // 默认情况下将会消除任何音频。
  383. loop: false, // 导致视频一结束就重新开始。
  384. preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
  385. language: "zh-CN",
  386. aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  387. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  388. sources: [
  389. {
  390. type: "video/mp4", //这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目 || "video/ogg"|| "video/webm"
  391. src: "" //url地址require("../../../assets/media/aaa.mp4")
  392. }
  393. ],
  394. // poster: require("../../../assets/tu31.png"), //你的封面地址
  395. // poster: dataRes.imgUrl, //你的封面地址
  396. notSupportedMessage: "此视频暂无法播放,请稍后再试", //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  397. controlBar: {
  398. timeDivider: true, //当前时间和持续时间的分隔符
  399. durationDisplay: true, //显示持续时间
  400. remainingTimeDisplay: false, //是否显示剩余时间功能
  401. fullscreenToggle: true //全屏按钮
  402. }
  403. },
  404. xianObj: ["DOCX", "PPT", "PPTX", "MD", "TXT", "PDF"],
  405. };
  406. },
  407. watch: {
  408. markScoreVisible(newVal) {
  409. this.workListShow = true;
  410. this.reveal = false;
  411. this.cutNum = 0;
  412. this.textarea = "";
  413. this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  414. this.selectSWorksData();
  415. }
  416. },
  417. computed: {
  418. totalScore() {
  419. let a = 0;
  420. this.scoTitList.forEach(e => {
  421. if (e.cog) {
  422. a += e.cog * 1;
  423. }
  424. });
  425. return (a / this.scoTit.length).toFixed(1);
  426. },
  427. isMarkCom(){
  428. // console.log('a',this.currentUid);
  429. if (this.currentUid.type == 4 || this.currentUid.type == 12) {
  430. let a = this.currentUid.content.slice(this.currentUid.content.lastIndexOf(".") + 1)
  431. if (this.xianObj.indexOf(a) == -1) {
  432. return 1
  433. }else{
  434. return 0
  435. }
  436. }else{
  437. return 0
  438. }
  439. }
  440. },
  441. mounted() {
  442. this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  443. this.selectSWorksData();
  444. },
  445. methods: {
  446. // 预览图片
  447. previewImg(url) {
  448. //预览图片
  449. this.$hevueImgPreview(url);
  450. },
  451. onPlayerPlay() {},
  452. // 获取文档id
  453. createFileid(url) {
  454. let _this = this;
  455. return new Promise((resolve, reject) => {
  456. try {
  457. _this.ajax
  458. .put("https://gpt4.cocorobo.cn/upload_file_knowledge", {
  459. url: url
  460. })
  461. .then(res => {
  462. let _data = res.data.FunctionResponse;
  463. if (_data.result && _data.result.id) {
  464. resolve(_data.result.id);
  465. } else {
  466. resolve(1);
  467. }
  468. })
  469. .catch(function(error) {
  470. resolve(1);
  471. });
  472. } catch (e) {
  473. resolve(1);
  474. }
  475. });
  476. },
  477. // 老师提交评分
  478. submit() {
  479. let data = this.scoTitList.map(e => {
  480. return e.value + ":" + e.cog;
  481. });
  482. // console.log("data", data);
  483. const processedData = {};
  484. data.forEach(item => {
  485. const [key, value] = item.split(":");
  486. processedData[key] = Number(value) ? Number(value) : 0;
  487. });
  488. processedData.content = this.textarea;
  489. // console.log(processedData);
  490. let params = {
  491. cid: this.cid,
  492. s: this.stage,
  493. t: this.task,
  494. rate: JSON.stringify(processedData),
  495. uid: this.DgUid
  496. };
  497. // return console.log(params);
  498. this.ajax
  499. .get(this.$store.state.api + "updateWorksEva", params)
  500. .then(res => {
  501. this.$message({
  502. message: "评价成功",
  503. type: "success"
  504. });
  505. this.ScLoading = false;
  506. this.selectSWorksData();
  507. // this.$emit("refreshOther", this.toolIndex);
  508. })
  509. .catch(err => {
  510. this.$message.error("评价失败");
  511. console.error(err);
  512. });
  513. },
  514. // 重置
  515. reset() {
  516. this.scoTitList.forEach(e => {
  517. e.cog = 0;
  518. });
  519. this.textarea = "";
  520. // this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  521. },
  522. async generateMsg(work) {
  523. this.ScLoading = true;
  524. let tit = this.scoTit;
  525. tit.forEach((e, index) => {
  526. if (!e.isai) {
  527. e.isai = 1;
  528. }
  529. });
  530. let _fileid = ''
  531. if(work.type == 4 || work.type == 12){
  532. _fileid = await this.createFileid(work.content);
  533. }
  534. let con = this.cuScoCon;
  535. let laws = "";
  536. for (let i = 0; i < tit.length; i++) {
  537. if (tit[i].isai == 1) {
  538. laws += `评价维度:${tit[i].value} 评价细则:${tit[i].rule} \n`;
  539. }
  540. }
  541. let msg = `NOTICE
  542. Role:你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“六级评价细则”评价学生作业。
  543. 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.
  544. ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
  545. Instruction: Based on the context, follow "Format example", write content.
  546. #Context
  547. ##要求
  548. 根据<评价细则>和<作业内容>的相关性评价作业,只用输出作业的综合性“评语”,字数控制在150字左右,不要输出其他无关内容。
  549. ##评分资料
  550. 评价细则:${laws}
  551. 作业内容:${_fileid ? "上传的文件内容" : con}
  552. # Format example
  553. 学生能够全面且正确地描述光合作用中氧气和葡萄糖的生成过程,涵盖光反应和暗反应的每个阶段和主要反应物及产物。同时,学生也能够全面、准确地解释氧气和葡萄糖在植物生命活动中的重要作用,并展示了对光合作用的深入理解。论文结构良好,内容详实,逻辑清晰,论据充分。
  554. `;
  555. // return console.log(msg);
  556. this.generateRemark(msg,_fileid);
  557. },
  558. // 重新获取评语
  559. generateRemark(messages,_fileid) {
  560. let _this = this;
  561. let params = {
  562. assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
  563. message: [
  564. {
  565. type: "text",
  566. text: messages.replaceAll("\n", " ").replaceAll("*", "")
  567. }
  568. ],
  569. session_name: uuidv4(),
  570. userId: this.cUserid,
  571. file_ids: _fileid ? [_fileid] : [],
  572. model: "gpt-4o-2024-08-06"
  573. };
  574. this.ajax
  575. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
  576. .then(response => {
  577. let data = response.data.FunctionResponse;
  578. // console.log("data", data);
  579. this.textarea = data.message;
  580. // this.selectSWorksData()
  581. this.ScLoading = false;
  582. })
  583. .catch(error => {
  584. this.ScLoading = false;
  585. _this.$message.error("评价失败");
  586. console.log(error);
  587. });
  588. },
  589. // ai评分
  590. async AIsubmit(work) {
  591. // return console.log("con", this.scoTit, this.cuScoCon);
  592. let _fileid = ''
  593. if(work.type == 4 || work.type == 12){
  594. _fileid = await this.createFileid(work.content);
  595. }
  596. this.ScLoading = true;
  597. let tit = this.scoTit;
  598. tit.forEach((e, index) => {
  599. if (!e.isai) {
  600. e.isai = 1;
  601. }
  602. });
  603. let con = this.cuScoCon;
  604. let laws = "";
  605. for (let i = 0; i < tit.length; i++) {
  606. if (tit[i].isai == 1) {
  607. laws += `评价维度:${tit[i].value} 评价细则:${tit[i].rule} \n`;
  608. }
  609. }
  610. let msg = `NOTICE
  611. Role: 你是一个专业的项目式学习导师,你要对学生的评价高度负责。你要根据“六级评价细则”给学生作品评分,并生成需要的JSON数据。
  612. 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.
  613. ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
  614. Instruction: Based on the context, follow "Format example", write content.
  615. #Context
  616. ##要求
  617. 根据<评价细则>和<作业内容>的相关性评价作业,判断该作业属于六级中的哪个等级,结合“评价维度”和等级写评语。如果作业内容与评价细则无关,则直接评为0星。
  618. ##评分资料
  619. 评价细则:${laws}
  620. 作业内容:${_fileid ? "上传的文件内容" : con}
  621. #输出要求#
  622. 输出每个维度的“等级”和作业的综合性“评语”
  623. “评语”控制在150字左右
  624. # Format example
  625. [{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'},{'评价名称':'评价等级0-5(数字)'},{'评语':'评语(150个字左右)'}]
  626. `;
  627. // console.log(msg);
  628. this.aiGet2(msg, _fileid);
  629. },
  630. // ai打分
  631. aiGet2(messages, _fileid) {
  632. let _this = this;
  633. let params = {
  634. assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
  635. message: [
  636. {
  637. type: "text",
  638. text: messages.replaceAll("\n", " ").replaceAll("*", "")
  639. }
  640. ],
  641. session_name: uuidv4(),
  642. userId: this.cUserid,
  643. file_ids: _fileid ? [_fileid] : [],
  644. model: "gpt-4o-2024-08-06"
  645. };
  646. this.ajax
  647. .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
  648. .then(response => {
  649. let data = response.data.FunctionResponse;
  650. // console.log("data", data);
  651. if (data.message) {
  652. let dArray = {};
  653. try {
  654. dArray = JSON.parse(
  655. data.message.replaceAll("```json", "").replaceAll("```", "")
  656. );
  657. } catch (error) {
  658. console.log("error_________________" + error);
  659. try {
  660. let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
  661. let match = data.message.match(regex);
  662. dArray = JSON.parse(
  663. match[0]
  664. .replace(/\n/g, "")
  665. .replace(/\s{2,}/g, "")
  666. .replace(/\'/g, '"')
  667. );
  668. } catch (error) {
  669. try {
  670. dArray = JSON.parse(
  671. data.message
  672. .replaceAll("```json", "")
  673. .replaceAll("# Solution", "")
  674. .replaceAll("```", "")
  675. .replace(/\n/g, "")
  676. .replace(/\s{2,}/g, "")
  677. .replace(/\'/g, '"')
  678. );
  679. } catch (error) {
  680. console.log("error_________________" + error);
  681. }
  682. console.log("error_________________" + error);
  683. }
  684. }
  685. let processedData = {};
  686. // console.log(JSON.parse(JSON.stringify(dArray)));
  687. dArray.forEach(function(item) {
  688. let key = Object.keys(item)[0];
  689. let value = item[key];
  690. processedData[key] = value;
  691. });
  692. // console.log(JSON.parse(JSON.stringify(processedData)));
  693. for (const key in processedData) {
  694. if (key == "评语") {
  695. processedData.content = processedData[key];
  696. }
  697. }
  698. delete processedData["评语"];
  699. let params = {
  700. cid: _this.cid,
  701. s: _this.stage,
  702. t: _this.task,
  703. rate: JSON.stringify(processedData),
  704. uid: _this.DgUid
  705. };
  706. // console.log("params", params);
  707. _this.ajax
  708. .get(_this.$store.state.api + "updateWorksEva", params)
  709. .then(res => {
  710. _this.$message({
  711. message: "评价成功",
  712. type: "success"
  713. });
  714. this.ScLoading = false;
  715. _this.selectSWorksData();
  716. })
  717. .catch(err => {
  718. _this.$message.error("评价失败");
  719. this.ScLoading = false;
  720. console.error(err);
  721. });
  722. }
  723. this.$forceUpdate();
  724. })
  725. .catch(error => {
  726. _this.$message.error("评价失败");
  727. console.log(error);
  728. });
  729. },
  730. // 上一个
  731. prevStu() {
  732. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  733. if (this.current > 0) {
  734. this.current--;
  735. this.DgUid = this.workList[this.current].userid;
  736. this.selectSWorksData();
  737. } else {
  738. this.$message.info("已经是第一位了");
  739. }
  740. },
  741. // 下一个
  742. nextStu() {
  743. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  744. if (this.current < this.workList.length - 1) {
  745. this.current++;
  746. this.DgUid = this.workList[this.current].userid;
  747. this.selectSWorksData();
  748. } else {
  749. this.$message.info("已经是最后一位了");
  750. }
  751. },
  752. // 提交列表点击切换
  753. cutPer(val) {
  754. if (this.ScLoading) return this.$message.info("请稍后,正在ai评价中");
  755. this.DgUid = val;
  756. this.selectSWorksData();
  757. },
  758. // 任务得分折叠
  759. revealBtn() {
  760. this.reveal = !this.reveal;
  761. },
  762. // 提交列表折叠
  763. workListTitBtn() {
  764. this.workListShow = !this.workListShow;
  765. },
  766. // 点赞与评论切换
  767. cutPage(val) {
  768. this.cutNum = val;
  769. },
  770. // 删除评论
  771. deleteComment(wid) {
  772. this.$confirm("确定删除此评论吗?", "提示", {
  773. confirmButtonText: "确定",
  774. cancelButtonText: "取消",
  775. type: "warning"
  776. })
  777. .then(() => {
  778. let params = {
  779. id: wid
  780. };
  781. this.ajax
  782. .get(this.$store.state.api + "deleteComment2", params)
  783. .then(res => {
  784. this.$message({
  785. message: "删除评论成功",
  786. type: "success"
  787. });
  788. this.selectSWorksData();
  789. })
  790. .catch(err => {
  791. console.error(err);
  792. });
  793. })
  794. .catch(() => {});
  795. },
  796. openCocoPi(tool, i, uid, uname) {
  797. let student = {
  798. userid: uid,
  799. student: uname
  800. };
  801. if (tool == 57) {
  802. window.parent.postMessage(
  803. {
  804. tools: tool + "teacher",
  805. cid: this.cid,
  806. stage: this.stage,
  807. task: this.task,
  808. tool: this.toolIndex,
  809. student: student
  810. },
  811. "*"
  812. );
  813. }
  814. },
  815. //全部作业
  816. selectSWorksData() {
  817. this.vLoading = true;
  818. this.textarea = "";
  819. let params = {
  820. uid: this.DgUid,
  821. cid: this.cid,
  822. s: this.stage,
  823. t: this.task,
  824. g: this.toolIndex
  825. };
  826. // return console.log(params);
  827. this.ajax
  828. .get(this.$store.state.api + "selectMarkDialogWorks", params)
  829. .then(res => {
  830. let data = res.data[0];
  831. data.forEach(e => {
  832. if (e.rate) {
  833. let data2 = JSON.parse(e.rate);
  834. // console.log("data2", data2);
  835. e.markSco = 0;
  836. for (const key in data2) {
  837. if (data2[key] && key != "content") {
  838. e.markSco += data2[key] * 1;
  839. }
  840. }
  841. // this.scoTitList;
  842. e.markSco = (e.markSco / this.scoTitList.length).toFixed(1);
  843. } else {
  844. e.markSco = null;
  845. }
  846. });
  847. this.workList = data;
  848. data.forEach((e, index) => {
  849. if (e.userid == this.DgUid) {
  850. this.currentUid = e;
  851. if (
  852. this.currentUid.type == 3 ||
  853. this.currentUid.type == 10 ||
  854. this.currentUid.type == 13
  855. // this.currentUid.type == 15
  856. ) {
  857. this.currentUid.content = JSON.parse(e.content);
  858. this.cuScoCon = this.currentUid.content.text;
  859. }
  860. if (this.currentUid.type == 4) {
  861. let a = this.currentUid.content;
  862. let data = a.slice(a.lastIndexOf(".") + 1);
  863. this.cuScoCon = this.currentUid.content;
  864. if (data == "pdf") {
  865. this.ifPdf = 1;
  866. } else {
  867. this.ifPdf = 0;
  868. }
  869. }
  870. if (this.currentUid.type == 5) {
  871. this.playerOptions.sources[0].src = this.currentUid.content;
  872. }
  873. this.current = index;
  874. this.workId = e.id;
  875. this.appraise(e);
  876. }
  877. });
  878. let likeData = res.data[1];
  879. this.likeList = [];
  880. likeData.forEach(e => {
  881. if (e.workId == this.workId) {
  882. this.likeList.push(e);
  883. }
  884. });
  885. let commentData = res.data[2];
  886. this.commentList = [];
  887. commentData.forEach(e => {
  888. if (e.workId == this.workId) {
  889. this.commentList.push(e);
  890. }
  891. });
  892. this.vLoading = false;
  893. });
  894. },
  895. // 处理任务的分展示
  896. appraise(val) {
  897. if (val.rate) {
  898. // this.scoTitList = JSON.parse(JSON.stringify(this.scoTit));
  899. // console.log("val.rate", val.rate);
  900. let data = JSON.parse(val.rate);
  901. this.scoTitList.forEach((e, index) => {
  902. e.cog = null;
  903. for (const key in data) {
  904. if (e.value == key) {
  905. e.cog = data[key] * 1;
  906. }
  907. if ("content" == key) {
  908. this.textarea = data[key];
  909. }
  910. }
  911. });
  912. } else {
  913. this.scoTitList.forEach(e => {
  914. e.cog = 0;
  915. });
  916. }
  917. }
  918. }
  919. };
  920. </script>
  921. <style scoped>
  922. .markDialog {
  923. display: flex;
  924. /* height: 100%; */
  925. min-height: 600px;
  926. height: 100%;
  927. }
  928. .left {
  929. overflow: auto;
  930. width: 310px;
  931. /* border-right: 1px rgba(231, 231, 231, 1) solid; */
  932. padding: 30px 20px;
  933. box-sizing: border-box;
  934. padding-right: 10px;
  935. }
  936. .Rig {
  937. flex: 1;
  938. padding: 15px;
  939. display: flex;
  940. flex-direction: column;
  941. }
  942. .RigTop {
  943. border-bottom: 1px rgba(231, 231, 231, 1) solid;
  944. padding: 0px 0 15px;
  945. }
  946. .AreaCss {
  947. position: relative;
  948. margin-bottom: 5px;
  949. }
  950. .AreaCss >>> .el-textarea__inner {
  951. min-height: 60px;
  952. max-height: 150px;
  953. padding-bottom: 20px;
  954. }
  955. .AreaBtn {
  956. position: absolute;
  957. width: calc(100% - 30px);
  958. text-align: right;
  959. background-color: #fff;
  960. bottom: 11px;
  961. right: 20px;
  962. color: rgba(54, 129, 252, 1);
  963. cursor: pointer;
  964. }
  965. .likeList {
  966. width: 100%;
  967. display: flex;
  968. padding: 10px 0;
  969. flex-wrap: wrap;
  970. }
  971. .likeList > div {
  972. padding: 4px 0px;
  973. background-color: rgba(243, 247, 253, 1);
  974. margin-right: 10px;
  975. width: calc((100% - 60px) / 7);
  976. text-align: center;
  977. text-overflow: ellipsis;
  978. white-space: nowrap;
  979. overflow: hidden;
  980. margin-bottom: 10px;
  981. }
  982. .likeList > div:nth-child(7n) {
  983. margin-right: 0px;
  984. }
  985. .commentListCss {
  986. background-color: #fafafa;
  987. padding: 25px 15px 0;
  988. box-sizing: border-box;
  989. margin-top: 10px;
  990. border-radius: 5px;
  991. }
  992. .RigConTit {
  993. width: 100%;
  994. display: flex;
  995. margin: 10px 0;
  996. }
  997. .RigConTit > div {
  998. font-size: 14px;
  999. color: rgba(0, 0, 0, 0.6);
  1000. padding: 8px;
  1001. cursor: pointer;
  1002. }
  1003. .RigConTitOn {
  1004. border-bottom: 3px solid rgba(54, 129, 252, 1);
  1005. }
  1006. .RigCon {
  1007. width: 100%;
  1008. overflow: auto;
  1009. flex: 1;
  1010. padding: 10px 0;
  1011. box-sizing: border-box;
  1012. /* background-color: aqua; */
  1013. }
  1014. .selBlock {
  1015. background-color: #f3f7fd !important;
  1016. border: 1px #68a0fc solid !important;
  1017. }
  1018. .cutStuBtn {
  1019. display: flex;
  1020. color: rgba(54, 129, 252, 1);
  1021. }
  1022. .cutStuBtn > div {
  1023. margin-left: 10px;
  1024. }
  1025. .scoreTit {
  1026. font-size: 16px;
  1027. font-weight: 600;
  1028. display: flex;
  1029. justify-content: space-between;
  1030. box-sizing: border-box;
  1031. color: rgba(0, 0, 0, 0.9);
  1032. }
  1033. .allD {
  1034. margin: 10px 0;
  1035. width: 100%;
  1036. min-height: 60px;
  1037. background-color: #f3f7fd;
  1038. }
  1039. .scoreStar2 {
  1040. padding: 0 10px 10px;
  1041. height: 100%;
  1042. flex: 1;
  1043. color: rgba(54, 129, 252, 1);
  1044. cursor: pointer;
  1045. }
  1046. .scoreStar {
  1047. padding: 0px 10px 10px;
  1048. height: 100%;
  1049. flex: 1;
  1050. }
  1051. .scoreStarBack {
  1052. flex: 1;
  1053. display: flex;
  1054. justify-content: space-between;
  1055. padding-top: 10px;
  1056. }
  1057. /* .scoreStar > div:first-child > .scoreStarBack {
  1058. margin-top: 0;
  1059. } */
  1060. .ScrBtn {
  1061. display: flex;
  1062. justify-content: center;
  1063. align-items: center;
  1064. cursor: pointer;
  1065. padding: 2px 8px;
  1066. border-radius: 5px;
  1067. color: rgba(54, 129, 252, 1);
  1068. border: 1px rgba(54, 129, 252, 1) solid;
  1069. }
  1070. .worksAnswer {
  1071. color: #4078dd;
  1072. margin: 10px 0;
  1073. font-size: 16px;
  1074. display: flex;
  1075. align-items: center;
  1076. }
  1077. .worksAnswer > img {
  1078. width: 100%;
  1079. height: 300px;
  1080. object-fit: contain;
  1081. margin: 0 auto;
  1082. display: block;
  1083. }
  1084. .briefTit {
  1085. width: 120px;
  1086. text-overflow: ellipsis;
  1087. overflow: hidden;
  1088. white-space: nowrap;
  1089. }
  1090. .workListTit {
  1091. color: rgba(0, 0, 0, 0.6);
  1092. font-size: 12px;
  1093. font-weight: 400;
  1094. margin: 10px 0;
  1095. cursor: pointer;
  1096. }
  1097. .schPer2 {
  1098. padding: 10px;
  1099. box-sizing: border-box;
  1100. display: flex;
  1101. border-radius: 5px;
  1102. border: 1px solid rgba(240, 242, 245, 1);
  1103. /* margin-bottom: 10px; */
  1104. }
  1105. .schPer2 > img {
  1106. width: 45px;
  1107. height: 45px;
  1108. border-radius: 50%;
  1109. object-fit: cover;
  1110. }
  1111. .schPer {
  1112. padding: 10px;
  1113. box-sizing: border-box;
  1114. display: flex;
  1115. border-radius: 5px;
  1116. border: 1px solid rgba(240, 242, 245, 1);
  1117. margin-bottom: 10px;
  1118. }
  1119. .schPer > img {
  1120. width: 40px;
  1121. height: 40px;
  1122. border-radius: 50%;
  1123. object-fit: cover;
  1124. }
  1125. .con {
  1126. flex: 1;
  1127. display: flex;
  1128. flex-direction: column;
  1129. justify-content: space-between;
  1130. padding: 0 10px;
  1131. box-sizing: border-box;
  1132. }
  1133. .con > .tit {
  1134. width: 100%;
  1135. display: flex;
  1136. justify-content: space-between;
  1137. }
  1138. .TitName {
  1139. width: 70px;
  1140. overflow: hidden;
  1141. text-overflow: ellipsis;
  1142. white-space: nowrap;
  1143. }
  1144. .worksAnswer {
  1145. color: #4078dd;
  1146. margin: 10px 0;
  1147. font-size: 16px;
  1148. position: relative;
  1149. }
  1150. .worksAnswer > img {
  1151. width: 500px;
  1152. height: 300px;
  1153. object-fit: contain;
  1154. margin: 0 auto;
  1155. display: block;
  1156. }
  1157. .cont {
  1158. overflow-wrap: break-word;
  1159. word-break: break-word;
  1160. white-space: pre-line;
  1161. }
  1162. .cont >>> table {
  1163. border-top: 1px solid #ccc;
  1164. border-left: 1px solid #ccc;
  1165. }
  1166. .cont >>> table td,
  1167. .cont >>> table th {
  1168. border-bottom: 1px solid #ccc;
  1169. border-right: 1px solid #ccc;
  1170. padding: 5px 10px;
  1171. max-width: 0px;
  1172. height: 30px;
  1173. vertical-align: baseline;
  1174. box-sizing: border-box;
  1175. }
  1176. .video-player >>> .video-js {
  1177. height: 100%;
  1178. }
  1179. </style>