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 @@ + + + + + + 反面提示词 + + + + + + 可选提示词 + + 风格特点 + + + + + + 主体对象 + + + + + + 场景 + + + + + + 添加 + 清空 + + + + + + + + + {{ 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/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..f39fc99 100644 --- a/src/renderer/src/views/model/index.vue +++ b/src/renderer/src/views/model/index.vue @@ -13,6 +13,7 @@ 打开PPTist 考试分析 测试 + 文生图片 @@ -54,6 +55,8 @@ import msgUtils from '@/plugins/modal' // 消息工具 import { createWindow, sessionStore } from '@/utils/tool' // 相关工具 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 +159,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) }
{{ resultItem }}
{{ item }}