Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
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
a7351b72
authored
Jul 08, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 允许设置是否检测mj任务已完成才可进行action操作 (close #349)
parent
ea72b9c9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
2 deletions
+30
-2
constant/midjourney.go
+1
-0
model/option.go
+3
-0
relay/relay-mj.go
+5
-2
web/src/components/OperationSetting.js
+1
-0
web/src/pages/Setting/Operation/SettingsDrawing.js
+20
-0
No files found.
constant/midjourney.go
View file @
a7351b72
...
...
@@ -4,6 +4,7 @@ var MjNotifyEnabled = false
var
MjAccountFilterEnabled
=
false
var
MjModeClearEnabled
=
false
var
MjForwardUrlEnabled
=
true
var
MjActionCheckSuccessEnabled
=
true
const
(
MjErrorUnknown
=
5
...
...
model/option.go
View file @
a7351b72
...
...
@@ -99,6 +99,7 @@ func InitOptionMap() {
common
.
OptionMap
[
"MjAccountFilterEnabled"
]
=
strconv
.
FormatBool
(
constant
.
MjAccountFilterEnabled
)
common
.
OptionMap
[
"MjModeClearEnabled"
]
=
strconv
.
FormatBool
(
constant
.
MjModeClearEnabled
)
common
.
OptionMap
[
"MjForwardUrlEnabled"
]
=
strconv
.
FormatBool
(
constant
.
MjForwardUrlEnabled
)
common
.
OptionMap
[
"MjActionCheckSuccessEnabled"
]
=
strconv
.
FormatBool
(
constant
.
MjActionCheckSuccessEnabled
)
common
.
OptionMap
[
"CheckSensitiveEnabled"
]
=
strconv
.
FormatBool
(
constant
.
CheckSensitiveEnabled
)
common
.
OptionMap
[
"CheckSensitiveOnPromptEnabled"
]
=
strconv
.
FormatBool
(
constant
.
CheckSensitiveOnPromptEnabled
)
//common.OptionMap["CheckSensitiveOnCompletionEnabled"] = strconv.FormatBool(constant.CheckSensitiveOnCompletionEnabled)
...
...
@@ -210,6 +211,8 @@ func updateOptionMap(key string, value string) (err error) {
constant
.
MjModeClearEnabled
=
boolValue
case
"MjForwardUrlEnabled"
:
constant
.
MjForwardUrlEnabled
=
boolValue
case
"MjActionCheckSuccessEnabled"
:
constant
.
MjActionCheckSuccessEnabled
=
boolValue
case
"CheckSensitiveEnabled"
:
constant
.
CheckSensitiveEnabled
=
boolValue
case
"CheckSensitiveOnPromptEnabled"
:
...
...
relay/relay-mj.go
View file @
a7351b72
...
...
@@ -415,9 +415,12 @@ func RelayMidjourneySubmit(c *gin.Context, relayMode int) *dto.MidjourneyRespons
originTask
:=
model
.
GetByMJId
(
userId
,
mjId
)
if
originTask
==
nil
{
return
service
.
MidjourneyErrorWrapper
(
constant
.
MjRequestError
,
"task_not_found"
)
}
else
if
originTask
.
Status
!=
"SUCCESS"
&&
relayMode
!=
relayconstant
.
RelayModeMidjourneyModal
{
return
service
.
MidjourneyErrorWrapper
(
constant
.
MjRequestError
,
"task_status_not_success"
)
}
else
{
//原任务的Status=SUCCESS,则可以做放大UPSCALE、变换VARIATION等动作,此时必须使用原来的请求地址才能正确处理
if
constant
.
MjActionCheckSuccessEnabled
{
if
originTask
.
Status
!=
"SUCCESS"
&&
relayMode
!=
relayconstant
.
RelayModeMidjourneyModal
{
return
service
.
MidjourneyErrorWrapper
(
constant
.
MjRequestError
,
"task_status_not_success"
)
}
}
channel
,
err
:=
model
.
GetChannelById
(
originTask
.
ChannelId
,
true
)
if
err
!=
nil
{
return
service
.
MidjourneyErrorWrapper
(
constant
.
MjRequestError
,
"get_channel_info_failed"
)
...
...
web/src/components/OperationSetting.js
View file @
a7351b72
...
...
@@ -42,6 +42,7 @@ const OperationSetting = () => {
MjAccountFilterEnabled
:
false
,
MjModeClearEnabled
:
false
,
MjForwardUrlEnabled
:
false
,
MjActionCheckSuccessEnabled
:
false
,
DrawingEnabled
:
false
,
DataExportEnabled
:
false
,
DataExportDefaultTime
:
'hour'
,
...
...
web/src/pages/Setting/Operation/SettingsDrawing.js
View file @
a7351b72
...
...
@@ -16,6 +16,7 @@ export default function SettingsDrawing(props) {
MjAccountFilterEnabled
:
false
,
MjForwardUrlEnabled
:
false
,
MjModeClearEnabled
:
false
,
MjActionCheckSuccessEnabled
:
false
,
});
const
refForm
=
useRef
();
const
[
inputsRow
,
setInputsRow
]
=
useState
(
inputs
);
...
...
@@ -156,6 +157,25 @@ export default function SettingsDrawing(props) {
}
/
>
<
/Col
>
<
Col
span
=
{
8
}
>
<
Form
.
Switch
field
=
{
'MjActionCheckSuccessEnabled'
}
label
=
{
<>
检测必须等待绘图成功才能进行放大等操作
<
/
>
}
size
=
'large'
checkedText
=
'|'
uncheckedText
=
'〇'
onChange
=
{(
value
)
=>
setInputs
({
...
inputs
,
MjActionCheckSuccessEnabled
:
value
,
})
}
/
>
<
/Col
>
<
/Row
>
<
Row
>
<
Button
size
=
'large'
onClick
=
{
onSubmit
}
>
...
...
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