|
|
@@ -231,7 +231,7 @@ import useImport from '@/hooks/useImport'
|
|
|
import { lang } from '@/main'
|
|
|
import selectUserDialog from './selectUserDialog.vue'
|
|
|
import { chat_stream } from '@/tools/aiChat'
|
|
|
-import axios from "@/services/config"
|
|
|
+import axios from '@/services/config'
|
|
|
const props = defineProps<{
|
|
|
visible: number[];
|
|
|
workIndex: number;
|
|
|
@@ -266,7 +266,7 @@ const previewImageToolRef = ref<any>(null)
|
|
|
// 选择用户组件
|
|
|
const selectUserDialogRef = ref<any>(null)
|
|
|
|
|
|
-//ai分析数据
|
|
|
+// ai分析数据
|
|
|
const aiAnalysisData = ref<Array<any>>([])
|
|
|
|
|
|
const md = new MarkdownIt()
|
|
|
@@ -484,7 +484,7 @@ const setEchartsArea1 = () => {
|
|
|
if (myChart.value) {
|
|
|
const _work =
|
|
|
props.showData.choiceQuestionListData[props.showData.workIndex]
|
|
|
- console.log('_work', _work)
|
|
|
+ console.log('_work', _work)
|
|
|
// 修正版,处理xAxis.data内为图片对象的case,formatter始终只拿到src或自定义label,保证无[object Object]问题
|
|
|
const option = {
|
|
|
tooltip: {
|
|
|
@@ -644,22 +644,23 @@ const setEchartsArea1 = () => {
|
|
|
}
|
|
|
|
|
|
// 获取分析
|
|
|
-const getAnalysis = ()=>{
|
|
|
- if(!props.showData.workDetail.id){
|
|
|
+const getAnalysis = () => {
|
|
|
+ if (!props.showData.workDetail.id) {
|
|
|
return
|
|
|
}
|
|
|
const params = {
|
|
|
- pid:props.showData.workDetail.id,
|
|
|
+ pid: props.showData.workDetail.id,
|
|
|
}
|
|
|
- axios.get('https://pbl.cocorobo.cn/api/pbl/select_pptAnalysisByPid?pid='+params.pid).then(res => {
|
|
|
+ axios.get('https://pbl.cocorobo.cn/api/pbl/select_pptAnalysisByPid?pid=' + params.pid).then(res => {
|
|
|
const data = res[0]
|
|
|
- if(data.length){
|
|
|
+ if (data.length) {
|
|
|
aiAnalysisData.value = data
|
|
|
- }else{
|
|
|
+ }
|
|
|
+ else {
|
|
|
aiAnalysisData.value = []
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
- console.log('get_pptAnalysis_err',err)
|
|
|
+ console.log('get_pptAnalysis_err', err)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -777,8 +778,8 @@ const viewUnsubmittedStudents = () => {
|
|
|
}
|
|
|
|
|
|
// ai生成选择题分析 选择题
|
|
|
-const aiAnalysisRefresh45 = ()=>{
|
|
|
- const _work = props.showData.choiceQuestionListData[props.showData.workIndex]
|
|
|
+const aiAnalysisRefresh45 = () => {
|
|
|
+ const _work = props.showData.choiceQuestionListData[props.showData.workIndex]
|
|
|
const msg = `# CONTEXT #
|
|
|
你是K-12阶段的AI教育课堂分析助手,基于上传的课件、逐字稿,以及当页的学生答题数据(选择题/问答题/智能体对话)进行智能分析。
|
|
|
|
|
|
@@ -792,7 +793,7 @@ const aiAnalysisRefresh45 = ()=>{
|
|
|
当前页面答题数据(选择题):【分析重点】
|
|
|
- 选择题题目:${_work.teststitle}
|
|
|
- 选项数据:${JSON.stringify(_work.choiceUser)}
|
|
|
-- 题目图片:${_work.timuList.lenght?_work.timuList[0].src:''}
|
|
|
+- 题目图片:${_work.timuList.lenght ? _work.timuList[0].src : ''}
|
|
|
- 未提交学生:${JSON.stringify(props.showData.unsubmittedStudents.map((item: any) => item.name))}
|
|
|
|
|
|
# ANALYSIS RULES #
|
|
|
@@ -809,53 +810,55 @@ const aiAnalysisRefresh45 = ()=>{
|
|
|
样例:
|
|
|
选择题正确率62%,核心概念“机器学习三步骤”(输入数据→训练模型→预测结果)掌握尚可,但“训练与预测区分”混淆率达38%;建议强化训练vs预测对比教学。`
|
|
|
|
|
|
-if(!currentAnalysis.value){
|
|
|
- aiAnalysisData.value.push({
|
|
|
- pid:props.showData.workDetail.id,
|
|
|
- index:props.showData.workIndex,
|
|
|
- loading:true,
|
|
|
- json:'',
|
|
|
- noEnd:true,
|
|
|
- update_at:'',
|
|
|
- create_at:"",
|
|
|
- })
|
|
|
-}else{
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
+ if (!currentAnalysis.value) {
|
|
|
+ aiAnalysisData.value.push({
|
|
|
+ pid: props.showData.workDetail.id,
|
|
|
+ index: props.showData.workIndex,
|
|
|
+ loading: true,
|
|
|
+ json: '',
|
|
|
+ noEnd: true,
|
|
|
+ update_at: '',
|
|
|
+ create_at: '',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
}).loading = true
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).json = ""
|
|
|
-}
|
|
|
+ }).json = ''
|
|
|
+ }
|
|
|
|
|
|
-chat_stream(msg,'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, 'zh-CN', (event) => {
|
|
|
- if (event.type === 'message') {
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).json = event.data
|
|
|
+ chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, 'zh-CN', (event) => {
|
|
|
+ if (event.type === 'message') {
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
+ }).json = event.data
|
|
|
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).loading = false
|
|
|
- }else if (event.type === 'messageEnd') {
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).json = event.data
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).noEnd = false
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && 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()
|
|
|
- }
|
|
|
-}).catch(err => {
|
|
|
- console.log('err',err)
|
|
|
-})
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
+ }).loading = false
|
|
|
+ }
|
|
|
+ else if (event.type === 'messageEnd') {
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
+ }).json = event.data
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
+ }).noEnd = false
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && 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()
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('err', err)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
// 问答题
|
|
|
-const aiAnalysisRefresh15 = ()=>{
|
|
|
+const aiAnalysisRefresh15 = () => {
|
|
|
const msg = `# CONTEXT #
|
|
|
你是K-12阶段的AI教育课堂分析助手,基于上传的课件、逐字稿,以及当页的学生答题数据(选择题/问答题/智能体对话)进行智能分析。
|
|
|
|
|
|
@@ -868,7 +871,7 @@ const aiAnalysisRefresh15 = ()=>{
|
|
|
- 课程学科:${props.courseDetail.name}
|
|
|
当前页面答题数据(问答题):【分析重点】
|
|
|
- 问答题题目:${props.showData.workDetail.json.answerQ}
|
|
|
-- 回答数据:${JSON.stringify(processedWorkArray.value.map((i)=>({user:i.name,answer:i.content.answer})))}
|
|
|
+- 回答数据:${JSON.stringify(processedWorkArray.value.map((i) => ({user: i.name, answer: i.content.answer})))}
|
|
|
- 未提交学生:${JSON.stringify(props.showData.unsubmittedStudents.map((item: any) => item.name))}
|
|
|
|
|
|
# ANALYSIS RULES #
|
|
|
@@ -884,76 +887,78 @@ const aiAnalysisRefresh15 = ()=>{
|
|
|
# EXAMPLES #
|
|
|
样例:
|
|
|
选择题正确率62%,核心概念“机器学习三步骤”(输入数据→训练模型→预测结果)掌握尚可,但“训练与预测区分”混淆率达38%;建议强化训练vs预测对比教学。`
|
|
|
-if(!currentAnalysis.value){
|
|
|
- aiAnalysisData.value.push({
|
|
|
- pid:props.showData.workDetail.id,
|
|
|
- index:props.showData.workIndex,
|
|
|
- loading:true,
|
|
|
- json:'',
|
|
|
- noEnd:true,
|
|
|
- update_at:'',
|
|
|
- create_at:"",
|
|
|
- })
|
|
|
-}else{
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
+ if (!currentAnalysis.value) {
|
|
|
+ aiAnalysisData.value.push({
|
|
|
+ pid: props.showData.workDetail.id,
|
|
|
+ index: props.showData.workIndex,
|
|
|
+ loading: true,
|
|
|
+ json: '',
|
|
|
+ noEnd: true,
|
|
|
+ update_at: '',
|
|
|
+ create_at: '',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
}).loading = true
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).json = ""
|
|
|
-}
|
|
|
+ }).json = ''
|
|
|
+ }
|
|
|
|
|
|
-chat_stream(msg,'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, 'zh-CN', (event) => {
|
|
|
- if (event.type === 'message') {
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).json = event.data
|
|
|
+ chat_stream(msg, 'a7741704-ba56-40b7-a6b8-62a423ef9376', props.userId, 'zh-CN', (event) => {
|
|
|
+ if (event.type === 'message') {
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
+ }).json = event.data
|
|
|
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).loading = false
|
|
|
- }else if (event.type === 'messageEnd') {
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).json = event.data
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
- }).noEnd = false
|
|
|
- aiAnalysisData.value.find((item:any)=>{
|
|
|
- return item.pid === props.showData.workDetail.id && 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()
|
|
|
- }
|
|
|
-}).catch(err => {
|
|
|
- console.log('err',err)
|
|
|
-})
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
+ }).loading = false
|
|
|
+ }
|
|
|
+ else if (event.type === 'messageEnd') {
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
+ }).json = event.data
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
+ }).noEnd = false
|
|
|
+ aiAnalysisData.value.find((item:any) => {
|
|
|
+ return item.pid === props.showData.workDetail.id && 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()
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ console.log('err', err)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
|
|
|
// 当前分析
|
|
|
-const currentAnalysis = computed(()=>{
|
|
|
- return aiAnalysisData.value.find((item:any)=>{
|
|
|
+const currentAnalysis = computed(() => {
|
|
|
+ return aiAnalysisData.value.find((item:any) => {
|
|
|
return item.pid === props.showData.workDetail.id && item.index === props.showData.workIndex
|
|
|
})
|
|
|
})
|
|
|
|
|
|
// 保存分析
|
|
|
-const saveAnalysis = ()=>{
|
|
|
- if(!currentAnalysis.value){
|
|
|
+const saveAnalysis = () => {
|
|
|
+ if (!currentAnalysis.value) {
|
|
|
return
|
|
|
}
|
|
|
const params = [{
|
|
|
- pid:props.showData.workDetail.id,
|
|
|
- idx:props.showData.workIndex,
|
|
|
- json:currentAnalysis.value.json,
|
|
|
+ pid: props.showData.workDetail.id,
|
|
|
+ idx: props.showData.workIndex,
|
|
|
+ json: currentAnalysis.value.json,
|
|
|
}]
|
|
|
|
|
|
- axios.post('https://pbl.cocorobo.cn/api/pbl/insert_pptAnalysis',params).then(res => {
|
|
|
- if(res==1){
|
|
|
- console.log("保存成功")
|
|
|
+ axios.post('https://pbl.cocorobo.cn/api/pbl/insert_pptAnalysis', params).then(res => {
|
|
|
+ if (res == 1) {
|
|
|
+ console.log('保存成功')
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
- console.log('insert_pptAnalysis_err',err)
|
|
|
+ console.log('insert_pptAnalysis_err', err)
|
|
|
})
|
|
|
}
|
|
|
|