diff --git a/constant/midjourney.go b/constant/midjourney.go index cd38d5fe9..a8d0bfe31 100644 --- a/constant/midjourney.go +++ b/constant/midjourney.go @@ -1,6 +1,7 @@ package constant var MjNotifyEnabled = false +var MjAccountFilterEnabled = false var MjModeClearEnabled = false var MjForwardUrlEnabled = true diff --git a/model/option.go b/model/option.go index 57bbc3863..1adc84cba 100644 --- a/model/option.go +++ b/model/option.go @@ -92,6 +92,7 @@ func InitOptionMap() { common.OptionMap["DataExportDefaultTime"] = common.DataExportDefaultTime common.OptionMap["DefaultCollapseSidebar"] = strconv.FormatBool(common.DefaultCollapseSidebar) common.OptionMap["MjNotifyEnabled"] = strconv.FormatBool(constant.MjNotifyEnabled) + common.OptionMap["MjAccountFilterEnabled"] = strconv.FormatBool(constant.MjAccountFilterEnabled) common.OptionMap["MjModeClearEnabled"] = strconv.FormatBool(constant.MjModeClearEnabled) common.OptionMap["MjForwardUrlEnabled"] = strconv.FormatBool(constant.MjForwardUrlEnabled) common.OptionMap["CheckSensitiveEnabled"] = strconv.FormatBool(constant.CheckSensitiveEnabled) @@ -197,6 +198,8 @@ func updateOptionMap(key string, value string) (err error) { common.DefaultCollapseSidebar = boolValue case "MjNotifyEnabled": constant.MjNotifyEnabled = boolValue + case "MjAccountFilterEnabled": + constant.MjAccountFilterEnabled = boolValue case "MjModeClearEnabled": constant.MjModeClearEnabled = boolValue case "MjForwardUrlEnabled": diff --git a/service/midjourney.go b/service/midjourney.go index ccf5141f5..6bb3a9ea1 100644 --- a/service/midjourney.go +++ b/service/midjourney.go @@ -165,7 +165,9 @@ func DoMidjourneyHttpRequest(c *gin.Context, timeout time.Duration, fullRequestU if err != nil { return MidjourneyErrorWithStatusCodeWrapper(constant.MjErrorUnknown, "read_request_body_failed", http.StatusInternalServerError), nullBytes, err } - delete(mapResult, "accountFilter") + if !constant.MjAccountFilterEnabled { + delete(mapResult, "accountFilter") + } if !constant.MjNotifyEnabled { delete(mapResult, "notifyHook") } @@ -174,11 +176,11 @@ func DoMidjourneyHttpRequest(c *gin.Context, timeout time.Duration, fullRequestU } 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 + 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) diff --git a/web/src/components/OperationSetting.js b/web/src/components/OperationSetting.js index 44b6214cd..7566faaaa 100644 --- a/web/src/components/OperationSetting.js +++ b/web/src/components/OperationSetting.js @@ -38,6 +38,7 @@ const OperationSetting = () => { StopOnSensitiveEnabled: '', SensitiveWords: '', MjNotifyEnabled: '', + MjAccountFilterEnabled: '', MjModeClearEnabled: '', MjForwardUrlEnabled: '', DrawingEnabled: '', @@ -323,6 +324,12 @@ const OperationSetting = () => { name='MjNotifyEnabled' onChange={handleInputChange} /> +