zn-admin-vue3-wcs/src/api/ai/image/index.ts
2024-06-03 09:41:56 +08:00

78 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import request from '@/config/axios'
// AI API 密钥 VO
// TODO @fan要不前端不弄太多 VO就用这个 ImageDetailVO
export interface ImageDetailVO {
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 // 图片尺寸
createTime: string // 创建时间
updateTime: string // 更新事件
}
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 // 提示词
model: string // 模型
style: string // 图像生成的风格
width: string // 图片宽度
height: string // 图片高度
options: object // 绘制参数Map<String, String>
}
export interface ImageMidjourneyImagineReqVO {
prompt: string // 提示词
model: string // 模型 mj nijj
base64Array: string[] // size不能为空
width: string // 图片宽度
height: string // 图片高度
version: string // 版本
}
// TODO 芋艿review 下整体注释、方法名
// AI API 密钥 API
export const ImageApi = {
// 获取 image 列表
getImageList: 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}`})
},
// 生成图片
drawImage: async (data: ImageDrawReqVO)=> {
return await request.post({ url: `/ai/image/draw`, data })
},
// midjourney - imagine
midjourneyImagine: async (data: ImageMidjourneyImagineReqVO)=> {
return await request.post({ url: `/ai/image/midjourney/imagine`, data })
},
// 删除
deleteImage: async (id: number)=> {
return await request.delete({ url: `/ai/image/delete-my?id=${id}`})
},
}