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
ed786b2d
authored
Jul 03, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【增加】image 增加重新生成操作(值已经完成切换,还不能完全填充值)
parent
5c560e2f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
6 deletions
+74
-6
src/views/ai/image/ImageTask.vue
+7
-0
src/views/ai/image/ImageTaskCard.vue
+7
-1
src/views/ai/image/dall3/index.vue
+8
-1
src/views/ai/image/index.vue
+34
-2
src/views/ai/image/midjourney/index.vue
+9
-1
src/views/ai/image/stable-diffusion/index.vue
+9
-1
No files found.
src/views/ai/image/ImageTask.vue
View file @
ed786b2d
...
@@ -130,6 +130,10 @@ const handlerImageBtnClick = async (type: string, imageDetail: ImageVO) => {
...
@@ -130,6 +130,10 @@ const handlerImageBtnClick = async (type: string, imageDetail: ImageVO) => {
message
.
success
(
'删除成功!'
)
message
.
success
(
'删除成功!'
)
}
else
if
(
type
===
'download'
)
{
}
else
if
(
type
===
'download'
)
{
await
downloadImage
(
imageDetail
.
picUrl
)
await
downloadImage
(
imageDetail
.
picUrl
)
}
else
if
(
type
===
'regeneration'
)
{
// Midjourney 平台
console
.
log
(
'regeneration'
,
imageDetail
.
id
)
await
emits
(
'onRegeneration'
,
imageDetail
)
}
}
}
}
...
@@ -175,6 +179,9 @@ const handlerPageChange = async (page) => {
...
@@ -175,6 +179,9 @@ const handlerPageChange = async (page) => {
/** 暴露组件方法 */
/** 暴露组件方法 */
defineExpose
({
getImageList
})
defineExpose
({
getImageList
})
// emits
const
emits
=
defineEmits
([
'onRegeneration'
])
/** 组件挂在的时候 */
/** 组件挂在的时候 */
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
// 获取 image 列表
// 获取 image 列表
...
...
src/views/ai/image/ImageTaskCard.vue
View file @
ed786b2d
...
@@ -28,6 +28,12 @@
...
@@ -28,6 +28,12 @@
<el-button
<el-button
class=
"btn"
class=
"btn"
text
text
:icon=
"RefreshRight"
@
click=
"handlerBtnClick('regeneration', imageDetail)"
/>
<el-button
class=
"btn"
text
:icon=
"Delete"
:icon=
"Delete"
@
click=
"handlerBtnClick('delete', imageDetail)"
@
click=
"handlerBtnClick('delete', imageDetail)"
/>
/>
...
@@ -56,7 +62,7 @@
...
@@ -56,7 +62,7 @@
</el-card>
</el-card>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
Delete
,
Download
,
More
}
from
'@element-plus/icons-vue'
import
{
Delete
,
Download
,
More
,
RefreshRight
}
from
'@element-plus/icons-vue'
import
{
ImageVO
,
ImageMjButtonsVO
}
from
'@/api/ai/image'
import
{
ImageVO
,
ImageMjButtonsVO
}
from
'@/api/ai/image'
import
{
PropType
}
from
'vue'
import
{
PropType
}
from
'vue'
import
{
ElLoading
}
from
'element-plus'
import
{
ElLoading
}
from
'element-plus'
...
...
src/views/ai/image/dall3/index.vue
View file @
ed786b2d
...
@@ -97,7 +97,7 @@
...
@@ -97,7 +97,7 @@
</div>
</div>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ImageApi
,
ImageDrawReqVO
}
from
'@/api/ai/image'
;
import
{
ImageApi
,
ImageDrawReqVO
,
ImageVO
}
from
'@/api/ai/image'
;
// image 模型
// image 模型
interface
ImageModelVO
{
interface
ImageModelVO
{
...
@@ -257,6 +257,13 @@ const handlerGenerateImage = async () => {
...
@@ -257,6 +257,13 @@ const handlerGenerateImage = async () => {
}
}
}
}
/** 填充值 */
const
settingValues
=
async
(
imageDetail
:
ImageVO
)
=>
{
prompt
.
value
=
imageDetail
.
prompt
}
/** 暴露组件方法 */
defineExpose
({
settingValues
})
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
...
src/views/ai/image/index.vue
View file @
ed786b2d
...
@@ -8,18 +8,23 @@
...
@@ -8,18 +8,23 @@
<div
class=
"modal-switch-container"
>
<div
class=
"modal-switch-container"
>
<Dall3
<Dall3
v-if=
"selectPlatform === AiPlatformEnum.OPENAI"
v-if=
"selectPlatform === AiPlatformEnum.OPENAI"
ref=
"dall3Ref"
@
on-draw-start=
"handlerDrawStart"
@
on-draw-start=
"handlerDrawStart"
@
on-draw-complete=
"handlerDrawComplete"
@
on-draw-complete=
"handlerDrawComplete"
/>
/>
<Midjourney
v-if=
"selectPlatform === AiPlatformEnum.MIDJOURNEY"
/>
<Midjourney
v-if=
"selectPlatform === AiPlatformEnum.MIDJOURNEY"
ref=
"midjourneyRef"
/>
<StableDiffusion
<StableDiffusion
v-if=
"selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
v-if=
"selectPlatform === AiPlatformEnum.STABLE_DIFFUSION"
ref=
"stableDiffusionRef"
@
on-draw-complete=
"handlerDrawComplete"
@
on-draw-complete=
"handlerDrawComplete"
/>
/>
</div>
</div>
</div>
</div>
<div
class=
"main"
>
<div
class=
"main"
>
<ImageTask
ref=
"imageTaskRef"
/>
<ImageTask
ref=
"imageTaskRef"
@
on-regeneration=
"handlerRegeneration"
/>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -31,8 +36,13 @@ import Midjourney from './midjourney/index.vue'
...
@@ -31,8 +36,13 @@ import Midjourney from './midjourney/index.vue'
import
StableDiffusion
from
'./stable-diffusion/index.vue'
import
StableDiffusion
from
'./stable-diffusion/index.vue'
import
ImageTask
from
'./ImageTask.vue'
import
ImageTask
from
'./ImageTask.vue'
import
{
AiPlatformEnum
}
from
'@/views/ai/utils/constants'
import
{
AiPlatformEnum
}
from
'@/views/ai/utils/constants'
import
{
ImageVO
}
from
"@/api/ai/image"
;
const
imageTaskRef
=
ref
<
any
>
()
// image task ref
const
imageTaskRef
=
ref
<
any
>
()
// image task ref
const
dall3Ref
=
ref
<
any
>
()
// image task ref
const
midjourneyRef
=
ref
<
any
>
()
// image task ref
const
stableDiffusionRef
=
ref
<
any
>
()
// image task ref
// 定义属性
// 定义属性
const
selectPlatform
=
ref
(
'StableDiffusion'
)
const
selectPlatform
=
ref
(
'StableDiffusion'
)
...
@@ -64,6 +74,28 @@ const handlerDrawComplete = async (type) => {
...
@@ -64,6 +74,28 @@ const handlerDrawComplete = async (type) => {
// todo
// todo
await
imageTaskRef
.
value
.
getImageList
()
await
imageTaskRef
.
value
.
getImageList
()
}
}
/** 绘画 - 重新生成 */
const
handlerRegeneration
=
async
(
imageDetail
:
ImageVO
)
=>
{
// 切换平台
selectPlatform
.
value
=
imageDetail
.
platform
// 根据不同平台填充 imageDetail
if
(
imageDetail
.
platform
===
AiPlatformEnum
.
MIDJOURNEY
)
{
await
nextTick
(
async
()
=>
{
midjourneyRef
.
value
.
settingValues
(
imageDetail
)
})
}
else
if
(
imageDetail
.
platform
===
AiPlatformEnum
.
OPENAI
)
{
await
nextTick
(
async
()
=>
{
dall3Ref
.
value
.
settingValues
(
imageDetail
)
})
}
else
if
(
imageDetail
.
platform
===
AiPlatformEnum
.
STABLE_DIFFUSION
)
{
await
nextTick
(
async
()
=>
{
stableDiffusionRef
.
value
.
settingValues
(
imageDetail
)
})
}
}
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
...
src/views/ai/image/midjourney/index.vue
View file @
ed786b2d
...
@@ -104,7 +104,7 @@
...
@@ -104,7 +104,7 @@
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
// image 模型
// image 模型
import
{
ImageApi
,
ImageMidjourneyImagineReqVO
}
from
"@/api/ai/image"
;
import
{
ImageApi
,
ImageMidjourneyImagineReqVO
,
ImageVO
}
from
"@/api/ai/image"
;
// message
// message
const
message
=
useMessage
()
const
message
=
useMessage
()
// 定义 emits
// 定义 emits
...
@@ -274,6 +274,14 @@ const handlerGenerateImage = async () => {
...
@@ -274,6 +274,14 @@ const handlerGenerateImage = async () => {
emits
(
'onDrawComplete'
,
selectModel
.
value
.
key
)
emits
(
'onDrawComplete'
,
selectModel
.
value
.
key
)
}
}
}
}
/** 填充值 */
const
settingValues
=
async
(
imageDetail
:
ImageVO
)
=>
{
prompt
.
value
=
imageDetail
.
prompt
}
/** 暴露组件方法 */
defineExpose
({
settingValues
})
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
...
src/views/ai/image/stable-diffusion/index.vue
View file @
ed786b2d
...
@@ -120,7 +120,7 @@
...
@@ -120,7 +120,7 @@
</div>
</div>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ImageApi
,
ImageDrawReqVO
}
from
'@/api/ai/image'
import
{
ImageApi
,
ImageDrawReqVO
,
ImageVO
}
from
'@/api/ai/image'
// image 模型
// image 模型
interface
ImageModelVO
{
interface
ImageModelVO
{
...
@@ -371,6 +371,14 @@ const handleGenerateImage = async () => {
...
@@ -371,6 +371,14 @@ const handleGenerateImage = async () => {
drawIn
.
value
=
false
drawIn
.
value
=
false
}
}
}
}
/** 填充值 */
const
settingValues
=
async
(
imageDetail
:
ImageVO
)
=>
{
prompt
.
value
=
imageDetail
.
prompt
}
/** 暴露组件方法 */
defineExpose
({
settingValues
})
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
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