Skip to content

Commit 4d7ce96

Browse files
author
刘志硕
committed
Merge remote-tracking branch 'upstream/main'
更新上游代码 # Conflicts: # README.md # docs/docker-start.md # pom.xml # src/main/java/com/github/novicezk/midjourney/controller/SubmitController.java
2 parents 946841e + f2b4010 commit 4d7ce96

40 files changed

+1041
-585
lines changed

README.md

Lines changed: 111 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# midjourney-proxy
1+
<div align="center">
22

3-
代理 MidJourney 的discord频道,实现api形式调用AI绘图
3+
<h1 align="center">midjourney-proxy</h1>
44

5+
<<<<<<< HEAD
56
[![GitHub release](https://img.shields.io/static/v1?label=release&message=v2.5.1&color=blue)](https://www.github.com/novicezk/midjourney-proxy)
67
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
78

@@ -26,18 +27,46 @@
2627
## 使用前提
2728
1. 注册并订阅 MidJourney,创建自己的频道,参考 https://docs.midjourney.com/docs/quick-start
2829
2. 获取用户Token、服务器ID、频道ID:[获取方式](./docs/discord-params.md)
30+
=======
31+
English | [中文](./README_CN.md)
2932

30-
## 快速启动
31-
1. `Railway`: 基于Railway平台,不需要自己的服务器: [部署方式](./docs/railway-start.md);若Railway不能使用,可使用Zeabur启动
32-
2. `Zeabur`: 基于Zeabur平台,不需要自己的服务器: [部署方式](./docs/zeabur-start.md)
33-
3. `Docker`: 在服务器或本地使用Docker启动: [部署方式](./docs/docker-start.md)
33+
Proxy the Discord channel for MidJourney to enable API-based calls for AI drawing
3434

35-
## 本地开发
36-
- 依赖java17和maven
37-
- 更改配置项: 修改src/main/application.yml
38-
- 项目运行: 启动ProxyApplication的main函数
39-
- 更改代码后,构建镜像: Dockerfile取消VOLUME的注释,执行 `docker build . -t midjourney-proxy`
35+
[![GitHub release](https://img.shields.io/static/v1?label=release&message=v2.6.2&color=blue)](https://www.github.com/novicezk/midjourney-proxy)
36+
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
37+
38+
</div>
39+
40+
## Main Functions
41+
42+
- [x] Supports Imagine instructions and related actions
43+
- [x] Supports adding image base64 as a placeholder when using the Imagine command
44+
- [x] Supports Blend (image blending) and Describe (image to text) commands
45+
- [x] Supports real-time progress tracking of tasks
46+
- [x] Supports translation of Chinese prompts, requires configuration of Baidu Translate or GPT
47+
- [x] Prompt sensitive word pre-detection, supports override adjustment
48+
- [x] User-token connects to WSS (WebSocket Secure), allowing access to error messages and full functionality
49+
- [x] Supports multi-account configuration, with each account able to set up corresponding task queues
50+
>>>>>>> upstream/main
51+
52+
**🚀 For more features, please refer to [midjourney-proxy-plus](https://github.com/litter-coder/midjourney-proxy-plus)**
53+
> - [x] Supports all the features of the open-source version
54+
> - [x] Supports Shorten (prompt analysis) command
55+
> - [x] Supports focus shifting: Pan ⬅️ ➡️ ⬆️ ⬇️
56+
> - [x] Supports image zooming: Zoom 🔍
57+
> - [x] Supports local redrawing: Vary (Region) 🖌
58+
> - [x] Supports nearly all associated button actions and the 🎛️ Remix mode
59+
> - [x] Supports retrieving the seed value of images
60+
> - [x] Account pool persistence, dynamic maintenance
61+
> - [x] Supports retrieving account /info and /settings information
62+
> - [x] Account settings configuration
63+
> - [x] Supports Niji bot robot
64+
> - [x] Supports InsightFace face replacement robot
65+
> - [x] Embedded management dashboard page
66+
67+
## Prerequisites for use
4068

69+
<<<<<<< HEAD
4170
## 配置项
4271
- mj.accounts: 参考 [账号池配置](./docs/config.md#%E8%B4%A6%E5%8F%B7%E6%B1%A0%E9%85%8D%E7%BD%AE%E5%8F%82%E8%80%83)
4372
- mj.task-store.type: 任务存储方式,默认in_memory(内存\重启后丢失),可选redis
@@ -54,8 +83,55 @@
5483
1. 作图频繁等行为,可能会触发midjourney账号警告,请谨慎使用
5584
2. 常见问题及解决办法见 [Wiki / FAQ](https://github.com/imkratos/midjourney-proxy/wiki/FAQ)
5685
3.[Issues](https://github.com/imkratos/midjourney-proxy/issues) 中提出其他问题或建议
86+
=======
87+
1. Register and subscribe to MidJourney, create `your own server and channel`, refer
88+
to https://docs.midjourney.com/docs/quick-start
89+
2. Obtain user Token, server ID, channel ID: [Method of acquisition](./docs/discord-params.md)
90+
91+
## Quick Start
92+
93+
1. `Railway`: Based on the Railway platform, no need for your own server: [Deployment method](./docs/railway-start.md) ;
94+
If Railway is not available, you can start using Zeabur instead.
95+
2. `Zeabur`: Based on the Zeabur platform, no need for your own server: [Deployment method](./docs/zeabur-start.md)
96+
3. `Docker`: Start using Docker on a server or locally: [Deployment method](./docs/docker-start.md)
97+
98+
## Local development
99+
100+
- Depends on Java 17 and Maven
101+
- Change configuration items: Edit src/main/resources/application.yml
102+
- Project execution: Start the main function of ProxyApplication
103+
- After changing the code, build the image: Uncomment VOLUME in the Dockerfile, then
104+
execute `docker build . -t midjourney-proxy`
105+
106+
## Configuration items
107+
108+
- mj.accounts: Refer
109+
to [Account pool configuration](./docs/config.md#%E8%B4%A6%E5%8F%B7%E6%B1%A0%E9%85%8D%E7%BD%AE%E5%8F%82%E8%80%83)
110+
- mj.task-store.type: Task storage method, default is in_memory (in memory, lost after restart), Redis is an alternative
111+
option.
112+
- mj.task-store.timeout: Task storage expiration time, tasks are deleted after expiration, default is 30 days.
113+
- mj.api-secret: API key, if left empty, authentication is not enabled; when calling the API, you need to add the
114+
request header 'mj-api-secret'.
115+
- mj.translate-way: The method for translating Chinese prompts into English, options include null (default), Baidu, or
116+
GPT.
117+
- For more configuration options, see [Configuration items](./docs/config.md)
57118

119+
## Related documentation
58120

121+
1. [API Interface Description](./docs/api.md)
122+
2. [Version Update Log](https://github.com/novicezk/midjourney-proxy/wiki/%E6%9B%B4%E6%96%B0%E8%AE%B0%E5%BD%95)
123+
124+
## Precautions
125+
126+
1. Frequent image generation and similar behaviors may trigger warnings on your Midjourney account. Please use with
127+
caution.
128+
2. For common issues and solutions, see [Wiki / FAQ](https://github.com/novicezk/midjourney-proxy/wiki/FAQ)
129+
3. Interested friends are also welcome to join the discussion group. If the group is full from scanning the code, you
130+
can add the administrator’s WeChat to be invited into the group. Please remark: mj join group.
131+
>>>>>>> upstream/main
132+
133+
134+
<<<<<<< HEAD
59135
## 应用项目
60136
依赖此项目且开源的,欢迎联系作者,加到此处展示
61137
- [wechat-midjourney](https://github.com/novicezk/wechat-midjourney) : 代理微信客户端,接入MidJourney,仅示例应用场景,不再更新
@@ -67,5 +143,29 @@
67143
如果觉得这个项目对你有所帮助,请帮忙点个star;也可以请作者喝杯茶~
68144

69145
<img src="https://raw.githubusercontent.com/imkratos/midjourney-proxy/main/docs/wxcode.png" width="220" alt="微信二维码"/>
146+
=======
147+
## Application Project
148+
149+
If you have a project that depends on this one and is open source, feel free to contact the author to be added here for
150+
display.
151+
152+
- [wechat-midjourney](https://github.com/novicezk/wechat-midjourney) : A proxy WeChat client that connects to
153+
MidJourney, intended only as an example application scenario, will no longer be updated.
154+
- [chatgpt-web-midjourney-proxy](https://github.com/Dooy/chatgpt-web-midjourney-proxy) : chatgpt web, midjourney,
155+
gpts,tts, whisper A complete UI solution
156+
- [chatnio](https://github.com/Deeptrain-Community/chatnio) : The next-generation AI one-stop solution for B/C end, an aggregated model platform with exquisite UI and powerful functions
157+
- [new-api](https://github.com/Calcium-Ion/new-api) : An API interface management and distribution system compatible with the Midjourney Proxy
158+
- [stable-diffusion-mobileui](https://github.com/yuanyuekeji/stable-diffusion-mobileui) : SDUI, based on this interface
159+
and SD (System Design), can be packaged with one click to generate H5 and mini-programs.
160+
- [MidJourney-Web](https://github.com/ConnectAI-E/MidJourney-Web) : 🍎 Supercharged Experience For MidJourney On Web UI
161+
162+
## Open API
163+
164+
Provides unofficial MJ/SD open API, add administrator WeChat for inquiries, please remark: api
165+
166+
## Others
167+
168+
If you find this project helpful, please consider giving it a star.
169+
>>>>>>> upstream/main
70170
71171
[![Star History Chart](https://api.star-history.com/svg?repos=novicezk/midjourney-proxy&type=Date)](https://star-history.com/#novicezk/midjourney-proxy&Date)

README_CN.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<div align="center">
2+
3+
<h1 align="center">midjourney-proxy</h1>
4+
5+
[English](./README.md) | 中文
6+
7+
代理 MidJourney 的discord频道,实现api形式调用AI绘图
8+
9+
[![GitHub release](https://img.shields.io/static/v1?label=release&message=v2.6.2&color=blue)](https://www.github.com/novicezk/midjourney-proxy)
10+
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
11+
12+
</div>
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+
**🚀 更多功能请查看 [midjourney-proxy-plus](https://github.com/litter-coder/midjourney-proxy-plus)**
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] 支持获取账号/info、/settings信息
34+
> - [x] 账号settings设置
35+
> - [x] 支持niji bot机器人
36+
> - [x] 支持InsightFace人脸替换机器人
37+
> - [x] 内嵌管理后台页面
38+
39+
## 使用前提
40+
1. 注册并订阅 MidJourney,创建`自己的服务器和频道`,参考 https://docs.midjourney.com/docs/quick-start
41+
2. 获取用户Token、服务器ID、频道ID:[获取方式](./docs/discord-params.md)
42+
43+
## 快速启动
44+
1. `Railway`: 基于Railway平台,不需要自己的服务器: [部署方式](./docs/railway-start.md);若Railway不能使用,可使用Zeabur启动
45+
2. `Zeabur`: 基于Zeabur平台,不需要自己的服务器: [部署方式](./docs/zeabur-start.md)
46+
3. `Docker`: 在服务器或本地使用Docker启动: [部署方式](./docs/docker-start.md)
47+
48+
## 本地开发
49+
- 依赖java17和maven
50+
- 更改配置项: 修改src/main/application.yml
51+
- 项目运行: 启动ProxyApplication的main函数
52+
- 更改代码后,构建镜像: Dockerfile取消VOLUME的注释,执行 `docker build . -t midjourney-proxy`
53+
54+
## 配置项
55+
- mj.accounts: 参考 [账号池配置](./docs/config.md#%E8%B4%A6%E5%8F%B7%E6%B1%A0%E9%85%8D%E7%BD%AE%E5%8F%82%E8%80%83)
56+
- mj.task-store.type: 任务存储方式,默认in_memory(内存\重启后丢失),可选redis
57+
- mj.task-store.timeout: 任务存储过期时间,过期后删除,默认30天
58+
- mj.api-secret: 接口密钥,为空不启用鉴权;调用接口时需要加请求头 mj-api-secret
59+
- mj.translate-way: 中文prompt翻译成英文的方式,可选null(默认)、baidu、gpt
60+
- 更多配置查看 [配置项](./docs/config.md)
61+
62+
## 相关文档
63+
1. [API接口说明](./docs/api.md)
64+
2. [版本更新记录](https://github.com/novicezk/midjourney-proxy/wiki/%E6%9B%B4%E6%96%B0%E8%AE%B0%E5%BD%95)
65+
66+
## 注意事项
67+
1. 作图频繁等行为,可能会触发midjourney账号警告,请谨慎使用
68+
2. 常见问题及解决办法见 [Wiki / FAQ](https://github.com/novicezk/midjourney-proxy/wiki/FAQ)
69+
3. 感兴趣的朋友也欢迎加入交流群讨论一下,扫码进群名额已满,加管理员微信邀请进群,备注: mj加群
70+
71+
<img src="https://raw.githubusercontent.com/novicezk/midjourney-proxy/main/docs/manager-qrcode.png" width="220" alt="微信二维码"/>
72+
73+
## 应用项目
74+
依赖此项目且开源的,欢迎联系作者,加到此处展示
75+
- [wechat-midjourney](https://github.com/novicezk/wechat-midjourney) : 代理微信客户端,接入MidJourney,仅示例应用场景,不再更新
76+
- [chatgpt-web-midjourney-proxy](https://github.com/Dooy/chatgpt-web-midjourney-proxy) : chatgpt web, midjourney, gpts,tts, whisper 一套ui全搞定
77+
- [chatnio](https://github.com/Deeptrain-Community/chatnio) : 下一代 AI 一站式 B/C 端解决方案, 集成精美 UI 和强大功能的聚合模型平台
78+
- [new-api](https://github.com/Calcium-Ion/new-api) : 接入Midjourney Proxy的接口管理 & 分发系统
79+
- [stable-diffusion-mobileui](https://github.com/yuanyuekeji/stable-diffusion-mobileui) : SDUI,基于本接口和SD,可一键打包生成H5和小程序
80+
- [MidJourney-Web](https://github.com/ConnectAI-E/MidJourney-Web) : 🍎 Supercharged Experience For MidJourney On Web UI
81+
82+
## 开放API
83+
提供非官方的MJ/SD开放API,添加管理员微信咨询,备注: api
84+
85+
## 其它
86+
如果觉得这个项目对您有所帮助,请帮忙点个star
87+
88+
[![Star History Chart](https://api.star-history.com/svg?repos=novicezk/midjourney-proxy&type=Date)](https://star-history.com/#novicezk/midjourney-proxy&Date)

docs/config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| mj.ng-discord.server || https://discord.com 反代地址 |
2121
| mj.ng-discord.cdn || https://cdn.discordapp.com 反代地址 |
2222
| mj.ng-discord.wss || wss://gateway.discord.gg 反代地址 |
23+
| mj.ng-discord.resume-wss || wss://gateway-us-east1-b.discord.gg 反代地址 |
2324
| mj.ng-discord.upload-server || https://discord-attachments-uploads-prd.storage.googleapis.com 反代地址 |
2425
| mj.translate-way || 中文prompt翻译成英文的方式,可选null(默认)、baidu、gpt |
2526
| mj.baidu-translate.appid || 百度翻译的appid |

docs/docker-start.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
docker run -d --name midjourney-proxy \
77
-p 8080:8080 \
88
-v /xxx/xxx/config:/home/spring/config \
9+
<<<<<<< HEAD
910
kratos1937/midjourney-proxy:v1.1.0
11+
=======
12+
novicezk/midjourney-proxy:2.6.2
13+
>>>>>>> upstream/main
1014
```
1115
3. 访问 `http://ip:port/mj` 查看API文档
1216

@@ -17,5 +21,9 @@ docker run -d --name midjourney-proxy \
1721
-e mj.discord.guild-id=xxx \
1822
-e mj.discord.channel-id=xxx \
1923
-e mj.discord.user-token=xxx \
24+
<<<<<<< HEAD
2025
kratos1937/midjourney-proxy:v1.1.0
26+
=======
27+
novicezk/midjourney-proxy:2.6.2
28+
>>>>>>> upstream/main
2129
```

pom.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
<parent>
88
<groupId>org.springframework.boot</groupId>
99
<artifactId>spring-boot-starter-parent</artifactId>
10-
<version>2.6.14</version>
10+
<version>2.6.15</version>
1111
</parent>
1212

1313
<groupId>com.github.novicezk</groupId>
1414
<artifactId>midjourney-proxy</artifactId>
15-
<version>2.5.4</version>
15+
<version>2.6.2</version>
1616

1717
<properties>
18-
<hutool.version>5.8.18</hutool.version>
19-
<org-json.version>20220924</org-json.version>
20-
<jda.version>5.0.0-beta.9</jda.version>
21-
<chatgpt-java.version>1.1.2-beta0</chatgpt-java.version>
18+
<hutool.version>5.8.26</hutool.version>
19+
<org-json.version>20240303</org-json.version>
20+
<jda.version>5.0.0-beta.21</jda.version>
21+
<chatgpt-java.version>1.1.5</chatgpt-java.version>
2222
<dataurl.version>2.0.0</dataurl.version>
2323
<knife4j.verison>4.1.0</knife4j.verison>
2424
<user-agent-utils.verison>1.21</user-agent-utils.verison>
@@ -37,6 +37,10 @@
3737
<groupId>org.springframework.boot</groupId>
3838
<artifactId>spring-boot-starter-data-redis</artifactId>
3939
</dependency>
40+
<dependency>
41+
<groupId>org.springframework</groupId>
42+
<artifactId>spring-websocket</artifactId>
43+
</dependency>
4044

4145
<dependency>
4246
<groupId>cn.hutool</groupId>

src/main/java/com/github/novicezk/midjourney/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ public final class Constants {
1717

1818
public static final String API_SECRET_HEADER_NAME = "mj-api-secret";
1919
public static final String DEFAULT_DISCORD_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36";
20+
21+
public static final String MJ_MESSAGE_HANDLED = "mj_proxy_handled";
2022
}

src/main/java/com/github/novicezk/midjourney/ProxyProperties.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ public static class NgDiscordConfig {
187187
* wss://gateway.discord.gg 反代.
188188
*/
189189
private String wss;
190+
/**
191+
* wss://gateway-us-east1-b.discord.gg 反代.
192+
*/
193+
private String resumeWss;
190194
/**
191195
* https://discord-attachments-uploads-prd.storage.googleapis.com 反代.
192196
*/

src/main/java/com/github/novicezk/midjourney/controller/SubmitController.java

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
import com.github.novicezk.midjourney.support.Task;
1919
import com.github.novicezk.midjourney.support.TaskCondition;
2020
import com.github.novicezk.midjourney.util.*;
21+
import com.github.novicezk.midjourney.util.BannedPromptUtils;
22+
import com.github.novicezk.midjourney.util.ConvertUtils;
23+
import com.github.novicezk.midjourney.util.MimeTypeUtils;
24+
import com.github.novicezk.midjourney.util.SnowFlake;
25+
import com.github.novicezk.midjourney.util.TaskChangeParams;
2126
import eu.maxschuster.dataurl.DataUrl;
2227
import eu.maxschuster.dataurl.DataUrlSerializer;
2328
import eu.maxschuster.dataurl.IDataUrlSerializer;
@@ -111,15 +116,6 @@ public SubmitResultVO change(@RequestBody SubmitChangeDTO changeDTO) {
111116
} else {
112117
description += " " + changeDTO.getAction().name().charAt(0) + changeDTO.getIndex();
113118
}
114-
if (TaskAction.UPSCALE.equals(changeDTO.getAction())) {
115-
TaskCondition condition = new TaskCondition().setDescription(description);
116-
Task existTask = this.taskStoreService.findOne(condition);
117-
if (existTask != null) {
118-
return SubmitResultVO.of(ReturnCode.EXISTED, "任务已存在", existTask.getId())
119-
.setProperty("status", existTask.getStatus())
120-
.setProperty("imageUrl", existTask.getImageUrl());
121-
}
122-
}
123119
Task targetTask = this.taskStoreService.get(changeDTO.getTaskId());
124120
if (targetTask == null) {
125121
return SubmitResultVO.fail(ReturnCode.NOT_FOUND, "关联任务不存在或已失效");
@@ -315,25 +311,36 @@ private Task newTask(BaseSubmitDTO base) {
315311
}
316312

317313
private String translatePrompt(String prompt) {
318-
if (TranslateWay.NULL.equals(this.properties.getTranslateWay()) || CharSequenceUtil.isBlank(prompt)) {
314+
if (TranslateWay.NULL.equals(this.properties.getTranslateWay()) || CharSequenceUtil.isBlank(prompt) || !this.translateService.containsChinese(prompt)) {
319315
return prompt;
320316
}
321-
List<String> imageUrls = new ArrayList<>();
322-
Matcher imageMatcher = Pattern.compile("https?://[a-z0-9-_:@&?=+,.!/~*'%$]+\\x20+", Pattern.CASE_INSENSITIVE).matcher(prompt);
323-
while (imageMatcher.find()) {
324-
imageUrls.add(imageMatcher.group(0));
325-
}
326317
String paramStr = "";
327318
Matcher paramMatcher = Pattern.compile("\\x20+-{1,2}[a-z]+.*$", Pattern.CASE_INSENSITIVE).matcher(prompt);
328319
if (paramMatcher.find()) {
329320
paramStr = paramMatcher.group(0);
330321
}
331-
String imageStr = CharSequenceUtil.join("", imageUrls);
332-
String text = prompt.substring(imageStr.length(), prompt.length() - paramStr.length());
322+
String promptWithoutParam = CharSequenceUtil.sub(prompt, 0, prompt.length() - paramStr.length());
323+
List<String> imageUrls = new ArrayList<>();
324+
Matcher imageMatcher = Pattern.compile("https?://[a-z0-9-_:@&?=+,.!/~*'%$]+\\x20+", Pattern.CASE_INSENSITIVE).matcher(promptWithoutParam);
325+
while (imageMatcher.find()) {
326+
imageUrls.add(imageMatcher.group(0));
327+
}
328+
String text = promptWithoutParam;
329+
for (String imageUrl : imageUrls) {
330+
text = CharSequenceUtil.replaceFirst(text, imageUrl, "");
331+
}
333332
if (CharSequenceUtil.isNotBlank(text)) {
334333
text = this.translateService.translateToEnglish(text).trim();
335334
}
336-
return imageStr + text + paramStr;
335+
if (CharSequenceUtil.isNotBlank(paramStr)) {
336+
Matcher paramNomatcher = Pattern.compile("-{1,2}no\\s+(.*?)(?=-|$)").matcher(paramStr);
337+
if (paramNomatcher.find()) {
338+
String paramNoStr = paramNomatcher.group(1).trim();
339+
String paramNoStrEn = this.translateService.translateToEnglish(paramNoStr).trim();
340+
paramStr = paramNomatcher.replaceFirst("--no " + paramNoStrEn + " ");
341+
}
342+
}
343+
return CharSequenceUtil.join("", imageUrls) + text + paramStr;
337344
}
338345

339346
}

0 commit comments

Comments
 (0)