diff --git a/src/api/ai/image/index.ts b/src/api/ai/image/index.ts index 4fd35abe..cb5a5afd 100644 --- a/src/api/ai/image/index.ts +++ b/src/api/ai/image/index.ts @@ -1,51 +1,28 @@ import request from '@/config/axios' // AI API 密钥 VO -// TODO @fan:要不前端不弄太多 VO,就用这个 ImageDetailVO?! -export interface ImageDetailVO { +export interface ImageRespVO { id: number // 编号 - prompt: string // 提示词 - status: number // 状态 - errorMessage: string // 错误信息 - type: string // 模型下分不同的类型(清晰、真实...) - taskId: number // dr 任务id - picUrl: string // 任务地址 - originalPicUrl: string // 绘制图片地址 platform: string // 平台 model: string // 模型 - style: string // 图像生成的风格 - size: string // 图片尺寸 + prompt: string // 提示词 + width: number // 图片宽度 + height: number // 图片高度 + status: number // 状态 + publicStatus: boolean // 公开状态 + picUrl: string // 任务地址 + errorMessage: string // 错误信息 + options: object // 配置 Map + taskId: number // 任务编号 buttons: ImageMjButtonsVO[] // mj 操作按钮 createTime: string // 创建时间 - updateTime: string // 更新事件 } -export interface ImageMjButtonsVO { - customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 - emoji: string // 图标 emoji - label: string // Make Variations 文本 - style: number // 样式: 2(Primary)、3(Green) -} - -export interface ImageMjActionVO { - id: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 - customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 -} - - export interface ImagePageReqVO { pageNo: number // 分页编号 pageSize: number // 分页大小 } -export interface ImageDallReqVO { - prompt: string // 提示词 - model: string // 模型 - style: string // 图像生成的风格 - width: string // 图片宽度 - height: string // 图片高度 -} - export interface ImageDrawReqVO { platform: string // 平台 prompt: string // 提示词 @@ -65,34 +42,68 @@ export interface ImageMidjourneyImagineReqVO { version: string // 版本 } -// TODO 芋艿:review 下整体注释、方法名 +export interface ImageMjActionVO { + id: number // 图片编号 + customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 +} + +export interface ImageMjButtonsVO { + customId: string // MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 动作标识 + emoji: string // 图标 emoji + label: string // Make Variations 文本 + style: number // 样式: 2(Primary)、3(Green) +} + // AI API 密钥 API export const ImageApi = { - // 获取 image 列表 - getImageList: async (params: ImagePageReqVO) => { + // 获取我的图片列表 + getImagePageMy: async (params: ImagePageReqVO) => { return await request.get({ url: `/ai/image/my-page`, params }) }, - // 获取 image 详细信息 - getImageDetail: async (id: number) => { - return await request.get({ url: `/ai/image/get-my?id=${id}`}) + // 获取我的图片 + getImageMy: async (id: number) => { + return await request.get({ url: `/ai/image/get-my?id=${id}` }) }, // 生成图片 - drawImage: async (data: ImageDrawReqVO)=> { + drawImage: async (data: ImageDrawReqVO) => { return await request.post({ url: `/ai/image/draw`, data }) }, - // 删除 - deleteImage: async (id: number)=> { - return await request.delete({ url: `/ai/image/delete-my?id=${id}`}) + // 删除我的图片 + deleteImageMy: async (id: number) => { + return await request.delete({ url: `/ai/image/delete-my?id=${id}` }) }, - // ------------ midjourney + // ================ midjourney 专属 ================ - // midjourney - imagine - midjourneyImagine: async (data: ImageMidjourneyImagineReqVO)=> { + // 【Midjourney】生成图片 + midjourneyImagine: async (data: ImageMidjourneyImagineReqVO) => { return await request.post({ url: `/ai/image/midjourney/imagine`, data }) }, - // midjourney - action - midjourneyAction: async (params: ImageMjActionVO)=> { - return await request.get({ url: `/ai/image/midjourney/action`, params }) + // 【Midjourney】Action 操作(二次生成图片) + midjourneyAction: async (data: ImageMjActionVO) => { + return await request.post({ url: `/ai/image/midjourney/action`, data }) }, + + // ================ 绘图管理 ================ + + // 查询绘画分页 + getImagePage: async (params: any) => { + return await request.get({ url: `/ai/image/page`, params }) + }, + + // 更新绘画发布状态 + updateImagePublicStatus: async (id: number, publicStatus: boolean) => { + return await request.put({ + url: '/ai/image/update-public-status', + data: { + id, + publicStatus + } + }) + }, + + // 删除绘画 + deleteImage: async (id: number) => { + return await request.delete({ url: `/ai/image/delete?id=` + id }) + } } diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 9400208a..1b6b9b3f 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -219,5 +219,6 @@ export enum DICT_TYPE { ERP_STOCK_RECORD_BIZ_TYPE = 'erp_stock_record_biz_type', // 库存明细的业务类型 // ========== AI - 人工智能模块 ========== - AI_PLATFORM = 'ai_platform' // AI 平台 + AI_PLATFORM = 'ai_platform', // AI 平台 + AI_IMAGE_STATUS = 'ai_image_status', // AI 图片状态 } diff --git a/src/views/ai/chat/manager/index.vue b/src/views/ai/chat/manager/index.vue index 30dc2dfd..ca2d0924 100644 --- a/src/views/ai/chat/manager/index.vue +++ b/src/views/ai/chat/manager/index.vue @@ -16,5 +16,5 @@ import ChatConversationList from './ChatConversationList.vue' import ChatMessageList from './ChatMessageList.vue' /** AI 聊天对话 列表 */ -defineOptions({ name: 'ChatConversation' }) +defineOptions({ name: 'AiChatManager' }) diff --git a/src/views/ai/image/ImageDetailDrawer.vue b/src/views/ai/image/ImageDetailDrawer.vue index e26a719a..7c74ef35 100644 --- a/src/views/ai/image/ImageDetailDrawer.vue +++ b/src/views/ai/image/ImageDetailDrawer.vue @@ -60,11 +60,11 @@ diff --git a/src/views/ai/image/midjourney/index.vue b/src/views/ai/image/midjourney/index.vue index b3cc1cb7..7f288747 100644 --- a/src/views/ai/image/midjourney/index.vue +++ b/src/views/ai/image/midjourney/index.vue @@ -170,7 +170,6 @@ const imageSizeList = ref([ ]) // size selectImageSize.value = imageSizeList.value[0] - // version let versionList = ref([]) // version 列表 const midjourneyVersionList = ref([ @@ -204,9 +203,6 @@ const nijiVersionList = ref([ const selectVersion = ref('6.0') // 选中的 version versionList.value = midjourneyVersionList.value // 默认选择 midjourney -// 定义 Props -const props = defineProps({}) - /** 热词 - click */ const handlerHotWordClick = async (hotWord: string) => { // 取消