From 3195159a1a97e127e391fdb4c1c4cfe41bd36221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com> Date: Wed, 13 Nov 2024 14:36:39 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../container/newTask/taskTypeView.vue | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index 04ff553..e817af6 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -94,6 +94,7 @@ :data="workResource.entpCourseWorkList" style="width: 100%; height: 100%;" v-loading="pageParams.loading" + ref="tableRef" > @@ -499,7 +500,7 @@ function Apis(key) { // 年份 yearStr: entpCourseWorkQueryParams.yearStr !== '-1' ? entpCourseWorkQueryParams.yearStr:'', // 知识点 - thirdId: entpCourseWorkQueryParams.point&&entpCourseWorkQueryParams.point.length > 0 ? entpCourseWorkQueryParams.point[0]:'', + thirdId: entpCourseWorkQueryParams.point && entpCourseWorkQueryParams.point.length > 0 ? entpCourseWorkQueryParams.point[0]:'', // 关键字 keyword: entpCourseWorkQueryParams.keyWord && entpCourseWorkQueryParams.keyWord !== '' ? entpCourseWorkQueryParams.keyWord:'', @@ -510,9 +511,7 @@ function Apis(key) { }) } const handleQueryFromEntpCourseWork= async (queryType) => { - pageParams.value.loading = true; - // 初中政治特殊处理( warn: 需确认是否修改 ) // if (this.courseObj.edusubject=='政治' && this.courseObj.edustage=='初中') { @@ -536,32 +535,28 @@ const handleQueryFromEntpCourseWork= async (queryType) => { // workResource.entpCourseWorkList = entpcourseworkres.data; // workResource.entpCourseWorkTotal = entpcourseworkres.data.length; - data.forEach(item=> { - if (item.worktype == '选择题') { - item.worktype = '单选题' + data.forEach(item=> { + if (item.worktype == '选择题') { + item.worktype = '单选题' + } + }) + + // 格式化试题信息 + processList(data); + //workResource.entpCourseWorkList.push(...data); + workResource.entpCourseWorkList = data; + + // 初次加载时更新当前试题数量 + if (pageParams.value.isFirst) { + pageParams.value.isFirst = false; + pageParams.value.originCount = workResource.entpCourseWorkList.length; + pageParams.value.total = parseInt(res.msg); + paginationParams.pageNum = Math.ceil(parseInt(res.msg)/paginationParams.pageSize); + //console.log('first->', pageParams.value, paginationParams); } - }) - - // 格式化试题信息 - processList(data); - //workResource.entpCourseWorkList.push(...data); - workResource.entpCourseWorkList = data; - - // 初次加载时更新当前试题数量 - if (pageParams.value.isFirst) { - pageParams.value.isFirst = false; - pageParams.value.originCount = workResource.entpCourseWorkList.length; - pageParams.value.total = parseInt(res.msg); - paginationParams.pageNum = Math.ceil(parseInt(res.msg)/paginationParams.pageSize); - console.log('first->', pageParams.value, paginationParams); } - } - pageParams.value.loading = false; -}); - - //const entpcourseworkres = await listEntpcourseworkNew(queryForm); - - // const data = entpcourseworkres.data; + pageParams.value.loading = false; + }); } @@ -982,11 +977,14 @@ const showExamAnalyseDrawer = (row) => { }) } +const tableRef = ref(); const getPaginationList = ( page, limit ) => { paginationParams.pageNum = page; paginationParams.pageSize = limit; - console.log(page, limit) + //console.log(page, limit) handleQueryFromEntpCourseWork(0); + // 重置滚动条至顶部 + tableRef.value.setScrollTop(0); } const pageLoad = async() => { From f168e04405bea0fc347d94465202eb9260416ce4 Mon Sep 17 00:00:00 2001 From: lyc Date: Sat, 16 Nov 2024 23:37:11 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/api/mode/index.js | 45 ++++++++-- .../template-study/container/header.vue | 12 ++- .../container/keyword-dialog.vue | 85 ++++++++++++++++--- .../template-study/container/result.vue | 12 ++- 4 files changed, 130 insertions(+), 24 deletions(-) diff --git a/src/renderer/src/api/mode/index.js b/src/renderer/src/api/mode/index.js index 1ec7f76..51448f2 100644 --- a/src/renderer/src/api/mode/index.js +++ b/src/renderer/src/api/mode/index.js @@ -1,7 +1,7 @@ import request from '@/utils/request' import axios from 'axios' -let rootPath = import.meta.env.VITE_APP_ENV === 'production' ? "https://ai.ysaix.com:7864" : ''; +let rootPath = import.meta.env.VITE_APP_ENV === 'production' ? 'https://ai.ysaix.com:7864' : '' // 查询模板列表 export function modelList(params) { return request({ @@ -16,8 +16,8 @@ export function conversation(data) { url: rootPath + '/v1/api/new_conversation', method: 'get', headers: { - 'Authorization':'Bearer ragflow-IwNzMxMTIyOGY0ZTExZWZiOGE2MDI0Mm', - 'Content-Type': 'application/json', + Authorization: 'Bearer ragflow-IwNzMxMTIyOGY0ZTExZWZiOGE2MDI0Mm', + 'Content-Type': 'application/json' }, data: data }) @@ -29,10 +29,45 @@ export function completion(data) { url: rootPath + '/v1/api/completion', method: 'post', headers: { - 'Authorization':'Bearer ragflow-IwNzMxMTIyOGY0ZTExZWZiOGE2MDI0Mm', + Authorization: 'Bearer ragflow-IwNzMxMTIyOGY0ZTExZWZiOGE2MDI0Mm', 'Content-Type': 'application/json', - 'Accept': '*/*' + Accept: '*/*' }, data: data }) } + +// 添加提示词 (系统预设) +export function addKeyWords(data) { + return request({ + url: '/education/llmModel/copy', + method: 'post', + data + }) +} + +// 添加子模板 +export function addChildTemp(data) { + return request({ + url: '/education/llmModel', + method: 'post', + data + }) +} + +// 编辑子模板 +export function editChildTemp(data) { + return request({ + url: '/education/llmModel', + method: 'put', + data + }) +} + +// 删除子模板 +export function removeChildTemp(id) { + return request({ + url: '/education/llmModel/' + id, + method: 'delete' + }) +} diff --git a/src/renderer/src/components/template-study/container/header.vue b/src/renderer/src/components/template-study/container/header.vue index 12f42ab..2747619 100644 --- a/src/renderer/src/components/template-study/container/header.vue +++ b/src/renderer/src/components/template-study/container/header.vue @@ -20,7 +20,7 @@
- + @@ -31,7 +31,8 @@
- + + @@ -69,7 +70,7 @@ const curTemplate = reactive({ name: '', id: '' }) const templateList = ref([]) // 获取模板列表 const getTemplateList = () => { - modelList({ model: props.type, type: 1 }).then(res => { + modelList({ model: props.type, type: 1, ex3: 1 }).then(res => { templateList.value = res.rows Object.assign(curTemplate, res.rows[0]); emit('changeTemp', res.rows[0].id) @@ -93,6 +94,11 @@ const changeTemplate = (val) => { }) } +const onAdd = () =>{ + wordDialog.value = true + +} + onMounted(() => { getTemplateList() }) diff --git a/src/renderer/src/components/template-study/container/keyword-dialog.vue b/src/renderer/src/components/template-study/container/keyword-dialog.vue index 7ce82f2..7ecd927 100644 --- a/src/renderer/src/components/template-study/container/keyword-dialog.vue +++ b/src/renderer/src/components/template-study/container/keyword-dialog.vue @@ -1,28 +1,27 @@ @@ -55,18 +55,19 @@ - + + + \ No newline at end of file diff --git a/src/renderer/src/views/job-management/Details/index.vue b/src/renderer/src/views/job-management/Details/index.vue index 696f090..dbc2f05 100644 --- a/src/renderer/src/views/job-management/Details/index.vue +++ b/src/renderer/src/views/job-management/Details/index.vue @@ -40,6 +40,7 @@ + + \ No newline at end of file diff --git a/src/renderer/src/views/teachingDesign/container/right.vue b/src/renderer/src/views/teachingDesign/container/right.vue new file mode 100644 index 0000000..657b279 --- /dev/null +++ b/src/renderer/src/views/teachingDesign/container/right.vue @@ -0,0 +1,64 @@ + + + + + \ No newline at end of file diff --git a/src/renderer/src/views/teachingDesign/index.vue b/src/renderer/src/views/teachingDesign/index.vue new file mode 100644 index 0000000..ebf7680 --- /dev/null +++ b/src/renderer/src/views/teachingDesign/index.vue @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file From c803ecd796545081706564534404ac7a387b6793 Mon Sep 17 00:00:00 2001 From: lyc Date: Tue, 19 Nov 2024 17:08:34 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron.vite.config.mjs | 4 +- package.json | 72 +++-- src/renderer/src/api/mode/index.js | 4 +- .../container/adjust-dialog.vue | 34 +-- .../template-study/container/edit-dialog.vue | 2 +- .../template-study/container/result.vue | 44 ++-- src/renderer/src/utils/comm.js | 23 ++ src/renderer/src/utils/mitt.js | 5 + .../container/adjust-dialog.vue | 249 ++++++++++++++++++ .../teachingDesign/container/edit-dialog.vue | 77 ++++++ .../views/teachingDesign/container/left.vue | 10 +- .../views/teachingDesign/container/right.vue | 158 ++++++++++- .../src/views/teachingDesign/index.vue | 3 +- 13 files changed, 592 insertions(+), 93 deletions(-) create mode 100644 src/renderer/src/utils/mitt.js create mode 100644 src/renderer/src/views/teachingDesign/container/adjust-dialog.vue create mode 100644 src/renderer/src/views/teachingDesign/container/edit-dialog.vue diff --git a/electron.vite.config.mjs b/electron.vite.config.mjs index 06f4a44..1daadd5 100644 --- a/electron.vite.config.mjs +++ b/electron.vite.config.mjs @@ -48,10 +48,10 @@ export default defineConfig({ changeOrigin: true, // 改变请求的起源 rewrite: (path) => path.replace(/^\/parth/, '') // 重写路径 }, - '/v1': { + '/api': { target: 'https://ai.ysaix.com:7864', changeOrigin: true, - pathRewrite: { '^/v1': '' } + pathRewrite: { '^/api': '' } } }, }, diff --git a/package.json b/package.json index 69ded97..249f906 100644 --- a/package.json +++ b/package.json @@ -33,14 +33,18 @@ "@electron-toolkit/utils": "^3.0.0", "@electron/remote": "^2.1.2", "@element-plus/icons-vue": "^2.3.1", + "@icon-park/vue-next": "^1.4.2", "@vitejs/plugin-vue-jsx": "^4.0.0", "@vue-office/docx": "^1.6.2", "@vue-office/excel": "^1.7.11", "@vue-office/pdf": "^2.0.2", "@vueuse/core": "^10.11.0", + "animate.css": "^4.1.1", "circular-json": "^0.5.9", + "clipboard": "^2.0.11", "cropperjs": "^1.6.2", "crypto-js": "^4.2.0", + "dexie": "3.0.3", "echarts": "^5.5.1", "electron-dl-manager": "^3.0.0", "electron-log": "^5.1.7", @@ -49,6 +53,9 @@ "element-china-area-data": "^6.1.0", "element-plus": "^2.8.0", "fabric": "^5.3.0", + "file-saver": "^2.0.5", + "hfmath": "^0.0.2", + "html-to-image": "^1.11.11", "im_electron_sdk": "^8.0.5904", "js-cookie": "^3.0.5", "jsencrypt": "^3.3.2", @@ -56,28 +63,13 @@ "less": "^4.2.0", "less-loader": "^7.3.0", "lodash": "^4.17.21", + "mitt": "^3.0.1", + "nanoid": "^5.0.7", "node-addon-api": "^8.1.0", + "number-precision": "^1.6.0", "pdfjs-dist": "4.4.168", "pinia": "^2.1.7", "pinia-plugin-persistedstate": "^3.2.1", - "spark-md5": "^3.0.2", - "vite-plugin-electron": "^0.28.8", - "vue-qr": "^4.0.9", - "vue-router": "^4.4.0", - "whiteboard_lyc": "^0.1.3", - "xgplayer": "^3.0.19", - "xlsx": "^0.18.5", - - "@icon-park/vue-next": "^1.4.2", - "animate.css": "^4.1.1", - "clipboard": "^2.0.11", - "dexie": "3.0.3", - "file-saver": "^2.0.5", - "hfmath": "^0.0.2", - "html-to-image": "^1.11.11", - "mitt": "^3.0.1", - "nanoid": "^5.0.7", - "number-precision": "^1.6.0", "pptxgenjs": "^3.12.0", "pptxtojson": "^1.0.3", "prosemirror-commands": "^1.6.0", @@ -91,33 +83,25 @@ "prosemirror-schema-list": "^1.4.1", "prosemirror-state": "^1.4.3", "prosemirror-view": "^1.33.9", + "spark-md5": "^3.0.2", "svg-arc-to-cubic-bezier": "^3.2.0", "svg-pathdata": "^7.1.0", "tinycolor2": "^1.6.0", "tippy.js": "^6.3.7", + "vite-plugin-electron": "^0.28.8", "vue": "^3.4.34", - "vuedraggable": "^4.1.0" + "vue-qr": "^4.0.9", + "vue-router": "^4.4.0", + "vuedraggable": "^4.1.0", + "whiteboard_lyc": "^0.1.3", + "xgplayer": "^3.0.19", + "xlsx": "^0.18.5" }, "devDependencies": { - "@electron-toolkit/eslint-config": "^1.0.2", - "@rushstack/eslint-patch": "^1.10.3", - "@vitejs/plugin-vue": "^5.0.5", - "@vue/eslint-config-prettier": "^9.0.0", - "axios": "^1.7.2", - "electron": "^31.0.2", - "electron-builder": "^24.13.3", - "electron-vite": "^2.3.0", - "eslint": "^8.57.0", - "eslint-plugin-vue": "^9.26.0", - "prettier": "^3.3.2", - "sass": "^1.77.6", - "vite": "^5.3.1", - "vite-plugin-windicss": "^1.9.3", - "vue": "^3.4.30", - "windicss": "^3.5.6", - "@commitlint/cli": "^18.4.3", "@commitlint/config-conventional": "^18.4.3", + "@electron-toolkit/eslint-config": "^1.0.2", + "@rushstack/eslint-patch": "^1.10.3", "@tsconfig/node18": "^18.2.2", "@types/crypto-js": "^4.2.1", "@types/file-saver": "^2.0.7", @@ -125,11 +109,25 @@ "@types/node": "^18.19.3", "@types/svg-arc-to-cubic-bezier": "^3.2.2", "@types/tinycolor2": "^1.4.6", + "@vitejs/plugin-vue": "^5.0.5", + "@vue/eslint-config-prettier": "^9.0.0", "@vue/eslint-config-typescript": "^12.0.0", "@vue/tsconfig": "^0.5.0", + "axios": "^1.7.2", + "electron": "^31.0.2", + "electron-builder": "^24.13.3", + "electron-vite": "^2.3.0", + "eslint": "^8.57.0", + "eslint-plugin-vue": "^9.26.0", "husky": "^8.0.3", "npm-run-all2": "^6.1.1", + "prettier": "^3.3.2", + "sass": "^1.77.6", "typescript": "~5.3.0", - "vue-tsc": "^1.8.25" + "vite": "^5.3.1", + "vite-plugin-windicss": "^1.9.3", + "vue": "^3.4.30", + "vue-tsc": "^1.8.25", + "windicss": "^3.5.6" } } diff --git a/src/renderer/src/api/mode/index.js b/src/renderer/src/api/mode/index.js index 51448f2..5af6b1a 100644 --- a/src/renderer/src/api/mode/index.js +++ b/src/renderer/src/api/mode/index.js @@ -26,10 +26,10 @@ export function conversation(data) { // 进行课标研读对话 export function completion(data) { return axios({ - url: rootPath + '/v1/api/completion', + url: rootPath + '/api/v1/parse/docs', method: 'post', headers: { - Authorization: 'Bearer ragflow-IwNzMxMTIyOGY0ZTExZWZiOGE2MDI0Mm', + Authorization: 'Bearer ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm', 'Content-Type': 'application/json', Accept: '*/*' }, diff --git a/src/renderer/src/components/template-study/container/adjust-dialog.vue b/src/renderer/src/components/template-study/container/adjust-dialog.vue index 77e2e6c..0258471 100644 --- a/src/renderer/src/components/template-study/container/adjust-dialog.vue +++ b/src/renderer/src/components/template-study/container/adjust-dialog.vue @@ -44,6 +44,7 @@ import { ref, reactive, onMounted } from 'vue' import { conversation, completion } from '@/api/mode/index' import { sessionStore } from '@/utils/store' import { ElMessage } from 'element-plus' +import { dataSetJson } from '@/utils/comm.js' const textarea = ref('') @@ -55,6 +56,10 @@ const props = defineProps({ default: () => { return { name: '11' } } + }, + modeType: { + type: Number, + default: 1 } }) @@ -77,31 +82,22 @@ const send = () =>{ const curNode = reactive({}) const params = reactive( { - "conversation_id": "", - "messages": [ - { - "role": "user", - "content": "" - } - ], - "quote": false, - "stream": false + prompt: '', + dataset_id: '' } ) // 获取会话ID -const getConversation = async (val) => { - const result = await conversation() - params.conversation_id = result.data.data.id +const getConversation = (val) => { + getCompletion(val) } // 大模型对话 const getCompletion = async (val) => { try { - params.messages[0].content = `根据${curNode.edustage}语文课标${props.item.name},${val}` - const res = await completion(params) - console.log('对话结果===》', res) - let answer = res.data.data.answer + params.prompt = `根据${curNode.edustage}${curNode.edusubject}课标${props.item.name},${val}` + const { data } = await completion(params) + let answer = data.answer msgList.value.push({ type: 'robot', msg: answer, @@ -121,7 +117,11 @@ const saveAdjust = (item) =>{ onMounted(() => { let data = sessionStore.get('subject.curNode') Object.assign(curNode, data); - + let text = props.modeType == 1 ? '课标': props.modeType == 2 ? '教材' : '考试' + + let jsonKey = `${text}-${data.edustage}-${data.edusubject}` + params.dataset_id = dataSetJson[jsonKey] + }) diff --git a/src/renderer/src/components/template-study/container/edit-dialog.vue b/src/renderer/src/components/template-study/container/edit-dialog.vue index 852c78b..f8b8172 100644 --- a/src/renderer/src/components/template-study/container/edit-dialog.vue +++ b/src/renderer/src/components/template-study/container/edit-dialog.vue @@ -42,7 +42,7 @@ const props = defineProps({ } }) -watch(() => props.item.oldAnswer, (newVal) => { +watch(() => props.item.answer, (newVal) => { if (newVal) { textarea.value = newVal } diff --git a/src/renderer/src/components/template-study/container/result.vue b/src/renderer/src/components/template-study/container/result.vue index a8fe11d..a685aae 100644 --- a/src/renderer/src/components/template-study/container/result.vue +++ b/src/renderer/src/components/template-study/container/result.vue @@ -55,7 +55,7 @@ - + @@ -68,7 +68,7 @@ import keywordDialog from './keyword-dialog.vue'; import { sessionStore } from '@/utils/store' import useUserStore from '@/store/modules/user' import { conversation, completion, modelList, removeChildTemp } from '@/api/mode/index' - +import { dataSetJson } from '@/utils/comm.js' const userStore = useUserStore() @@ -107,24 +107,14 @@ watch(() => props.tempId, (newVal) => { // 获取会话ID const params = reactive( { - "conversation_id": "", - "messages": [ - { - "role": "user", - "content": "" - } - ], - "quote": false, - "stream": false + prompt: '', + dataset_id: '' } ) const curNode = reactive({}) -const getConversation = async () => { +const getConversation = () => { + - const { user: { userId } } = userStore - const result = await conversation({ user_id: String(userId) }) - console.log('result', result) - params.conversation_id = result.data.data.id getCompletion() } // 大模型对话 @@ -132,10 +122,9 @@ const getCompletion = async () => { for (let item of childTempList.value) { try { item.loading = true - params.messages[0].content = `根据${curNode.edustage}语文课标,提炼出${item.name}` - const res = await completion(params) - console.log('对话结果===》', res) - let answer = res.data.data.answer + params.prompt = `根据${curNode.edustage}语文课标,提炼出${item.name}` + const { data } = await completion(params) + let answer = data.answer item.oldAnswer = answer item.answer = getResult(answer); @@ -150,11 +139,11 @@ const getCompletion = async () => { const againResult = async (index, item) => { try { childTempList.value[index].loading = true - params.messages[0].content = `根据${curNode.edustage}语文课标,提炼出${item.name}` - const res = await completion(params) - let answer = res.data.data.answer - item.oldAnswer = answer - item.answer = getResult(answer); + params.prompt = `根据${curNode.edustage}语文课标,提炼出${item.name}` + const { data } = await completion(params) + let answer = data.answer + childTempList.value[index].oldAnswer = answer + childTempList.value[index].answer = getResult(answer); } finally { childTempList.value[index].loading = false } @@ -210,12 +199,17 @@ const editKeyWord = (item) =>{ const removeItem = async(item) =>{ const { msg } = await removeChildTemp(item.id) ElMessage.success(msg) + getChildTemplate() } onMounted(() => { let data = sessionStore.get('subject.curNode') Object.assign(curNode, data); + let text = props.modeType == 1 ? '课标': props.modeType == 2 ? '教材' : '考试' + let jsonKey = `${text}-${data.edustage}-${data.edusubject}` + params.dataset_id = dataSetJson[jsonKey] + }) defineExpose({ diff --git a/src/renderer/src/utils/comm.js b/src/renderer/src/utils/comm.js index a0d457f..1cbc5db 100644 --- a/src/renderer/src/utils/comm.js +++ b/src/renderer/src/utils/comm.js @@ -351,3 +351,26 @@ export function throttle(func, wait) { } }; } + +/** + * + * 大模型对话dataset_id + */ +export const dataSetJson = { + "考试-高中-地理": "e790f68aa19811efbe0b0242ac140006", + "考试-高中-数学": "9cc3084ea19811ef97f00242ac140006", + "考试-高中-物理": "b19749c4a19811ef89a80242ac140006", + "考试-高中-化学": "bb7dcd40a19811efb6090242ac140006", + "考试-高中-生物": "c31f8df8a19811efbd6d0242ac140006", + "考试-高中-英语": "a84527afa19811ef8bf00242ac140006", + "考试-高中-语文": "928e6da0a19811efb6e50242ac140006", + "考试-高中-历史": "df2c09e6a19811ef84d00242ac140006", + "考试-高中-政治": "ce43ea58a19811efb41c0242ac140006", + "课标-高中-语文": "cee3062a9fcf11efa6910242ac140006", + "课标-高中-生物": "fb5d01d59fd011ef9bb90242ac140006", + "课标-高中-历史": "f2f6c1fb9fd011ef98740242ac140006", + "课标-高中-英语": "e889fcac9fd011efb22a0242ac140006", + "课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006", + "课标-高中-地理": "270516829fd111efb13c0242ac140006", + "鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm" +} \ No newline at end of file diff --git a/src/renderer/src/utils/mitt.js b/src/renderer/src/utils/mitt.js new file mode 100644 index 0000000..3a7cf85 --- /dev/null +++ b/src/renderer/src/utils/mitt.js @@ -0,0 +1,5 @@ +import mitt from 'mitt' +// 创建mitt实例 +const emitter = mitt() +// 导出 +export default emitter diff --git a/src/renderer/src/views/teachingDesign/container/adjust-dialog.vue b/src/renderer/src/views/teachingDesign/container/adjust-dialog.vue new file mode 100644 index 0000000..fd887a2 --- /dev/null +++ b/src/renderer/src/views/teachingDesign/container/adjust-dialog.vue @@ -0,0 +1,249 @@ + + + + + \ No newline at end of file diff --git a/src/renderer/src/views/teachingDesign/container/edit-dialog.vue b/src/renderer/src/views/teachingDesign/container/edit-dialog.vue new file mode 100644 index 0000000..de61247 --- /dev/null +++ b/src/renderer/src/views/teachingDesign/container/edit-dialog.vue @@ -0,0 +1,77 @@ + + + + + \ No newline at end of file diff --git a/src/renderer/src/views/teachingDesign/container/left.vue b/src/renderer/src/views/teachingDesign/container/left.vue index ea94fdf..f994a55 100644 --- a/src/renderer/src/views/teachingDesign/container/left.vue +++ b/src/renderer/src/views/teachingDesign/container/left.vue @@ -5,7 +5,7 @@
{{ item.name }} - 选择模式 + 选择模式
@@ -26,6 +26,7 @@ @@ -36,6 +136,7 @@ .container-right { flex-direction: column; height: 100%; + .right-header { height: 45px; background: #fff; @@ -49,14 +150,57 @@ flex: 1; background: #F6F6F6; padding: 15px; - .con-item{ + flex-direction: column; + overflow-y: scroll; + + .con-item { + width: 100%; flex-direction: column; - .item-top{ + margin-bottom: 20px; + + .item-top { justify-content: space-between; align-items: center; + margin-bottom: 5px; } - .item-bom{ + + .item-bom { background: #fff; + padding: 15px; + border-radius: 5px; + + .item-prompt { + text-align: left; + margin-bottom: 5px; + font-size: 13px; + } + + .item-answer { + padding: 10px; + background: #F2F2F2; + border-radius: 5px; + + .answer-text { + background: #fff; + border-radius: 5px; + margin-bottom: 10px; + text-align: left; + font-size: 13px; + padding: 8px; + } + + .item-btn { + justify-content: flex-end; + + .iconfont { + margin-right: 3px; + } + + .icon-ai1 { + font-size: 18px; + } + } + } } } } diff --git a/src/renderer/src/views/teachingDesign/index.vue b/src/renderer/src/views/teachingDesign/index.vue index ebf7680..69f5753 100644 --- a/src/renderer/src/views/teachingDesign/index.vue +++ b/src/renderer/src/views/teachingDesign/index.vue @@ -1,9 +1,11 @@ @@ -67,7 +67,7 @@ import AdjustDialog from './adjust-dialog.vue' import keywordDialog from './keyword-dialog.vue'; import { sessionStore } from '@/utils/store' import useUserStore from '@/store/modules/user' -import { conversation, completion, modelList, removeChildTemp } from '@/api/mode/index' +import { tempSave, completion, modelList, removeChildTemp, tempResult } from '@/api/mode/index' import { dataSetJson } from '@/utils/comm.js' const userStore = useUserStore() @@ -90,16 +90,35 @@ const getChildTemplate = () => { tempLoading.value = true modelList({ model: props.modeType, type: 2, parentId: props.tempId }).then(res => { childTempList.value = res.rows - + getTempResult() }).finally(() => { tempLoading.value = false }) } +// 查询模板结果 +const getTempResult = () =>{ + tempResult({mainModelId: props.tempId}).then(res =>{ + console.log(res,1000) + let rows = res.rows + childTempList.value.forEach(item =>{ + rows.forEach(el =>{ + if(item.id == el.modelId){ + item.answer = el.content + item.reultId = el.id + } + }) + }) + }) +} + + + const isEdit = ref(false) watch(() => props.tempId, (newVal) => { if (newVal) { // isEdit.value = true getChildTemplate() + } }) @@ -122,24 +141,38 @@ const getCompletion = async () => { for (let item of childTempList.value) { try { item.loading = true - params.prompt = `根据${curNode.edustage}语文课标,提炼出${item.name}` + params.prompt = `根据${curNode.edustage}${curNode.edusubject}课标,提炼出${item.name}` const { data } = await completion(params) let answer = data.answer item.oldAnswer = answer item.answer = getResult(answer); - + onSaveTemp(item) } finally { item.loading = false } } } +// 保存模板 +const onSaveTemp = (item) =>{ + const data = { + mainModelId: props.tempId, + modelId: item.id, + examDocld: '', + content: item.oldAnswer + } + tempSave(data).then(res =>{ + console.log(res) + }) +} + + // 重新研读 const againResult = async (index, item) => { try { childTempList.value[index].loading = true - params.prompt = `根据${curNode.edustage}语文课标,提炼出${item.name}` + params.prompt = `根据${curNode.edustage}${curNode.edusubject}课标,提炼出${item.name}` const { data } = await completion(params) let answer = data.answer childTempList.value[index].oldAnswer = answer @@ -170,9 +203,10 @@ const onEdit = (index, item) => { // 保存编辑 const saveEdit = (data) => { - childTempList.value[curIndex.value].oldAnswer = data - let answer = getResult(data); - childTempList.value[curIndex.value].answer = answer + // childTempList.value[curIndex.value].oldAnswer = data + // let answer = getResult(data); + // childTempList.value[curIndex.value].answer = answer + getChildTemplate() } const isAdjust = ref(false) @@ -191,6 +225,8 @@ const saveAdjust = (item) => { const keywordItem = reactive({}) const isEditKeyWord = ref(false) const editKeyWord = (item) =>{ + console.log(item) + isEditKeyWord.value = true Object.assign(keywordItem, item) } @@ -210,6 +246,7 @@ onMounted(() => { let jsonKey = `${text}-${data.edustage}-${data.edusubject}` params.dataset_id = dataSetJson[jsonKey] + }) defineExpose({ From 0d0327f956dba33063e8a0fa9304637ca0e91993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com> Date: Wed, 20 Nov 2024 16:20:09 +0800 Subject: [PATCH 7/8] 1 --- src/renderer/src/components/tinymce/tinymce.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/components/tinymce/tinymce.vue b/src/renderer/src/components/tinymce/tinymce.vue index 9db1026..eb55e08 100644 --- a/src/renderer/src/components/tinymce/tinymce.vue +++ b/src/renderer/src/components/tinymce/tinymce.vue @@ -113,13 +113,14 @@ const loading = ref(false); const tinymceId = ref( "vue-tinymce-" + +new Date() + ((Math.random() * 1000).toFixed(0) + "") ); + //定义一个对象 init初始化 const init = reactive({ selector: "#" + tinymceId.value, //富文本编辑器的id, - skin_url: "/tinymce/skins/ui/oxide", // skin路径,具体路径看自己的项目 - content_css: "/tinymce/skins/content/default/content.css", //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入 - language_url: "/tinymce/langs/zh_CN.js", // 语言包的路径,具体路径看自己的项目 + skin_url: "../../../public/tinymce/skins/ui/oxide", // skin路径,具体路径看自己的项目 + content_css: "../../../public/tinymce/skins/content/default/content.css", //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入 + language_url: "../../../public/tinymce/langs/zh_CN.js", // 语言包的路径,具体路径看自己的项目 language: "zh_CN", editable_root: props.editable_root, From 96f25ab9874eab975ac052b9d4efad176cd66358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com> Date: Wed, 20 Nov 2024 16:51:51 +0800 Subject: [PATCH 8/8] 1 --- src/renderer/src/components/tinymce/tinymce.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/components/tinymce/tinymce.vue b/src/renderer/src/components/tinymce/tinymce.vue index eb55e08..30b84ca 100644 --- a/src/renderer/src/components/tinymce/tinymce.vue +++ b/src/renderer/src/components/tinymce/tinymce.vue @@ -45,6 +45,7 @@ import "tinymce/plugins/fullscreen"; //全屏 import "tinymce/plugins/anchor"; //锚点 import { ref, reactive, defineProps, defineEmits, nextTick, onMounted, computed, watch } from 'vue' +import { getStaticUrl } from '@/utils/tool' //import { listUploadfile, getUploadFile, delUploadFile, addUploadFile, saveUploadFile } from "@/api/comm/uploadfile"; const emits = defineEmits(["update:modelValue", "setHtml"]); @@ -118,9 +119,13 @@ const tinymceId = ref( //定义一个对象 init初始化 const init = reactive({ selector: "#" + tinymceId.value, //富文本编辑器的id, - skin_url: "../../../public/tinymce/skins/ui/oxide", // skin路径,具体路径看自己的项目 - content_css: "../../../public/tinymce/skins/content/default/content.css", //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入 - language_url: "../../../public/tinymce/langs/zh_CN.js", // 语言包的路径,具体路径看自己的项目 + skin_url: getStaticUrl('/tinymce/skins/ui/oxide'), + content_css: getStaticUrl('tinymce/skins/content/default/content.css'), //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入 + language_url: getStaticUrl('/tinymce/langs/zh_CN.js'), // 语言包的路径,具体路径看自己的项目 + + //skin_url: "/tinymce/skins/ui/oxide", // skin路径,具体路径看自己的项目 + //content_css: "/tinymce/skins/content/default/content.css", //以css文件方式自定义可编辑区域的css样式,css文件需自己创建并引入 + //language_url: "/tinymce/langs/zh_CN.js", // 语言包的路径,具体路径看自己的项目 language: "zh_CN", editable_root: props.editable_root,