Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8f2c6ab0
authored
May 30, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【增加】增加 midjourney 请求
parent
b82391da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletions
+37
-1
src/api/ai/image/index.ts
+19
-1
src/views/ai/image/midjourney/index.vue
+18
-0
No files found.
src/api/ai/image/index.ts
View file @
8f2c6ab0
...
...
@@ -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
}
`
})
},
}
src/views/ai/image/midjourney/index.vue
View file @
8f2c6ab0
...
...
@@ -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"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment