zn-admin-vue3-wcs/src/api/ai/image/index.ts

73 lines
2.1 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
export interface ImageDetailVO {
id: number // 编号
prompt: string // 提示词
status: string // 状态
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 ImageDallReqVO {
prompt: string // 提示词
model: string // 模型
style: string // 图像生成的风格
size: string // size不能为空
}
export interface ImageMidjourneyImagineReqVO {
prompt: string // 提示词
model: string // 模型 mj nijj
base64Array: string[] // size不能为空
width: string // 图片宽度
height: 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}`})
},
// dall2、dall3 调用
dall: async (data: ImageDallReqVO)=> {
return await request.post({ url: `/ai/image/dall`, 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}`})
},
}