diff --git a/src/api/ai/image/index.ts b/src/api/ai/image/index.ts
index 8e52d427..a5b88399 100644
--- a/src/api/ai/image/index.ts
+++ b/src/api/ai/image/index.ts
@@ -42,6 +42,8 @@ export interface ImageMidjourneyImagineReqVO {
prompt: string // 提示词
model: string // 模型 mj nijj
base64Array: string[] // size不能为空
+ width: string // 图片宽度
+ height: string // 图片高度
}
diff --git a/src/views/ai/image/midjourney/index.vue b/src/views/ai/image/midjourney/index.vue
index 8d423124..ef1d7822 100644
--- a/src/views/ai/image/midjourney/index.vue
+++ b/src/views/ai/image/midjourney/index.vue
@@ -30,6 +30,22 @@
+
模型
@@ -73,6 +89,8 @@ interface ImageModelVO {
interface ImageSizeVO {
key: string
style: string,
+ width: string,
+ height: string,
}
// 定义属性
@@ -94,6 +112,41 @@ const models = ref([
]) // 模型
selectModel.value = models.value[0] // 默认选中
+const selectImageSize = ref({} as ImageSizeVO) // 选中 size
+const imageSizeList = ref([
+ {
+ key: '1:1',
+ width: "1",
+ height: "1",
+ style: 'width: 30px; height: 30px;background-color: #dcdcdc;',
+ },
+ {
+ key: '3:4',
+ width: "3",
+ height: "4",
+ style: 'width: 30px; height: 40px;background-color: #dcdcdc;',
+ },
+ {
+ key: '4:3',
+ width: "4",
+ height: "3",
+ style: 'width: 40px; height: 30px;background-color: #dcdcdc;',
+ },
+ {
+ key: '9:16',
+ width: "9",
+ height: "16",
+ style: 'width: 30px; height: 50px;background-color: #dcdcdc;',
+ },
+ {
+ key: '16:9',
+ width: "16",
+ height: "9",
+ style: 'width: 50px; height: 30px;background-color: #dcdcdc;',
+ },
+]) // size
+selectImageSize.value = imageSizeList.value[0]
+
// 定义 Props
const props = defineProps({})
@@ -112,6 +165,17 @@ const handlerHotWordClick = async (hotWord: string) => {
prompt.value = hotWord
}
+/**
+ * size - click
+ */
+const handlerSizeClick = async (imageSize: ImageSizeVO) => {
+ if (selectImageSize.value === imageSize) {
+ selectImageSize.value = {} as ImageSizeVO
+ return
+ }
+ selectImageSize.value = imageSize
+}
+
/**
* 模型 - click
*/
@@ -131,6 +195,8 @@ const handlerGenerateImage = async () => {
const req = {
prompt: prompt.value,
model: selectModel.value.key,
+ width: selectImageSize.value.width,
+ height: selectImageSize.value.height,
base64Array: [],
} as ImageMidjourneyImagineReqVO
await ImageApi.midjourneyImagine(req)