diff --git a/src/renderer/src/AixPPTist/src/api/index.ts b/src/renderer/src/AixPPTist/src/api/index.ts index 236f171..d7ff6ad 100644 --- a/src/renderer/src/AixPPTist/src/api/index.ts +++ b/src/renderer/src/AixPPTist/src/api/index.ts @@ -6,6 +6,7 @@ import { toRaw } from 'vue' import msgUtils from '@/plugins/modal' // 消息工具 import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api +import * as API_smarttalk from '@/api/file' // 相关api import * as useStore from '../store' // pptist-状态管理 import { sessionStore } from '@/utils/store' // electron-store 状态管理 import useUserStore from '@/store/modules/user' // 外部-用户信息 @@ -174,6 +175,14 @@ export class PPTApi { } else msgUtils.msgError(res.msg || '删除失败');resolve(false) }) } + + // 更新-备课资源 标题 + static updateSmarttalk(data: object): Promise { + return API_smarttalk.updateSmarttalk(data).then(res => { + if (res.code === 200) return true + else msgUtils.msgError(res.msg || '更新失败');return false + }) + } } export default PPTApi \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/api/watcher.ts b/src/renderer/src/AixPPTist/src/api/watcher.ts index b5648ea..f1f21ba 100644 --- a/src/renderer/src/AixPPTist/src/api/watcher.ts +++ b/src/renderer/src/AixPPTist/src/api/watcher.ts @@ -7,7 +7,8 @@ import { PPTApi } from './index' import * as store from '../store' import { sessionStore } from '@/utils/store' // electron-store 状态管理 const slidesStore = store.useSlidesStore() -const resource = sessionStore.get('curr.resource') +const resource = sessionStore.get('curr.resource') // apt 资源 +const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源 /** * @description 监听器 */ @@ -28,4 +29,11 @@ const updatePPT = async (data) => { data.id = resource.id await PPTApi.updateSlide(data) // 更新ppt内容 sessionStore.set('curr.resource.title', data.title) + // 更新smarttalk内容 + if (!!smarttalk && !!data.title) { + const {id, fileFlag} = smarttalk + const params = { id, fileShowName: `${data.title}.${fileFlag}` } + await PPTApi.updateSmarttalk(params) // 更新ppt内容 + sessionStore.set('curr.smarttalk.fileShowName', params.fileShowName) + } } \ No newline at end of file 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/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 @@ + + + + + \ No newline at end of file diff --git a/src/renderer/src/components/file-image/index.vue b/src/renderer/src/components/file-image/index.vue index 092c238..3c6bd18 100644 --- a/src/renderer/src/components/file-image/index.vue +++ b/src/renderer/src/components/file-image/index.vue @@ -34,7 +34,8 @@ const getFileTypeIcon = () => { gif: 'icon-gif', txt: 'icon-txt', rar: 'icon-rar', - apt: 'icon-A' + apt: 'icon-A', + aptist: 'icon-A', } if (iconObj[name]) { return '#' + iconObj[name] diff --git a/src/renderer/src/router/index.js b/src/renderer/src/router/index.js index 75b3c48..2e6a4fe 100644 --- a/src/renderer/src/router/index.js +++ b/src/renderer/src/router/index.js @@ -85,6 +85,12 @@ export const constantRoutes = [ name: 'questionUpload', meta: { title: '习题上传' } }, + { + path: 'aiKolors', + component: () => import('@/components/ai-kolors/index.vue'), + name: 'aiKolors', + meta: { title: '文生图片' } + }, ] }, diff --git a/src/renderer/src/utils/comm.js b/src/renderer/src/utils/comm.js index 5c26eaf..fc3b89e 100644 --- a/src/renderer/src/utils/comm.js +++ b/src/renderer/src/utils/comm.js @@ -395,5 +395,6 @@ export const dataSetJson = { "课标-高中-英语": "e889fcac9fd011efb22a0242ac140006", "课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006", "课标-高中-地理": "270516829fd111efb13c0242ac140006", + "课标-高中-政治": "a7df2b01aafd11ef8bb40242ac140002", "鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm" } \ No newline at end of file diff --git a/src/renderer/src/views/model/index.vue b/src/renderer/src/views/model/index.vue index 72ed4a8..a8dfa14 100644 --- a/src/renderer/src/views/model/index.vue +++ b/src/renderer/src/views/model/index.vue @@ -13,6 +13,7 @@ 打开PPTist 考试分析 测试 + 文生图片 @@ -52,8 +53,11 @@ import { Plus, Refresh, Upload, Files, UploadFilled } from '@element-plus/icons- import useUserStore from '@/store/modules/user' // 用户信息 import msgUtils from '@/plugins/modal' // 消息工具 import { createWindow, sessionStore } from '@/utils/tool' // 相关工具 +import * as API_smarttalk from '@/api/file' // 文件相关api import * as API_entpcourse from '@/api/education/entpcourse' // 相关api import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api +import { dataSetJson } from '@/utils/comm' // 数据集id文生图 +import { sessionStore } from '@/utils/store' // 学科名字文生图 // 组件引入 import ChooseTextbook from '@/components/choose-textbook/index.vue' import { menusEvent } from '@/plugins/vue3-menus' // 右键菜单 @@ -156,6 +160,21 @@ const onchange = (path) => { if (path == '/model/newClassTaskAssign') { // 作业管理 router.push({ path, query: { courseObj: JSON.stringify(courseObj) } }) + } else if (path == '/model/aiKolors') { + // ai生图 + let subjectdata = sessionStore.get('subject.curNode') + let datasubject = `课标-${subjectdata.edustage}-${subjectdata.edusubject}` + console.log(subjectdata) + router.push({ + path, + query: { + datasetId: dataSetJson[datasubject], + coursetitle: courseObj.coursetitle, + levelFirstId: subjectdata.parentid, + levelSecondId: subjectdata.id, + textbookId: subjectdata.rootid, + } + }); } else { router.push(path) } @@ -178,6 +197,19 @@ const getResourceList = async () => { // 统一HTTP处理 const HTTP_SERVER_API = (type, params = {}) => { switch (type) { + case 'addSmarttalk': { // 获取课程 + const def = { + fileId: '', // 文件id - Entpcoursefile 对应id + fileFlag: 'aptist', + fileShowName: courseObj.coursetitle + '.aptist', + textbookId: courseObj.textbookId, + levelFirstId: courseObj.levelFirstId, + levelSecondId: courseObj.levelSecondId, + fileSource: '个人', + fileRoot: '备课' + } + return API_smarttalk.creatAPT({...def, ...params}) + } case 'addEntpcourse': { // 添加课程 const node = courseObj.node || {} if (!node) return msgUtils.msgWarning('请选择章节?') @@ -260,6 +292,8 @@ const handleAll = async(type, row) =>{ } // 生成ppt课件-子级(slide) await HTTP_SERVER_API('addEntpcoursefile', params) + // 生成备课资源-Smarttalk + await HTTP_SERVER_API('addSmarttalk',{fileId: id}) // 刷新资源列表 await getResourceList() } else { diff --git a/src/renderer/src/views/prepare/container/class-start.vue b/src/renderer/src/views/prepare/container/class-start.vue index 7913a5c..3829064 100644 --- a/src/renderer/src/views/prepare/container/class-start.vue +++ b/src/renderer/src/views/prepare/container/class-start.vue @@ -59,14 +59,16 @@ @@ -81,7 +83,7 @@