From d7c57896daa0f3866b11f217a09afec357f4f5ab Mon Sep 17 00:00:00 2001 From: lyc Date: Fri, 10 Jan 2025 14:57:20 +0800 Subject: [PATCH] =?UTF-8?q?edit=20=E6=A1=86=E6=9E=B6=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/teachingDesign/container/center.vue | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/renderer/src/views/teachingDesign/container/center.vue b/src/renderer/src/views/teachingDesign/container/center.vue index c3d083e..97ffb8e 100644 --- a/src/renderer/src/views/teachingDesign/container/center.vue +++ b/src/renderer/src/views/teachingDesign/container/center.vue @@ -19,27 +19,6 @@ - @@ -54,7 +33,7 @@ import EditDialog from './edit-dialog.vue' import emitter from '@/utils/mitt' import * as commUtils from '@/utils/comm.js' import { createChart, sendChart } from '@/api/ai/index' -import { completion, addSyllabus, removeSyllabus, editSyllabus } from '@/api/mode/index.js' +import { completion, addSyllabus, removeSyllabus, editSyllabus, modelList } from '@/api/mode/index.js' import { createOutlineV2 } from '@/utils/ppt-request.js' import useUserStore from '@/store/modules/user' import { cloneDeep } from 'lodash' @@ -111,12 +90,13 @@ const createAi = async () => { } let str = selectedData.value.map( item => item.name).join('、') - let bookV = curNode.roottitle.split('-')[1] + '版' + // let bookV = curNode.roottitle.split('-')[1] + '版' loading.value = true try { + params.prompt = prompt.value.replace(/{模板名称}/g, str) - params.prompt = `针对${curNode.edustage}${curNode.edusubject}${bookV}${curNode.itemtitle}这一课,根据以下教学环节:${str},进行课件教学PPT内容设计,按照幻灯片1、幻灯片2、...的格式` + //params.prompt = `针对${curNode.edustage}${curNode.edusubject}${bookV}${curNode.itemtitle}这一课,根据以下教学环节:${str},进行课件教学PPT内容设计,按照幻灯片1、幻灯片2、...的格式` // params.template = item.prompt // 教学大模型 @@ -247,12 +227,24 @@ const getChartId = () => { }) } -onUnmounted(() => { - emitter.off('selected') - emitter.off('onShow') - emitter.off('editItem') - -}) +// 查询prompt 替换 +const prompt = ref('') +const getPrompt = async () => { + const { rows } = await modelList({ model: 5 }) + + let str = rows.find(item => item.name.indexOf('框架设计') != -1).prompt + + str = str.replace('{学段}', curNode.edustage) + str = str.replace('{学科}', curNode.edusubject) + let bookV = curNode.roottitle + '版' + str = str.replace('{教材版本}', bookV) + str = str.replace('{课程名称}', `《${curNode.itemtitle}》`) + + prompt.value = str +} + + + const curNode = reactive({}) onMounted(() => { @@ -268,6 +260,16 @@ onMounted(() => { getChartId(); } + getPrompt() + +}) + + +onUnmounted(() => { + emitter.off('selected') + emitter.off('onShow') + emitter.off('editItem') + }) -- 2.44.0.windows.1