This commit is contained in:
zhangxuelin 2025-01-10 15:06:54 +08:00
commit dcf6d5b45d
2 changed files with 37 additions and 30 deletions

View File

@ -359,6 +359,11 @@ export default async function ({ app, shell, BrowserWindow, ipcMain }) {
//下载文件
ipcMain.on('download-file-default', (e, { url, fileName }) => {
console.log(url, fileName)
if (!url) {
e.reply('download-file-default' + fileName, false)
return;
}
createFolder('selfFile')
.then(async () => {
const browserWindow = BrowserWindow.getFocusedWindow()

View File

@ -19,27 +19,6 @@
<!-- <v-md-editor v-if="markeDownAnswer" :model-value="markeDownAnswer" mode="preview"></v-md-editor> -->
<v-md-preview v-if="markeDownAnswer" :text="markeDownAnswer"></v-md-preview>
<!-- <template v-if="answer.title">
<div class="flex justify-between">
<span style="font-size: 18px;color: #409eff;">封面页</span>
<el-button type="primary" link @click="onEdit(item, -1)">编辑</el-button>
</div>
<div class="con-item mb-5">
<div class="item-name">标题{{ answer.title }}</div>
<div class="item-name">副标题{{ answer.subTitle }}</div>
</div>
<div style="font-size: 18px;color: #409eff;">目录页</div>
<div class="con-item" v-for="(item, index) in answer.chapters">
<div class="item-name">
<span>{{ index + 1 }}{{ item.chapterTitle }}</span>
<el-button type="primary" link @click="onEdit(item, index)">编辑</el-button>
</div>
<div class="item-text">
<p v-for="(el, i) in item.chapterContents">{{ index + 1 }} - {{ i + 1 }} : {{ el.chapterTitle }}</p>
</div>
</div>
</template> -->
<el-empty v-else description="请选择符合您需要的教学模式,生成教学大纲" />
</div>
</div>
@ -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}PPT12...`
// 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')
})
</script>