Commit 8f2c6ab0 by cherishsince

【增加】增加 midjourney 请求

parent b82391da
......@@ -27,9 +27,23 @@ 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 // 提示词
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}`})
},
}
......@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment