Просмотр исходного кода

Merge branch 'beta' of https://git.cocorobo.cn/jack/PPT into beta

lsc 4 дней назад
Родитель
Сommit
5e6bc6836e
2 измененных файлов с 70 добавлено и 10 удалено
  1. 3 2
      src/tools/aiChat.ts
  2. 67 8
      src/views/Student/components/choiceQuestionDetailDialog.vue

+ 3 - 2
src/tools/aiChat.ts

@@ -103,7 +103,8 @@ export const chat_stream = async (
   language: string,
   onMessage: (event: { type: 'message' | 'close' | 'error' | 'messageEnd'; data: string }) => void,
   session_name?: string,
-  file_ids?: Array<string>
+  file_ids?: Array<string>,
+  model?: string
 ): Promise<{ abort: () => void }> => {
   const agentData = await getAgentModel(agentId)
   const params: ChatParams = {
@@ -118,7 +119,7 @@ export const chat_stream = async (
     } ${msg}  ${language === 'hk' ? '請用繁體中文回复' : language === 'en' ? 'Please reply in English' : '请用中文回复'}`,
     uid: uuidv4(),
     stream: true,
-    model: agentData?.modelType || 'open-doubao',
+    model: model || agentData?.modelType || 'open-doubao',
     userId: userId,
     tts_language: getTtsLanguage(language),
     session_name: session_name || uuidv4()

+ 67 - 8
src/views/Student/components/choiceQuestionDetailDialog.vue

@@ -359,8 +359,7 @@
 
             </div>
           </div>
-          <div class="ai_content" v-if="currentAnalysis && currentAnalysis.json">
-            {{ currentAnalysis.json.text }}
+          <div class="ai_content" v-if="currentAnalysis && currentAnalysis.json" v-html="currentAnalysis.json.text">
           </div>
           <div class="ai_updateTime" v-if="currentAnalysis">{{ lang.ssUpdateTime }}:{{ currentAnalysis.update_at }}
           </div>
@@ -500,7 +499,9 @@ const echartsDialogRef = ref<any>(null)
 // ai分析数据
 const aiAnalysisData = ref<Array<any>>([])
 
-const md = new MarkdownIt()
+const md = new MarkdownIt({
+  html: true,
+})
 const { getFile } = useImport()
 
 // 判断是否是 URL 链接
@@ -1372,10 +1373,10 @@ ${a.content}\n`
       })
     }
   })
-
+  // if(props.userId)
 
   // - 未提交学生:${JSON.stringify(props.showData.unsubmittedStudents.map((item: any) => item.name))}
-  const msg = `# CONTEXT #
+  let msg = `# CONTEXT #
 你是K-12阶段的AI教育课堂分析助手,基于上传的课件、逐字稿,以及当页的学生答题数据(选择题/问答题/智能体对话)进行智能分析。
 
 # OBJECTIVE #
@@ -1403,6 +1404,47 @@ ${a.content}\n`
 # EXAMPLES #
 样例:
 智能体对话显示学生对“模型训练”概念模糊,多次询问“为什么不能直接告诉机器答案”。针对概念混淆学生,补充“人类学习类比”相关解释,巩固“从数据中学习规律”核心认知。`
+
+
+  if (["6c56ec0e-2c74-11ef-bee5-005056b86db5", "aea65da6-4399-11f1-9985-005056924926", "9c236d45-49cd-11f1-9985-005056924926"].includes(props.userId)) {
+    msg = `你是K-12阶段的AI教育课堂分析助手,基于当前课程信息以及当页的学生与单/多智能体对话数据,进行深入的智能分析。
+
+### 任务目标
+1. **总体统计分析**:
+   - 分析学生表现数据,例如全班学生互动数据,包括但不限于参与度、互动轮次、作文批改分布、作业完成情况等。
+   - 提取核心统计指标,例如发现共性问题、互动模式、分层水平分布、关键评分、完成度、优秀或需关注的学生。
+
+2. **洞察(Key Insights)**:
+   - 不是所有模块都需要的
+   - 输出的模块使用1~3句快速完成核心发现输出
+   - 保持简短、直观、易快速理解。
+3. **不输出教学建议或干预措施**。
+
+### 输出格式
+1. Markdown表格:展示关键统计指标(发言次数、互动频率、提问数量、主题分布)。
+2. ASCII条形图(可选):展示各项指标对比情况(绝对不要ASCII条形图,应该显示指标名字)
+3. 洞察与建议:分点呈现,每点对应具体统计指标或数据来源,保持精简,直观、易快速理解。
+**注意,不必输出多余的开场白(可以有非常简短的),转场,铺垫,形容词等,尽可能把输出留给有价值的发现**
+**对于重点要注意的内容,可以用 <span style="color:red"> 内容 </span> 以及 markdown的强调语法来highlight**
+
+### 注意事项
+- 输出简洁明了,重点突出。
+- 所有数字列右对齐,必要时显示百分比。
+- 避免冗长文字和详细案例描述。
+- 保持专业、友好语气,可使用 Emoji 提示情绪、课堂氛围或学生表现状态。
+- 输出保持在600字左右
+
+#INPUT#
+课程数据:
+- 课程名称:${props.courseDetail.title}
+- 课程学科:${props.courseDetail.name}
+当前页面答题数据(问答题):【分析重点】
+- AI应用
+- 对话数据:${chatMsg}
+`
+  }
+
+
   console.log('cs', msg)
   if (!currentAnalysis.value) {
     aiAnalysisData.value.push({
@@ -1428,7 +1470,7 @@ ${a.content}\n`
     if (event.type === 'message') {
       aiAnalysisData.value.find((item: any) => {
         return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
-      }).json.text = event.data
+      }).json.text = md.render(event.data)
 
       aiAnalysisData.value.find((item: any) => {
         return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
@@ -1437,7 +1479,7 @@ ${a.content}\n`
     else if (event.type === 'messageEnd') {
       aiAnalysisData.value.find((item: any) => {
         return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
-      }).json.text = event.data
+      }).json.text = md.render(event.data)
       aiAnalysisData.value.find((item: any) => {
         return item.pid === props.workId + (props.cid ? ',' + props.cid : '') && item.index === props.showData.workIndex
       }).noEnd = false
@@ -1446,7 +1488,7 @@ ${a.content}\n`
       }).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()
     }
-  }).catch(err => {
+  }, '', [], 'open-qwen-plus-latest').catch(err => {
     console.log('err', err)
   })
 }
@@ -2408,6 +2450,23 @@ onUnmounted(() => {
   &>.ai_content {
     font-size: 1rem;
     font-weight: 500;
+
+    :deep(table) {
+      border-collapse: collapse;
+      width: 100%;
+      margin: 0.5rem 0;
+
+      th,
+      td {
+        border: 1px solid #ddd;
+        padding: 0.5rem;
+        text-align: left;
+      }
+
+      th {
+        background: #f5f5f5;
+      }
+    }
   }
 
   &>.ai_echartsData {