├── docs ├── img_9.png ├── bot-me.png ├── params_user.png ├── manager-qrcode.jpeg ├── telegram-qrcode.png ├── discord-params.md ├── start.md ├── config.md └── api.md ├── resources ├── application.yml └── banned-words.txt ├── .gitignore ├── README.md ├── README_US.md └── LICENSE /docs/img_9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litter-coder/midjourney-proxy-plus/HEAD/docs/img_9.png -------------------------------------------------------------------------------- /docs/bot-me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litter-coder/midjourney-proxy-plus/HEAD/docs/bot-me.png -------------------------------------------------------------------------------- /docs/params_user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litter-coder/midjourney-proxy-plus/HEAD/docs/params_user.png -------------------------------------------------------------------------------- /docs/manager-qrcode.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litter-coder/midjourney-proxy-plus/HEAD/docs/manager-qrcode.jpeg -------------------------------------------------------------------------------- /docs/telegram-qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litter-coder/midjourney-proxy-plus/HEAD/docs/telegram-qrcode.png -------------------------------------------------------------------------------- /resources/application.yml: -------------------------------------------------------------------------------- 1 | mj: 2 | account-store-type: in_memory 3 | task-store: 4 | type: in_memory 5 | timeout: 30d 6 | translate-way: null 7 | translate-zh-way: null 8 | error-desc: 9 | - en: "against our community standards" 10 | zh: "可能包含违规信息" 11 | -------------------------------------------------------------------------------- /docs/discord-params.md: -------------------------------------------------------------------------------- 1 | ## 获取discord账号参数 2 | 3 | ### 1. 获取用户Token 4 | 进入频道,打开network,刷新页面,找到 `messages` 的请求 5 | - Authorization 即用户Token,后续设置到 `user-token` 6 | - User-Agent 后续设置到 `user-agent` 7 | 8 | ![User Token](params_user.png) 9 | 10 | ### 2. 获取服务器ID、频道ID 11 | 12 | 频道的url里取出 服务器ID、频道ID,后续设置到账号的 `guild-id`、`channel-id` 13 | ![Guild Channel ID](img_9.png) 14 | 15 | ### 3. 获取MJ私信ID 16 | 17 | url里取出 私信ID,后续设置到账号的 `mj-bot-channel-id` 18 | ![Midjourney @me](bot-me.png) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | !**/src/main/** 4 | !**/src/test/** 5 | bin/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | 33 | ### Macos ### 34 | .DS_Store 35 | 36 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 37 | hs_err_pid* -------------------------------------------------------------------------------- /docs/start.md: -------------------------------------------------------------------------------- 1 | ## Docker部署教程 2 | 3 | ### 升级版本 4 | ⚠️ 注意: **不要删除docker容器** 5 | 1. 获取最新版本的app.jar 6 | 2. 替换到config目录下,注意jar文件名需为app.jar 7 | 3. 重启容器,不需要重新激活 8 | ```shell 9 | docker restart midjourney-proxy-plus 10 | ``` 11 | 4. 若服务有问题,请查看docker日志 12 | ```shell 13 | docker logs -f -n 100 midjourney-proxy-plus 14 | ``` 15 | 16 | ### 初次部署 17 | 1. /xxx/xxx/config目录下创建 18 | > 注意: /xxx/xxx是 服务器目录示例,需自行修改 19 | - `app.jar` 最新的jar包,下载并命名为app.jar 20 | - `application.yml` mj配置项,参考 https://github.com/litter-coder/midjourney-proxy-plus/blob/main/resources/application.yml 21 | - `banned-words.txt` 非必须,覆盖默认的敏感词文件,参考 https://github.com/litter-coder/midjourney-proxy-plus/blob/main/resources/banned-words.txt 22 | 23 | 2. 启动容器,映射config目录 24 | ```shell 25 | docker run -d --name midjourney-proxy-plus \ 26 | -p 8080:8080 \ 27 | -v /xxx/xxx/config:/home/spring/config \ 28 | novicezk/plus-jdk17:latest 29 | ``` 30 | 3. 若服务有问题,请查看docker日志 31 | ```shell 32 | docker logs -f -n 100 midjourney-proxy-plus 33 | ``` 34 | 35 | 4. 访问 `http://ip:port` 查看管理页面,用户名默认是admin,密码默认是设置的接口密钥(未设置默认密码是admin) 36 | 5. 登录后按照指引激活服务 -------------------------------------------------------------------------------- /resources/banned-words.txt: -------------------------------------------------------------------------------- 1 | blood 2 | twerk 3 | making love 4 | voluptuous 5 | naughty 6 | wincest 7 | orgy 8 | no clothes 9 | au naturel 10 | no shirt 11 | decapitate 12 | bare 13 | nude 14 | barely dressed 15 | nude 16 | bra 17 | risque 18 | scantily clad 19 | cleavage 20 | stripped 21 | infested 22 | full frontal 23 | unclothed 24 | invisible clothes 25 | wearing nothing 26 | lingerie 27 | with no shirt 28 | naked 29 | without clothes on 30 | negligee 31 | zero clothes 32 | gruesome 33 | fascist 34 | nazi 35 | prophet mohammed 36 | slave 37 | coon 38 | honkey 39 | cocaine 40 | heroin 41 | meth 42 | crack 43 | kill 44 | belle delphine 45 | hitler 46 | jinping 47 | lolita 48 | president xi 49 | torture 50 | disturbing 51 | farts 52 | fart 53 | poop 54 | infected 55 | warts 56 | shit 57 | brown pudding 58 | bunghole 59 | vomit 60 | voluptuous 61 | seductive 62 | sperm 63 | sexy 64 | sadist 65 | sensored 66 | censored 67 | silenced 68 | deepfake 69 | inappropriate 70 | waifu 71 | succubus 72 | slaughter 73 | surgery 74 | reproduce 75 | crucified 76 | seductively 77 | explicit 78 | inappropriate 79 | large bust 80 | explicit 81 | wang 82 | inappropriate 83 | teratoma 84 | intimate 85 | see through 86 | tryphophobia 87 | bloodbath 88 | wound 89 | cronenberg 90 | khorne 91 | cannibal 92 | cannibalism 93 | visceral 94 | guts 95 | bloodshot 96 | gory 97 | killing 98 | crucifixion 99 | surgery 100 | vivisection 101 | massacre 102 | hemoglobin 103 | suicide 104 | arse 105 | labia 106 | ass 107 | mammaries 108 | badonkers 109 | bloody 110 | minge 111 | big ass 112 | mommy milker 113 | booba 114 | nipple 115 | oppai 116 | booty 117 | organs 118 | bosom 119 | ovaries 120 | flesh 121 | breasts 122 | penis 123 | busty 124 | phallus 125 | clunge 126 | sexy female 127 | crotch 128 | skimpy 129 | dick 130 | thick 131 | bruises 132 | girth 133 | titty 134 | honkers 135 | vagina 136 | hooters 137 | veiny 138 | knob 139 | ahegao 140 | pinup 141 | ballgag 142 | car crash 143 | playboy 144 | bimbo 145 | pleasure 146 | bodily fluids 147 | pleasures 148 | boudoir 149 | rule34 150 | brothel 151 | seducing 152 | dominatrix 153 | corpse 154 | seductive 155 | erotic 156 | seductive 157 | fuck 158 | sensual 159 | hardcore 160 | sexy 161 | hentai 162 | shag 163 | horny 164 | crucified 165 | shibari 166 | incest 167 | smut 168 | jav 169 | succubus 170 | jerk off king at pic 171 | thot 172 | kinbaku 173 | legs spread 174 | sensuality 175 | belly button 176 | porn 177 | patriotic 178 | bleed 179 | excrement 180 | petite 181 | seduction 182 | mccurry 183 | provocative 184 | sultry 185 | erected 186 | camisole 187 | tight white 188 | arrest 189 | see-through 190 | feces 191 | anus 192 | revealing clothing 193 | vein 194 | loli 195 | -edge 196 | boobs 197 | -backed 198 | tied up 199 | zedong 200 | bathing 201 | jail 202 | reticulum 203 | rear end 204 | sakimichan 205 | behind bars 206 | shirtless 207 | sakimichan 208 | seductive 209 | sexi 210 | sexualiz 211 | sexual -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |

midjourney-proxy-plus

4 | 5 | [English](./README_US.md) | 中文 6 | 7 | [![GitHub release](https://img.shields.io/static/v1?label=release&message=v3.8.2&color=blue)](https://github.com/litter-coder/midjourney-proxy-plus) 8 | [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 9 | 10 |
11 | 12 | [midjourney-proxy](https://github.com/novicezk/midjourney-proxy) 的plus版本,采用了全新模式。支持mj所有的指令和相关操作,精准匹配所有提交的任务。 13 | 14 | ## 开源版功能 15 | - [x] 支持 Imagine 指令和相关动作 16 | - [x] Imagine 时支持添加图片base64,作为垫图 17 | - [x] 支持 Blend(图片混合)、Describe(图生文) 指令 18 | - [x] 支持任务实时进度 19 | - [x] 支持中文prompt翻译,需配置百度翻译或gpt 20 | - [x] prompt 敏感词预检测,支持覆盖调整 21 | - [x] user-token 连接 wss,可以获取错误信息和完整功能 22 | - [x] 支持多账号配置,每个账号可设置对应的任务队列 23 | 24 | ## 先行版功能 25 | - [x] 支持开源版的所有功能 26 | - [x] 支持 Shorten(prompt分析) 指令 27 | - [x] 支持焦点移动: Pan ⬅️ ➡️ ⬆️ ⬇️ 28 | - [x] 支持图片变焦: Zoom 🔍 29 | - [x] 支持局部重绘: Vary (Region) 🖌 30 | - [x] 支持几乎所有的关联按钮动作和🎛️ Remix模式 31 | - [x] 支持获取图片的seed值 32 | - [x] 账号池持久化,动态维护 33 | - [x] 账号、任务存储支持内存、Redis、MySQL 34 | - [x] 支持获取账号/info、/settings信息,更改settings设置 35 | - [x] 支持取消等待、进行中的任务 36 | - [x] 内嵌 [管理后台](https://github.com/litter-coder/midjourney-proxy-admin): 支持账号维护、任务查看、绘图测试等 37 | - [x] 支持MJ V6.0以及cerf等最新参数操作 38 | - [x] mj账号订阅过期或被封后,自动禁用 39 | - [x] mj账号快速时长消耗完后,自动切换为relax模式 40 | - [x] 支持 [niji・journey Bot](https://discord.com/invite/nijijourney),需加入自己的服务器 41 | - [x] 支持 [InsightFace 人脸服务](https://discord.com/api/oauth2/authorize?client_id=1090660574196674713&permissions=274877945856&scope=bot) 42 | - [x] 后台支持动态配置 43 | - [x] 解决token频繁掉线问题 44 | - [x] 支持弹窗自动验证功能 45 | - [x] 支持违禁词Action needed to continue自动申诉 46 | - [x] 支持最新的MidJourney V7 Alpha版本 47 | - [x] 支持视频生成相关接口 48 | 49 | ## 获取方式 50 | 51 | 微信扫码获取,备注mj先行版 52 | 53 | 微信二维码 54 | 55 | Telegram 56 | 57 | Telegram二维码 58 | 59 | 加入我们即可获得 60 | 61 | - midjourney-proxy的最新版本 62 | - [微信机器人最新版本](https://github.com/litter-coder/wechat-ai) 63 | - 及时维护,出问题优先修复 64 | - 您的意见和建议会被我们重点采纳 65 | 66 | ## 应用项目 67 | - [wechat-ai](https://github.com/litter-coder/wechat-ai) : 基于 chatgpt-on-wechat 和 midjourney-proxy-plus 的微信智能机器人 68 | - [chatgpt-web-midjourney-proxy](https://github.com/Dooy/chatgpt-web-midjourney-proxy) : chatgpt web, midjourney, gpts,tts, whisper 一套ui全搞定 69 | - [new-api](https://github.com/Calcium-Ion/new-api) : 接入Midjourney Proxy (Plus)的接口管理 & 分发系统 70 | - [midjourney-captcha-bot](https://github.com/ye4241/midjourney-captcha-bot) : 绕过Midjourney验证码 71 | 72 | ## 使用前提 73 | 1. 注册并订阅 MidJourney,创建自己的频道,参考 https://docs.midjourney.com/docs/quick-start 74 | 2. 获取用户Token、服务器ID、频道ID等:[获取方式](./docs/discord-params.md) 75 | 76 | ## 其它 77 | 如果觉得这个项目对您有所帮助,请帮忙点个star 78 | 79 | [![Star History Chart](https://api.star-history.com/svg?repos=litter-coder/midjourney-proxy-plus&type=Date)](https://star-history.com/#litter-coder/midjourney-proxy-plus&Date) 80 | -------------------------------------------------------------------------------- /README_US.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |

midjourney-proxy-plus

4 | 5 | English | [中文](./README.md) 6 | 7 | [![GitHub release](https://img.shields.io/static/v1?label=release&message=v3.8.2&color=blue)](https://github.com/litter-coder/midjourney-proxy-plus) 8 | [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 9 | 10 |
11 | 12 | The plus version of [midjourney-proxy](https://github.com/novicezk/midjourney-proxy) adopts a brand new mode. It supports all MidJourney commands and related operations, and accurately matches all submitted tasks. 13 | 14 | ## Open Source Version Features 15 | - [x] Supports Imagine instructions and related actions 16 | - [x] Supports adding image base64 as a placeholder when using the Imagine command 17 | - [x] Supports Blend (image blending) and Describe (image to text) commands 18 | - [x] Supports real-time progress tracking of tasks 19 | - [x] Supports translation of Chinese prompts, requires configuration of Baidu Translate or GPT 20 | - [x] Prompt sensitive word pre-detection, supports override adjustment 21 | - [x] User-token connects to WSS (WebSocket Secure), allowing access to error messages and full functionality 22 | - [x] Supports multi-account configuration, with each account able to set up corresponding task queues 23 | 24 | ## Plus Version Features 25 | - [x] Supports all the features of the open-source version 26 | - [x] Supports Shorten (prompt analysis) command 27 | - [x] Supports focus shifting: Pan ⬅️ ➡️ ⬆️ ⬇️ 28 | - [x] Supports image zooming: Zoom 🔍 29 | - [x] Supports local redrawing: Vary (Region) 🖌 30 | - [x] Supports nearly all associated button actions and the 🎛️ Remix mode 31 | - [x] Supports retrieving the seed value of images 32 | - [x] Account pool persistence, dynamic maintenance 33 | - [x] Account and task storage support for in-memory, Redis, MySQL 34 | - [x] Supports retrieving account /info and /settings information, and changing settings configurations 35 | - [x] Supports canceling tasks that are waiting or in progress 36 | - [x] Embedded [management dashboard](https://github.com/litter-coder/midjourney-proxy-admin): Supports account maintenance, task viewing, drawing tests, etc 37 | - [x] Supports MJ V6.0 and other latest parameter operations such as 'cerf' 38 | - [x] Automatically disable when the MJ account subscription expires or is banned 39 | - [x] Automatically switch to relax mode after the quick duration of the MJ account is consumed 40 | - [x] Supports [niji・journey Bot](https://discord.com/invite/nijijourney), must be added to your own server 41 | - [x] Supports [InsightFace Bot](https://discord.com/api/oauth2/authorize?client_id=1090660574196674713&permissions=274877945856&scope=bot) 42 | - [x] Backend supports dynamic configuration 43 | - [x] Resolves the issue of frequent token disconnections 44 | - [x] Supports automatic pop-up verification 45 | - [x] Supports automatic appeal for prohibited word 'Action needed to continue' 46 | - [x] Supports the latest MidJourney V7 Alpha version 47 | - [x] Supports video generation related interfaces 48 | 49 | ## Acquisition Method 50 | 51 | Obtain by scanning WeChat QR code, remark with ‘mj plus’. 52 | 53 | WeChat QR Code 54 | 55 | Telegram 56 | 57 | Telegram QR Code 58 | 59 | Join us to receive 60 | 61 | - The latest version of midjourney-proxy 62 | - [The latest version of the WeChat bot](https://github.com/litter-coder/wechat-ai) 63 | - Timely maintenance with priority given to fixing issues as they arise 64 | - Your opinions and suggestions will be given priority consideration by us 65 | 66 | ## Application Project 67 | - [wechat-ai](https://github.com/litter-coder/wechat-ai) : A WeChat smart bot based on chatgpt-on-wechat and midjourney-proxy-plus 68 | - [chatgpt-web-midjourney-proxy](https://github.com/Dooy/chatgpt-web-midjourney-proxy) : chatgpt web, midjourney, gpts,tts, whisper A complete UI solution 69 | - [new-api](https://github.com/Calcium-Ion/new-api) : An API interface management and distribution system compatible with the Midjourney Proxy (Plus) 70 | - [midjourney-captcha-bot](https://github.com/ye4241/midjourney-captcha-bot) : Bypass Midjourney captcha 71 | 72 | ## Prerequisites for use 73 | 1. Register and subscribe to MidJourney, create your own channel, refer to https://docs.midjourney.com/docs/quick-start 74 | 2. Obtain user Token, server ID, channel ID: [Method of acquisition](./docs/discord-params.md) 75 | 76 | ## Others 77 | If you find this project helpful, please consider giving it a star 78 | 79 | [![Star History Chart](https://api.star-history.com/svg?repos=litter-coder/midjourney-proxy-plus&type=Date)](https://star-history.com/#litter-coder/midjourney-proxy-plus&Date) 80 | -------------------------------------------------------------------------------- /docs/config.md: -------------------------------------------------------------------------------- 1 | ## 配置项 2 | 3 | | 变量名 | 非空 | 描述 | 4 | |:------------------------------| :----: |:-------------------------------------------------------------------------------------------------------------| 5 | | mj.accounts | 是 | 参考 [账号池配置](./config.md#%E8%B4%A6%E5%8F%B7%E6%B1%A0%E9%85%8D%E7%BD%AE%E5%8F%82%E8%80%83),配置后不需要额外设置mj.discord | 6 | | mj.account-store-type | 否 | 账号存储方式,默认in_memory(内存\重启后丢失),可选redis、mysql | 7 | | mj.account-choose-rule | 否 | 账号选择策略:默认 BestWaitIdleRule(最少等待)、RoundRobinRule(轮循)、WeightedRandomRule(加权随机) | 8 | | mj.account-sync-cron | 否 | 账号同步任务的执行时间cron,默认每天20:30执行(0 30 20 * * ?),设置为0关闭此定时任务 | 9 | | mj.api-secret | 否 | 接口密钥,为空不启用鉴权;调用接口时需要加请求头 mj-api-secret | 10 | | mj.username | 否 | 后台管理登录的用户名 | 11 | | mj.password | 否 | 后台管理登录的密码,默认为接口密钥(两者均未设置默认admin) | 12 | | mj.admin-image-prefix | 否 | admin管理页图片前缀,可设置 `https://wsrv.nl/?url=` 等反代discord图片 | 13 | | mj.task-store.type | 否 | 任务存储方式,默认in_memory(内存\重启后丢失),可选redis、mysql | 14 | | mj.task-store.timeout | 否 | 任务存储过期时间,过期后删除,默认30天 | 15 | | mj.notify-hook | 否 | 全局的任务状态变更回调地址 | 16 | | mj.notify-notify-pool-size | 否 | 通知回调线程池大小,默认10 | 17 | | mj.proxy.host | 否 | 代理host,全局代理不生效时设置 | 18 | | mj.proxy.port | 否 | 代理port,全局代理不生效时设置 | 19 | | mj.ng-discord.server | 否 | https://discord.com 反代地址 | 20 | | mj.ng-discord.cdn | 否 | https://cdn.discordapp.com 反代地址 | 21 | | mj.ng-discord.mj-says-server | 否 | https://936929561302675456.discordsays.com 反代,用于局部重绘(该地址可能不需要反代,先自行测试) | 22 | | mj.ng-discord.upload-server | 否 | https://discord-attachments-uploads-prd.storage.googleapis.com 反代,用于上传文件 | 23 | | mj.ng-discord.wss | 否 | wss://gateway.discord.gg 反代地址 | 24 | | mj.ng-discord.resume-wss | 否 | wss://gateway-us-east1-b.discord.gg 反代地址 | 25 | | mj.translate-way | 否 | 中文prompt翻译成英文的方式,可选null(默认)、baidu、gpt、deepl | 26 | | mj.translate-zh-way | 否 | describe、shorten等结果转中文的方式,可选null(默认)、baidu、gpt、deepl | 27 | | mj.baidu-translate.appid | 否 | 百度翻译的appid | 28 | | mj.baidu-translate.app-secret | 否 | 百度翻译的app-secret | 29 | | mj.openai.gpt-api-url | 否 | 自定义gpt的接口地址,默认不需要配置 | 30 | | mj.openai.gpt-api-key | 否 | gpt的api-key | 31 | | mj.openai.timeout | 否 | openai调用的超时时间,默认30秒 | 32 | | mj.openai.model | 否 | openai的模型,默认gpt-3.5-turbo | 33 | | mj.openai.max-tokens | 否 | 返回结果的最大分词数,默认2048 | 34 | | mj.openai.temperature | 否 | 相似度(0-2.0),默认0 | 35 | | mj.deepl-translate.auth-key | 否 | DEEPL翻译的鉴权密钥 | 36 | | mj.error-desc | 否 | 任务错误原因转换,默认使用mj提供的英文描述 | 37 | | spring.redis | 否 | 存储方式设置为redis,需配置redis相关属性 | 38 | 39 | ### 账号池配置参考 40 | ```yaml 41 | mj: 42 | accounts: 43 | - guild-id: xxx 44 | channel-id: xxx 45 | user-token: xxxx 46 | mj-bot-channel-id: xxxx 47 | user-agent: xxxx 48 | - guild-id: xxx 49 | channel-id: xxx 50 | user-token: xxxx 51 | mj-bot-channel-id: xxxx 52 | user-agent: xxxx 53 | ``` 54 | 账号字段说明 55 | 56 | | 名称 | 非空 | 描述 | 57 | |:------------------| :----: |:--------------------------------------------------------------------| 58 | | guild-id | 是 | discord服务器ID | 59 | | channel-id | 是 | discord频道ID | 60 | | user-token | 是 | discord用户Token | 61 | | mj-bot-channel-id | 否 | Midjourney Bot私信ID | 62 | | user-agent | 否 | 调用discord接口、连接wss时的user-agent,建议从浏览器network复制 | 63 | | enable | 否 | 是否可用,默认true | 64 | | remix-auto-submit | 否 | remix自动提交(默认false),共享账号无法自主控制remix模式时使用,自动提交reroll、variation、pan的弹框 | 65 | | core-size | 否 | 并发数,默认3 | 66 | | queue-size | 否 | 等待队列长度,默认10 | 67 | | timeout-minutes | 否 | 任务超时时间(分钟),默认5 | 68 | | remark | 否 | 备注说明 | 69 | 70 | ### spring.redis配置参考 71 | ```yaml 72 | spring: 73 | redis: 74 | host: 10.107.xxx.xxx 75 | port: 6379 76 | password: xxx 77 | ``` 78 | 79 | ### mysql配置参考 80 | 81 | ```shell 82 | # 启动myql服务 83 | docker run --name mysql8 --restart=always -p 3306:3306 -e MYSQL_ROOT_PASSWORD=novice123 -d mysql:8.0.23 84 | # 连接mysql 85 | mysql -uroot -pnovice123 86 | # 创建数据库,字符编码需为utf8mb4 87 | create database `mj_proxy` character set utf8mb4 collate utf8mb4_bin; 88 | ``` 89 | > 需要mysql8.0以上版本,注意用户名字段为 user 90 | ```yaml 91 | spring: 92 | datasource: 93 | driver-class-name: com.mysql.cj.jdbc.Driver 94 | url: jdbc:mysql://localhost:3306/mj_proxy?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&allowPublicKeyRetrieval=true&useSSL=false 95 | user: root 96 | password: novice123 97 | initial-size: 20 98 | min-idle: 10 99 | max-active: 50 100 | ``` 101 | 102 | ### mj.error-desc配置参考 103 | ```yaml 104 | mj: 105 | error-desc: 106 | - en: "against our community standards" 107 | zh: "可能包含违规信息" 108 | - en: "Request cancelled due to image filters" 109 | zh: "图片可能违规" 110 | ``` 111 | -------------------------------------------------------------------------------- /docs/api.md: -------------------------------------------------------------------------------- 1 | # API接口说明 2 | 3 | `http://ip:port/mj` 已有api文档,此处仅作补充 4 | 5 | ## 1. 数据结构 6 | 7 | ### 任务 8 | | 字段 | 类型 | 示例 | 描述 | 9 | |:-----:|:----:|:----|:-----------------------------------------------------------------------------------------------------------------------------| 10 | | id | string | 1689231405853400 | 任务ID | 11 | | action | string | IMAGINE | 任务类型: IMAGINE(绘图)、UPSCALE(放大)、VARIATION(变化)、ZOOM(图片变焦)、PAN(焦点移动)、DESCRIBE(图生文)、BLEND(图片混合)、SHORTEN(prompt分析)、SWAP_FACE(人脸替换) | 12 | | status | string | SUCCESS | 任务状态: NOT_START(未启动)、SUBMITTED(已提交处理)、MODAL(窗口等待)、IN_PROGRESS(执行中)、FAILURE(失败)、SUCCESS(成功)、CANCEL(已取消) | 13 | | prompt | string | 猫猫 | 提示词 | 14 | | promptEn | string | Cat | 英文提示词 | 15 | | description | string | /imagine 猫猫 | 任务描述 | 16 | | submitTime | number | 1689231405854 | 提交时间 | 17 | | startTime | number | 1689231442755 | 开始执行时间 | 18 | | finishTime | number | 1689231544312 | 结束时间 | 19 | | progress | string | 100% | 任务进度 | 20 | | imageUrl | string | https://cdn.discordapp.com/attachments/xxx/xxx/xxxx.png | 生成图片的url, 成功或执行中时有值,可能为png或webp | 21 | | failReason | string | [Invalid parameter] Invalid value | 失败原因, 失败时有值 | 22 | | properties | object | {"finalPrompt": "Cat"} | 任务的扩展属性,系统内部使用 | 23 | | buttons | Button[] | [] | 任务完成后的可执行按钮 | 24 | 25 | ### Button 26 | | 字段 | 类型 | 示例 | 描述 | 27 | |:---------|:----:|:----|:----| 28 | | customId | string | MJ::JOB::upsample::1::85a4b4c1-8835-46c5-a15c-aea34fad1862 | 动作标识 | 29 | | emoji | string | 🪄 | 图标 | 30 | | label | string | Make Variations | 文本 | 31 | | type | number | 2 | 类型,系统内部使用 | 32 | | style | number | 2 | 样式: 2(Primary)、3(Green) | 33 | 34 | ### properties 常见字段 35 | | 字段 | 类型 | 示例 | 描述 | 36 | |:---------------|:----:|:------------------------------------------|:---------------------------------------------| 37 | | botType | string | NIJI_JOURNEY | bot类型: MID_JOURNEY,NIJI_JOURNEY,INSIGHT_FACE | 38 | | discordInstanceId | string | 1118138338562560102 | 执行该任务的实例ID(频道ID) | 39 | | finalPrompt | string | Cat | 消息内容提取出的prompt | 40 | | messageId | string | 1174910863984033903 | 消息ID | 41 | | messageContent | string | `**Cat** - Image #1 <@590422081204912129>` | 消息内容 | 42 | 43 | ## 2. 任务提交返回 44 | - code=1: 提交成功,result为任务ID 45 | ```json 46 | { 47 | "code": 1, 48 | "description": "提交成功", 49 | "result": "14001929738841620", 50 | "properties": { 51 | "discordInstanceId": "1118138338562560102" 52 | } 53 | } 54 | ``` 55 | - code=22: 提交成功,进入队列等待 56 | ```json 57 | { 58 | "code": 22, 59 | "description": "排队中,前面还有1个任务", 60 | "result": "14001929738841620", 61 | "properties": { 62 | "numberOfQueues": 1, 63 | "discordInstanceId": "1118138338562560102" 64 | } 65 | } 66 | ``` 67 | - code=23: 队列已满,请稍后尝试 68 | ```json 69 | { 70 | "code": 23, 71 | "description": "队列已满,请稍后尝试", 72 | "result": "14001929738841620", 73 | "properties": { 74 | "discordInstanceId": "1118138338562560102" 75 | } 76 | } 77 | ``` 78 | - code=24: prompt包含敏感词 79 | ```json 80 | { 81 | "code": 24, 82 | "description": "可能包含敏感词", 83 | "properties": { 84 | "promptEn": "nude body", 85 | "bannedWord": "nude" 86 | } 87 | } 88 | ``` 89 | - other: 提交错误,description为错误描述 90 | 91 | ## 3. 执行任务的关联动作 92 | 调用 `/mj/submit/action`,几乎所有的button都做了支持,除了以下情况: 93 | - 图生文结果的 `🎉Imagine all` 94 | - 图片放大后的 `❤️` 95 | 96 | ```json 97 | { 98 | // 关联任务的ID 99 | "taskId": "1689216801333574", 100 | // 动作标识 101 | "customId": "MJ::JOB::reroll::0::1c6dff5e-5632-40c6-9d4c-afb261705313::SOLO" 102 | } 103 | ``` 104 | ⚠️ 注意: 某些场景需要modal弹框确认 105 | - 执行CustomZoom(自定义变焦) 106 | - 执行️Region(局部重绘) 107 | - 执行PicReader(Describe后选择生图) 108 | - 执行PromptAnalyzer(Shorten后选择生图) 109 | 110 | > 开启Remix模式时,执行Reroll、Variation、Pan也需要弹框确认;但账号设置了remix自动提交时,不需要确认 111 | 112 | 需要确认时返回的code为 21,示例: 113 | ```json 114 | { 115 | "code": 21, 116 | "description": "窗口等待", 117 | "result": "14001929738841620" 118 | } 119 | ``` 120 | 该任务状态为MODAL,但不会进队列影响并发。需调用`/mj/submit/modal`提交最终任务 121 | ```json 122 | { 123 | // 需确认的任务ID 124 | "taskId": "1689228047868174", 125 | // prompt: 为空时使用原任务的prompt 126 | "prompt": "Cat" 127 | } 128 | ``` 129 | - CustomZoom的prompt需要设置`--zoom`(1到2之间),例如: `Cat --zoom 1.5` 130 | - ️Vary (Region) 需要额外传`maskBase64`: 局部重绘的蒙版base64(底色纯黑,选中区域纯白) 131 | 132 | ## 4. `/mj/submit/describe` 图生文 133 | ```json 134 | { 135 | // 图片的base64字符串 136 | "base64": "data:image/png;base64,xxx" 137 | } 138 | ``` 139 | 140 | 后续任务完成后,properties中finalPrompt即为图片生成的prompt,finalZhPrompt为翻译的中文 141 | ```json 142 | { 143 | "id":"14001929738841620", 144 | "action":"DESCRIBE", 145 | "status": "SUCCESS", 146 | "description":"/describe 14001929738841620.png", 147 | "imageUrl":"https://cdn.discordapp.com/attachments/xxx/xxx/14001929738841620.png", 148 | "properties": { 149 | "finalPrompt": "1️⃣ Cat --ar 5:4\n\n2️⃣ Cat2 --ar 5:4\n\n3️⃣ Cat3 --ar 5:4\n\n4️⃣ Cat4 --ar 5:4", 150 | "finalZhPrompt": "1️⃣ 猫 --ar 5:4\n\n2️⃣ 猫2 --ar 5:4\n\n3️⃣ 猫3 --ar 5:4\n\n4️⃣ 猫4 --ar 5:4" 151 | } 152 | // ... 153 | } 154 | ``` 155 | 156 | ## 5. `/mj/submit/shorten` prompt分析 157 | ```json 158 | { 159 | "prompt": "️appdash appdash, in the style of expert draftsmanship, commission for, ethereal, dreamlike quality, dadaistic, toonami" 160 | } 161 | ``` 162 | 163 | 后续任务完成后,properties中finalPrompt即为分析结果,finalZhPrompt为翻译的中文 164 | ```json 165 | { 166 | "id":"1689252749098647", 167 | "action":"SHORTEN", 168 | "status": "SUCCESS", 169 | "description":"/shorten appdash appdash, in the style of expert draftsmanship, commission for, ethereal, dreamlike quality, dadaistic, toonami", 170 | "properties": { 171 | "finalPrompt": "## Important tokens\n**appdash** **appdash**, in the ~~style~~ of ~~expert~~ **draftsmanship**, commission for, ethereal, dreamlike quality, ~~dadaistic~~, **toonami**\n## Shortened prompts\n1️⃣ appdash appdash, draftsmanship, commission for, ethereal, toonami\n\n2️⃣ appdash appdash, draftsmanship, commission, toonami\n\n3️⃣ appdash appdash, draftsmanship, toonami\n\n4️⃣ appdash appdash, toonami\n\n5️⃣ appdash appdash", 172 | "finalZhPrompt": "## 重要词汇\n**appdash** **appdash**,以专家的绘画风格,委托制作,飘渺的,梦幻般的质感,达达主义的,**toonami**\n## 简化提示\n1️⃣ appdash appdash,绘画风格,委托制作,飘渺的,toonami\n\n2️⃣ appdash appdash,绘画风格,委托制作,toonami\n\n3️⃣ appdash appdash,绘画风格,toonami\n\n4️⃣ appdash appdash,toonami\n\n5️⃣ appdash appdash" 173 | } 174 | // ... 175 | } 176 | ``` 177 | 对该任务执行 `Show Details` 动作,能获得进一步的分析结果 178 | ```json 179 | { 180 | "id":"1689253263953453", 181 | "action":"SHORTEN", 182 | "status": "SUCCESS", 183 | "description":"/up 168925266642808397 Show Details", 184 | "properties": { 185 | "finalPrompt": "## Important tokens\n**appdash** (1.00) **appdash** (0.79), in the style (0.01) of expert (0.00) **draftsmanship** (0.09), commission (0.08) for, ethereal (0.05), dreamlike (0.02) quality (0.01), dadaistic (0.01), **toonami** (0.19)\n\n██████████ appdash\n████████░░ appdash\n██░░░░░░░░ toonami\n█░░░░░░░░░ draftsmanship\n█░░░░░░░░░ commission\n█░░░░░░░░░ ethereal\n## Shortened prompts\n1️⃣ appdash appdash, draftsmanship, commission for, ethereal, toonami\n\n2️⃣ appdash appdash, draftsmanship, commission, toonami\n\n3️⃣ appdash appdash, draftsmanship, toonami\n\n4️⃣ appdash appdash, toonami\n\n5️⃣ appdash app", 186 | "finalZhPrompt": "## 重要的词语\n**appdash** (1.00) **appdash** (0.79),以专家级(0.01) **绘画技巧** (0.09) 的风格,委托(0.08) 制作,飘渺的(0.05),梦幻般的(0.02) 质感(0.01),达达主义的(0.01),**toonami** (0.19)\n\n██████████ appdash\n████████░░ appdash\n██░░░░░░░░ toonami\n█░░░░░░░░░ draftsmanship\n█░░░░░░░░░ commission\n█░░░░░░░░░ ethereal\n## 简化的提示\n1️⃣ appdash appdash,绘画技巧,委托制作,飘渺,toonami\n\n2️⃣ appdash appdash,绘画技巧,委托制作,toonami\n\n3️⃣ appdash appdash,绘画技巧,toonami\n\n4️⃣ appdash appdash,toonami\n\n5️⃣ appdash appdash" 187 | } 188 | // ... 189 | } 190 | ``` 191 | 192 | ## 6. 获取任务图片的seed 193 | 194 | 绘图任务执行后,不会设置seed,如需获取seed,需要执行 `/mj/task/{id}/image-seed` 195 | 196 | ⚠️ 注意: 必须配置账号的Midjourney Bot私信ID,否则无法调用 197 | 198 | - code=1: 获取成功,result为图片对应的seed 199 | ```json 200 | { 201 | "code": 1, 202 | "description": "成功", 203 | "result": "636646138" 204 | } 205 | ``` 206 | - other: 执行错误,description为错误描述 207 | 208 | ## 7. 任务变更回调 209 | 任务状态变化或进度改变时,会调用业务系统的接口 210 | - 接口地址为配置的 mj.notify-hook,任务提交时支持传`notifyHook`以改变此任务的回调地址 211 | - 两者都为空时,不触发回调 212 | 213 | POST application/json 214 | ```json 215 | { 216 | "id": "14001929738841620", 217 | "action": "IMAGINE", 218 | "status": "SUCCESS", 219 | "prompt": "猫猫", 220 | "promptEn": "Cat", 221 | "description": "/imagine 猫猫", 222 | "submitTime": 1689231405854, 223 | "startTime": 1689231442755, 224 | "finishTime": 1689231544312, 225 | "progress": "100%", 226 | "imageUrl": "https://cdn.discordapp.com/attachments/xxx/xxx/xxxx.png", 227 | "failReason": null, 228 | "properties": { 229 | "finalPrompt": "Cat" 230 | }, 231 | "buttons": [] 232 | } 233 | ``` 234 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------