From f168e04405bea0fc347d94465202eb9260416ce4 Mon Sep 17 00:00:00 2001 From: lyc Date: Sat, 16 Nov 2024 23:37:11 +0800 Subject: [PATCH 1/4] =?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 3/4] =?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({