Sfoglia il codice sorgente

fix(Student): 修复AI分析数据中pid未包含cid的问题

修正choiceQuestionDetailDialog.vue中多处pid的生成逻辑,确保当cid存在时能正确拼接进pid。这解决了当同时存在workId和cid时,数据查找可能失败的问题。
SanHQin 1 giorno fa
parent
commit
da3c5f3b79
1 ha cambiato i file con 29 aggiunte e 29 eliminazioni
  1. 29 29
      src/views/Student/components/choiceQuestionDetailDialog.vue

+ 29 - 29
src/views/Student/components/choiceQuestionDetailDialog.vue

@@ -17,7 +17,7 @@
           }}</div>
           <div class="c_t45_msg">
             <div>{{ lang.ssAnswerCount }} {{ props.showData.workArray.length }}<span
-                v-if="props.showData.unsubmittedStudents.length > 0">/{{ props.showData.unsubmittedStudents.length
+                v-if="props.showData.unsubmittedStudents.length > 0">/{{ props.showData.workArray.length + props.showData.unsubmittedStudents.length
                 }}</span></div>
             <span v-if="props.showData.unsubmittedStudents.length > 0" @click="viewUnsubmittedStudents()">{{
               lang.ssViewSubmitStatus2 }}</span>
@@ -910,7 +910,7 @@ const aiAnalysisRefresh45 = () => {
 
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
-      pid: props.workId,
+      pid: props.workId+(props.cid?','+props.cid:''),
       index: props.showData.workIndex,
       loading: true,
       generatingContent: true,
@@ -922,32 +922,32 @@ const aiAnalysisRefresh45 = () => {
   }
   else {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId && item.index === props.showData.workIndex
+      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
     }).loading = true
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId && item.index === props.showData.workIndex
+      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
     }).json = { text: '', echartsData: '' }
   }
 
   chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang, (event) => {
     if (event.type === 'message') {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).json.text = event.data
 
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).loading = false
     }
     else if (event.type === 'messageEnd') {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).json.text = event.data
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).noEnd = false
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       saveAnalysis()
     }
@@ -989,7 +989,7 @@ const aiAnalysisRefresh15 = () => {
 30人中15人提交问答题(参与率50%),核心概念“同理心地图”掌握薄弱。发现学生13在智能体对话中6次答“不知道”,需单独辅导设计思维基础概念。建议课程增加POV框架实例演练,强化痛点识别能力训练。`
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
-      pid: props.workId,
+      pid: props.workId+(props.cid?','+props.cid:''),
       index: props.showData.workIndex,
       loading: true,
       generatingContent: true,
@@ -1001,19 +1001,19 @@ const aiAnalysisRefresh15 = () => {
   }
   else {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId && item.index === props.showData.workIndex
+      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
     }).loading = true
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId && item.index === props.showData.workIndex
+      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
     }).json = { text: '', echartsData: '' }
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId && item.index === props.showData.workIndex
+      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
     }).generatingContent = true
   }
   getWordCloud15().then((res) => {
     flag += 1
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId && item.index === props.showData.workIndex
+      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
     }).generatingContent = false
     if (flag == 2) {
       saveAnalysis()
@@ -1023,22 +1023,22 @@ const aiAnalysisRefresh15 = () => {
     console.log(event)
     if (event.type === 'message') {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).json.text = event.data
 
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).loading = false
     }
     else if (event.type === 'messageEnd') {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).json.text = event.data
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).noEnd = false
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       flag += 1
       if (flag == 2) {
@@ -1090,7 +1090,7 @@ const getWordCloud15 = () => {
 
     chat_no_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang).promise.then((res) => {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).json.echartsData = JSON.parse(res)
       resolve(1)
     }).catch(err => {
@@ -1151,7 +1151,7 @@ ${a.content}\n`
   console.log("cs", msg)
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
-      pid: props.workId,
+      pid: props.workId+(props.cid?','+props.cid:''),
       index: props.showData.workIndex,
       loading: true,
       json: { text: '', echartsData: '' },
@@ -1162,32 +1162,32 @@ ${a.content}\n`
   }
   else {
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId && item.index === props.showData.workIndex
+      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
     }).loading = true
     aiAnalysisData.value.find((item: any) => {
-      return item.pid === props.workId && item.index === props.showData.workIndex
+      return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
     }).json = { text: '', echartsData: '' }
   }
 
   chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, lang.lang, (event) => {
     if (event.type === 'message') {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).json.text = event.data
 
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).loading = false
     }
     else if (event.type === 'messageEnd') {
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).json.text = event.data
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).noEnd = false
       aiAnalysisData.value.find((item: any) => {
-        return item.pid === props.workId && item.index === props.showData.workIndex
+        return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
       }).update_at = new Date().toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).replace(/\//g, '-')
       saveAnalysis()
     }
@@ -1200,7 +1200,7 @@ ${a.content}\n`
 // 当前分析
 const currentAnalysis = computed(() => {
   let _result = aiAnalysisData.value.find((item: any) => {
-    return item.pid === props.workId && item.index === props.showData.workIndex
+    return item.pid === props.workId+(props.cid?','+props.cid:'') && item.index === props.showData.workIndex
   })
 
   if (_result?.json?.echartsData) {