feat: add midjourney message receive handler

This commit is contained in:
RockYang
2023-08-14 07:09:52 +08:00
parent 302cb8a5be
commit 6e40f92aaf
8 changed files with 54 additions and 31 deletions

View File

@@ -36,12 +36,13 @@ func (f FuncMidJourney) Invoke(params map[string]interface{}) (string, error) {
delete(params, "ar")
}
prompt = prompt + " --niji 5"
url := fmt.Sprintf("%s/api/mj/image", f.config.ApiURL)
var res types.BizVo
r, err := f.client.R().
SetHeader("Authorization", f.config.Token).
SetHeader("Content-Type", "application/json").
SetBody(params).
SetSuccessResult(&res).Post(f.config.ApiURL)
SetSuccessResult(&res).Post(url)
if err != nil || r.IsErrorState() {
return "", fmt.Errorf("%v%v", r.String(), err)
}