diff --git a/src/renderer/src/api/aiGeneratedImage/index.js b/src/renderer/src/api/aiGeneratedImage/index.js new file mode 100644 index 0000000..9939c5d --- /dev/null +++ b/src/renderer/src/api/aiGeneratedImage/index.js @@ -0,0 +1,81 @@ +import axios from 'axios' +import request from '@/utils/request' +import { getToken } from "@/utils/auth"; + +// 文生图片 +export function convertTextToPicture(data) { + return axios({ + url: 'https://ai.ysaix.com:7853/prompt', + method: 'post', + headers: { + 'Content-Type': 'application/json', + 'Accept': '*/*' + }, + data: data + }) +} +// 获取任务列表 +export function getQueue() { + return axios({ + url: `https://ai.ysaix.com:7853/queue`, + method: 'get', + }) +} + +// 获取生图任务id +export function getPromptId(id) { + return axios({ + url: `https://ai.ysaix.com:7853/history/${id}`, + method: 'get', + }) +} + +// 获取生成图片路径 +export function getPicture(data) { + return axios({ + url: 'https://ai.ysaix.com:7853/view', + method: 'get', + params: data + }) +} + +// 大模型对话生成prompt模板 +export function chattoprompt(dataset_id,prompt) { + return axios({ + url: '/api/v1/parse/docs', + method: 'post', + headers: { + 'Authorization': 'Bearer ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm', + }, + data: { + 'dataset_id': dataset_id, + 'prompt': prompt + } + }) +} + +// prompt敏感词校验 +export function textSensitiveWord(data) { + return request({ + url: '/verify/text', + method: 'post', + data: { + 'text' : data + } + }) + } + + // 图片上传资源库 + export function uploadPicture(data) { + return axios({ + url: '/dev-api/smarttalk/file/upload', + method: 'post', + headers: { + 'Accept': '*/*', + 'Content-Type': 'multipart/form-data', + 'Authorization': "Bearer " + getToken() + }, + data: data + }) + } + \ No newline at end of file diff --git a/src/renderer/src/api/education/entpCourseWork.js b/src/renderer/src/api/education/entpCourseWork.js index 04582ba..25f61e2 100644 --- a/src/renderer/src/api/education/entpCourseWork.js +++ b/src/renderer/src/api/education/entpCourseWork.js @@ -9,6 +9,16 @@ export function listEntpcoursework(query) { }) } + +// 查询entpcoursework列表 +export function listEntpcourseworkLocal(query) { + return request({ + url: '/education/entpcoursework/local/list', + method: 'get', + params: query + }) +} + // 查询entpcoursework详细 export function getEntpcoursework(id) { return request({ diff --git a/src/renderer/src/components/ai-kolors/index.vue b/src/renderer/src/components/ai-kolors/index.vue new file mode 100644 index 0000000..0d70f0f --- /dev/null +++ b/src/renderer/src/components/ai-kolors/index.vue @@ -0,0 +1,627 @@ + + + + + + 反面提示词 + + + + + + 可选提示词 + + 风格特点 + + + + + + 主体对象 + + + + + + 场景 + + + + + + 添加 + 清空 + + + + + + + + + {{ ratio.label }} + + + + + + + + + {{ ratio.label }} + + + + + + + + 1 + + + 2 + + + 3 + + + 4 + + + + + + + + + + + + + + + + + + {{ resultItem }} + + + + + + + + + {{ buttonStates[resultIndex][index].text + }} + + + + + + + + + + + + + + + + + + + + {{ item }} + + + + + + + + + {{ !pictureLoading ? "生成图片" : "请等待" }} + + + + + + + + + + \ No newline at end of file diff --git a/src/renderer/src/components/set-homework/index.vue b/src/renderer/src/components/set-homework/index.vue index b890ff3..8f2db6b 100644 --- a/src/renderer/src/components/set-homework/index.vue +++ b/src/renderer/src/components/set-homework/index.vue @@ -41,7 +41,7 @@ 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 35de365..5cf6251 100644 --- a/src/renderer/src/components/template-study/container/adjust-dialog.vue +++ b/src/renderer/src/components/template-study/container/adjust-dialog.vue @@ -1,5 +1,5 @@ - + {{ item.name }} @@ -105,11 +105,9 @@ const getCompletion = async (val) => { } const saveAdjust = (item) =>{ - isDialog.value = false ElMessage.success('操作成功') - emitter.on('saveAdjust', item.msg) - + emitter.emit('onSaveAdjust', item.msg) } const modeType = ref('课标') diff --git a/src/renderer/src/components/template-study/container/right.vue b/src/renderer/src/components/template-study/container/right.vue index 4f4f74e..98a5b8d 100644 --- a/src/renderer/src/components/template-study/container/right.vue +++ b/src/renderer/src/components/template-study/container/right.vue @@ -51,7 +51,9 @@ - + + + @@ -68,7 +70,6 @@ - @@ -89,6 +90,7 @@ import { sessionStore } from '@/utils/store' import keywordDialog from './keyword-dialog.vue'; import AdjustDialog from './adjust-dialog.vue' import EditDialog from './edit-dialog.vue' +import TypingEffect from '@/components/typing-effect/index.vue' import emitter from '@/utils/mitt'; import { dataSetJson } from '@/utils/comm.js' @@ -109,7 +111,6 @@ const onAdd = () => { isAdd.value = true Object.assign(editItem, curTemplate) isWordDialog.value = true - } const editKeyWord = (item, val) => { @@ -263,12 +264,14 @@ const params = reactive( const againResult = async (index, item) => { try { childTempList.value[index].loading = true + item.aiShow = true + childTempList.value[index].oldAnswer = '' params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析` const { data } = await completion(params) let answer = data.answer childTempList.value[index].oldAnswer = answer childTempList.value[index].answer = getResult(answer); - onEditSave(item) + // onEditSave(item) } finally { childTempList.value[index].loading = false } @@ -278,18 +281,29 @@ const getCompletion = async () => { for (let item of childTempList.value) { try { item.loading = true + item.aiShow = true params.prompt = `按照${item.name}的要求,针对${curNode.edustage}${curNode.edusubject}${modeType.value} 对${curNode.itemtitle}进行教学分析` const { data } = await completion(params) let answer = data.answer item.oldAnswer = answer item.answer = getResult(answer); - onSaveTemp(item) + } finally { item.loading = false } } } +// 替换分析结果 +emitter.on('onSaveAdjust', (item) => { + childTempList.value[curIndex.value].oldAnswer = item + let answer = getResult(item); + childTempList.value[curIndex.value].oldAnswer = item + childTempList.value[curIndex.value].answer = answer + onEditSave(childTempList.value[curIndex.value]) +}) + + // 保存 重新研读后的结果 const onEditSave = async (item) =>{ const { res } = await editTempResult({id: item.resultId, content: item.oldAnswer}) @@ -297,30 +311,18 @@ const onEditSave = async (item) =>{ getChildTemplate() } - - // 保存模板 const onSaveTemp = (item) => { + if(item.oldAnswer == '') return const data = { mainModelId: curTemplate.id, modelId: item.id, examDocld: '', content: item.oldAnswer } - tempSave(data).then(res => { - console.log(res) - }) + tempSave(data).then(res => {}) } - - -// 替换分析结果 -emitter.on('saveAdjust', (item) => { - childTempList.value[curIndex.value].oldAnswer = item - let answer = getResult(item); - childTempList.value[curIndex.value].answer = answer -}) - // 分析获取课标对话结果 let getResult = (text) => { text = text.replace(/^\n\n(.*?)\n\n$/s, '$1'); @@ -351,8 +353,9 @@ onMounted(() => { // 解绑 onUnmounted(() => { + emitter.off('onGetMain'); emitter.off('onGetChild'); - emitter.off('saveAdjust'); + emitter.off('onSaveAdjust'); }) @@ -422,6 +425,7 @@ onUnmounted(() => { .item-answer { flex-direction: column; padding-top: 5px; + width: 100%; :deep(.text-tit) { font-weight: bold; diff --git a/src/renderer/src/components/tinymce/tinymce.vue b/src/renderer/src/components/tinymce/tinymce.vue index 2e4a7e9..f30d52b 100644 --- a/src/renderer/src/components/tinymce/tinymce.vue +++ b/src/renderer/src/components/tinymce/tinymce.vue @@ -284,23 +284,23 @@ const init = reactive({ formData.append("filetype", "image"); formData.append("suffix", "image"); formData.append("status", '1'); - if(userStore.deptId && userStore.deptId != null){ + if(userStore.deptId != null){ formData.append("entpid", userStore.deptId); } - if(userStore.userId && userStore.userId != null){ + if(userStore.userId != null){ formData.append("userid", userStore.userId); } - if(userStore.edudegree && userStore.edudegree != null){ + if(userStore.edudegree && userStore.edudegree != ''){ let edudegree = userStore.edudegree.toString(); if(edudegree != '' && edudegree.indexOf('年级') == -1){ edudegree += '年级'; } formData.append("edudegree", edudegree); } - if(userStore.edusubject && userStore.edusubject != null){ + if(userStore.edusubject && userStore.edusubject != ''){ formData.append("edusubject", userStore.edusubject); } - if(userStore.edustage && userStore.edustage != null){ + if(userStore.edustage && userStore.edustage != ''){ formData.append("edustage", userStore.edustage); } if(props.upFileParams?.hasOwnProperty('lessionId')){ diff --git a/src/renderer/src/components/typing-effect/index.vue b/src/renderer/src/components/typing-effect/index.vue new file mode 100644 index 0000000..0817b05 --- /dev/null +++ b/src/renderer/src/components/typing-effect/index.vue @@ -0,0 +1,67 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/renderer/src/components/window-tools/index.vue b/src/renderer/src/components/window-tools/index.vue index da66f80..2e40c52 100644 --- a/src/renderer/src/components/window-tools/index.vue +++ b/src/renderer/src/components/window-tools/index.vue @@ -8,9 +8,10 @@
{{ resultItem }}
{{ item }}