ソースを参照

ai提示词增加json格式

linxiaobin 2 週間 前
コミット
65eecea9b1
1 ファイル変更32 行追加32 行削除
  1. 32 32
      src/components/gpsren.vue

+ 32 - 32
src/components/gpsren.vue

@@ -1,5 +1,5 @@
 <template>
-    <div> 
+    <div>
         <el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm" label-position="top">
 
             <el-col :span="24">
@@ -63,7 +63,7 @@
                     <div class="test-form ai-evaluate">
                         <div v-if="showAIEvaluate"><i class="el-icon-loading"></i></div>
                         <div v-else >
-                          <p v-html="resp"></p>   
+                          <p v-html="resp"></p>
                         </div>
                     </div>
                 </div>
@@ -75,7 +75,7 @@
                     <div class="test-form ai-evaluate">
                         <div v-if="showAIEvaluate"><i class="el-icon-loading"></i></div>
                         <div v-else >
-                          <p v-html="resp"></p>   
+                          <p v-html="resp"></p>
                         </div>
                     </div>
                 </div>
@@ -87,7 +87,7 @@
                     <div class="test-form ai-evaluate">
                          <div v-if="showAIEvaluate"><i class="el-icon-loading"></i></div>
                         <div v-else >
-                          <p v-html="resp"></p>   
+                          <p v-html="resp"></p>
                         </div>
                     </div>
                 </div>
@@ -99,7 +99,7 @@
                     <div class="test-form ai-evaluate">
                          <div v-if="showAIEvaluate"><i class="el-icon-loading"></i></div>
                         <div v-else >
-                          <p v-html="resp"></p>   
+                          <p v-html="resp"></p>
                         </div>
                     </div>
                 </div>
@@ -111,7 +111,7 @@
                     <!-- <div class="test-form ai-evaluate">
                          <div v-if="showAIEvaluate"><i class="el-icon-loading"></i></div>
                         <div v-else >
-                          <p v-html="resp"></p>   
+                          <p v-html="resp"></p>
                         </div>
                     </div> -->
                 </div>
@@ -127,8 +127,8 @@
                 <div v-else  class="opt-area" >
                  <el-button  :disabled="showAIEvaluate" icon="el-icon-check" style="width: 100%;" size="small" type="success" plain  @click="onFinish">完成</el-button>
                 </div>
-            </el-col> 
-             
+            </el-col>
+
         </el-form>
 
 
@@ -163,7 +163,7 @@ import { getDictValueByType } from '../api/dict'
 
 import { mockAI, steps ,tips} from '../mock/gpsren';
 
-import {askAI,postGPSREN,getStepModel} from '../api/ai' 
+import {askAI,postGPSREN,getStepModel} from '../api/ai'
 let thisPage = null
 
 let stepMapToCnt = {}
@@ -174,7 +174,7 @@ export default {
         question:Object,
         finish:Function
     },
- 
+
     data() {
         return {
             headers: {
@@ -228,7 +228,7 @@ export default {
           spinner: 'el-icon-loading',
           background: 'rgba(0, 0, 0, 0.7)'
         });
-        this.$nextTick(()=>{ 
+        this.$nextTick(()=>{
             this.stepmodel = {
                 "P":"",
                 "S":"",
@@ -236,14 +236,14 @@ export default {
                 "E":""
                 }
             console.log("this.stepmodel===> ",this.stepmodel)
-            
+
             //todo
              getStepModel().then(resp=>{
                 console.log(resp)
                 if(resp.status == 200) {
                     let res = resp.data
                     if(res.code == 1) {
-                        
+
                          let stepModels = res.data.dataList
                          for(let n =0 ;n<stepModels.length;n++) {
                             let m = stepModels[n]
@@ -257,7 +257,7 @@ export default {
                 loading.close()
              })
         })
-      
+
     },
 
 
@@ -265,7 +265,7 @@ export default {
 
         //提交测评
         onAIEvaluate() {
-            let step = steps[this.active] 
+            let step = steps[this.active]
             if(!!!this.form[`${step.toLowerCase()}`]) {
                 //没有学生答案
                 this.$message({
@@ -276,11 +276,11 @@ export default {
                 return
             }
             this.showAIEvaluate = true
-            let run = () => { 
+            let run = () => {
                return  this.remoteAskAI(this.$props.question.courseName ,
                 step,
                 this.$props.question.gOriented,
-                this.$props.question[`${step.toLowerCase()}ScoreStd`] + ' '+ this.stepmodel[step],
+                this.$props.question[`${step.toLowerCase()}ScoreStd`] + ' '+ this.stepmodel[step]+"\n5.返回的回答直接就是json字符串,不需要```json  ```,前端parse可以直接转化的json形式,text为评价内容(为富文本形式,可以有图片之类的),score为分数\n",
                 this.form[`${step.toLowerCase()}`],
                 this.stepscore[step]
              )
@@ -308,7 +308,7 @@ export default {
                         try{
                             let jData = JSON.parse(res.data)
                             this.resp = jData.text
-                            this.score = jData.score 
+                            this.score = jData.score
                         }catch(e){
                             console.log(e)
                             this.resp = "AI返回值不符合格式要求"
@@ -319,7 +319,7 @@ export default {
                 } else {
                     this.resp = "AI超时"
                 }
-              
+
                 return this.resp
             }).catch(c=>{
                 this.resp = "服务故障,请重试"
@@ -330,12 +330,12 @@ export default {
             })
         },
 
-        onNext() { 
+        onNext() {
             //保存答案
             let step = steps[this.active]
 
             let a = this.saveForm[`${step.toLowerCase()}Answer`]
-           
+
             if(!!!a) {
                 this.$message({
                     type:"error",
@@ -344,9 +344,9 @@ export default {
                 })
                 return
             }
- 
+
             //进入到下一个步骤
-            this.active ++ 
+            this.active ++
 
             this.resp = ''
             this.showAIEvaluate = false
@@ -356,13 +356,13 @@ export default {
 
         onFinish() {
             //保存
-             
-             let params = { 
+
+             let params = {
                 goalInfoId: this.$props.question.id,
                 nAnswer:this.form.n
              }
              let p = Object.assign(params,this.saveForm)
-              
+
              postGPSREN(p).then(d=>{
                 console.log("postGPSREN",d)
                 if(d.status == 200) {
@@ -371,10 +371,10 @@ export default {
                    this.$props.finish && this.$props.finish()
                   }
                 }
-             }) 
-            
+             })
+
         },
-  
+
     },
 
     filters: {
@@ -383,11 +383,11 @@ export default {
             console.log("dddd==>",cs)
             if(!!cs) {
                return  cs['requires'] || ""
-            } 
+            }
             return ""
         },
-    }, 
-        
+    },
+
 }
 </script>