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
613ffadb
authored
Apr 06, 2024
by
iszcz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
清除--mode
parent
d674e72a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
0 deletions
+21
-0
constant/midjourney.go
+2
-0
model/option.go
+3
-0
service/midjourney.go
+9
-0
web/src/components/OperationSetting.js
+7
-0
No files found.
constant/midjourney.go
View file @
613ffadb
...
@@ -2,6 +2,8 @@ package constant
...
@@ -2,6 +2,8 @@ package constant
var
MjNotifyEnabled
=
false
var
MjNotifyEnabled
=
false
var
MjModeClearEnabled
=
false
const
(
const
(
MjErrorUnknown
=
5
MjErrorUnknown
=
5
MjRequestError
=
4
MjRequestError
=
4
...
...
model/option.go
View file @
613ffadb
...
@@ -92,6 +92,7 @@ func InitOptionMap() {
...
@@ -92,6 +92,7 @@ func InitOptionMap() {
common
.
OptionMap
[
"DataExportDefaultTime"
]
=
common
.
DataExportDefaultTime
common
.
OptionMap
[
"DataExportDefaultTime"
]
=
common
.
DataExportDefaultTime
common
.
OptionMap
[
"DefaultCollapseSidebar"
]
=
strconv
.
FormatBool
(
common
.
DefaultCollapseSidebar
)
common
.
OptionMap
[
"DefaultCollapseSidebar"
]
=
strconv
.
FormatBool
(
common
.
DefaultCollapseSidebar
)
common
.
OptionMap
[
"MjNotifyEnabled"
]
=
strconv
.
FormatBool
(
constant
.
MjNotifyEnabled
)
common
.
OptionMap
[
"MjNotifyEnabled"
]
=
strconv
.
FormatBool
(
constant
.
MjNotifyEnabled
)
common
.
OptionMap
[
"MjModeClearEnabled"
]
=
strconv
.
FormatBool
(
constant
.
MjModeClearEnabled
)
common
.
OptionMap
[
"CheckSensitiveEnabled"
]
=
strconv
.
FormatBool
(
constant
.
CheckSensitiveEnabled
)
common
.
OptionMap
[
"CheckSensitiveEnabled"
]
=
strconv
.
FormatBool
(
constant
.
CheckSensitiveEnabled
)
common
.
OptionMap
[
"CheckSensitiveOnPromptEnabled"
]
=
strconv
.
FormatBool
(
constant
.
CheckSensitiveOnPromptEnabled
)
common
.
OptionMap
[
"CheckSensitiveOnPromptEnabled"
]
=
strconv
.
FormatBool
(
constant
.
CheckSensitiveOnPromptEnabled
)
//common.OptionMap["CheckSensitiveOnCompletionEnabled"] = strconv.FormatBool(constant.CheckSensitiveOnCompletionEnabled)
//common.OptionMap["CheckSensitiveOnCompletionEnabled"] = strconv.FormatBool(constant.CheckSensitiveOnCompletionEnabled)
...
@@ -195,6 +196,8 @@ func updateOptionMap(key string, value string) (err error) {
...
@@ -195,6 +196,8 @@ func updateOptionMap(key string, value string) (err error) {
common
.
DefaultCollapseSidebar
=
boolValue
common
.
DefaultCollapseSidebar
=
boolValue
case
"MjNotifyEnabled"
:
case
"MjNotifyEnabled"
:
constant
.
MjNotifyEnabled
=
boolValue
constant
.
MjNotifyEnabled
=
boolValue
case
"MjModeClearEnabled"
:
constant
.
MjModeClearEnabled
=
boolValue
case
"CheckSensitiveEnabled"
:
case
"CheckSensitiveEnabled"
:
constant
.
CheckSensitiveEnabled
=
boolValue
constant
.
CheckSensitiveEnabled
=
boolValue
case
"CheckSensitiveOnPromptEnabled"
:
case
"CheckSensitiveOnPromptEnabled"
:
...
...
service/midjourney.go
View file @
613ffadb
...
@@ -172,6 +172,15 @@ func DoMidjourneyHttpRequest(c *gin.Context, timeout time.Duration, fullRequestU
...
@@ -172,6 +172,15 @@ func DoMidjourneyHttpRequest(c *gin.Context, timeout time.Duration, fullRequestU
//req, err := http.NewRequest(c.Request.Method, fullRequestURL, requestBody)
//req, err := http.NewRequest(c.Request.Method, fullRequestURL, requestBody)
// make new request with mapResult
// make new request with mapResult
}
}
if
constant
.
MjModeClearEnabled
{
if
prompt
,
ok
:=
mapResult
[
"prompt"
]
.
(
string
);
ok
{
prompt
=
strings
.
Replace
(
prompt
,
"--fast"
,
""
,
-
1
)
prompt
=
strings
.
Replace
(
prompt
,
"--relax"
,
""
,
-
1
)
prompt
=
strings
.
Replace
(
prompt
,
"--turbo"
,
""
,
-
1
)
mapResult
[
"prompt"
]
=
prompt
}
}
reqBody
,
err
:=
json
.
Marshal
(
mapResult
)
reqBody
,
err
:=
json
.
Marshal
(
mapResult
)
if
err
!=
nil
{
if
err
!=
nil
{
return
MidjourneyErrorWithStatusCodeWrapper
(
constant
.
MjErrorUnknown
,
"marshal_request_body_failed"
,
http
.
StatusInternalServerError
),
nullBytes
,
err
return
MidjourneyErrorWithStatusCodeWrapper
(
constant
.
MjErrorUnknown
,
"marshal_request_body_failed"
,
http
.
StatusInternalServerError
),
nullBytes
,
err
...
...
web/src/components/OperationSetting.js
View file @
613ffadb
...
@@ -36,6 +36,7 @@ const OperationSetting = () => {
...
@@ -36,6 +36,7 @@ const OperationSetting = () => {
StopOnSensitiveEnabled
:
''
,
StopOnSensitiveEnabled
:
''
,
SensitiveWords
:
''
,
SensitiveWords
:
''
,
MjNotifyEnabled
:
''
,
MjNotifyEnabled
:
''
,
MjModeClearEnabled
:
''
,
DrawingEnabled
:
''
,
DrawingEnabled
:
''
,
DataExportEnabled
:
''
,
DataExportEnabled
:
''
,
DataExportDefaultTime
:
'hour'
,
DataExportDefaultTime
:
'hour'
,
...
@@ -312,6 +313,12 @@ const OperationSetting = () => {
...
@@ -312,6 +313,12 @@ const OperationSetting = () => {
name
=
'MjNotifyEnabled'
name
=
'MjNotifyEnabled'
onChange
=
{
handleInputChange
}
onChange
=
{
handleInputChange
}
/
>
/
>
<
Form
.
Checkbox
checked
=
{
inputs
.
MjModeClearEnabled
===
'true'
}
label
=
'开启之后会清除用户提示词中的--fast、--relax以及--turbo参数'
name
=
'MjModeClearEnabled'
onChange
=
{
handleInputChange
}
/
>
<
/Form.Group
>
<
/Form.Group
>
<
Divider
/>
<
Divider
/>
<
Header
as
=
'h3'
>
屏蔽词过滤设置
<
/Header
>
<
Header
as
=
'h3'
>
屏蔽词过滤设置
<
/Header
>
...
...
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