【增加】增加 midjourney 请求

This commit is contained in:
cherishsince 2024-05-30 16:12:24 +08:00
parent b82391da0a
commit 8f2c6ab0db
2 changed files with 37 additions and 1 deletions

View File

@ -23,6 +23,14 @@ export interface ImagePageReqVO {
pageSize: number // 分页大小
}
export interface ImageDallReqVO {
prompt: string // 提示词
model: string // 模型
style: string // 图像生成的风格
width: string // 图片宽度
height: string // 图片高度
}
export interface ImageDallReqVO {
prompt: string // 提示词
model: string // 模型
@ -30,6 +38,12 @@ export interface ImageDallReqVO {
size: string // size不能为空
}
export interface ImageMidjourneyImagineReqVO {
prompt: string // 提示词
base64Array: string[] // size不能为空
}
// AI API 密钥 API
export const ImageApi = {
// 获取 image 列表
@ -44,8 +58,12 @@ export const ImageApi = {
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}`})
return await request.delete({ url: `/ai/image/delete-id-my?id=${id}`})
},
}

View File

@ -74,6 +74,11 @@
<script setup lang="ts">
// image
import {ImageApi, ImageMidjourneyImagineReqVO} from "@/api/ai/image";
// emits
const emits = defineEmits(['onDrawStart', 'onDrawComplete'])
interface ImageModelVO {
key: string
name: string
@ -172,6 +177,19 @@ const handlerSizeClick = async (imageSize: ImageSizeVO) => {
*/
const handlerGenerateImage = async () => {
// todo @
try {
//
// emits('onDrawStart', selectModel.value.key)
//
const req = {
prompt: prompt.value,
base64Array: [],
} as ImageMidjourneyImagineReqVO
await ImageApi.midjourneyImagine(req)
} finally {
//
// emits('onDrawComplete', selectModel.value.key)
}
}
</script>
<style scoped lang="scss">