Skip to content

Commit

Permalink
feat: 完善功能
Browse files Browse the repository at this point in the history
  • Loading branch information
zhukai committed Apr 26, 2023
1 parent 994c393 commit 8e31251
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MJ_PROXY_ENDPOINT="http://localhost:8022/mj"
BLOCK_WORDS="测试"
MJ_PROXY_ENDPOINT="http://localhost:8080/mj"
BLOCK_WORDS="测试,测试一"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## 快速启动
1. 下载项目
2. `cp .env.example .env`并更改
2. `cp .env.example .env`并更改配置项
3. 启动项目
```sh
npm install
Expand All @@ -18,5 +18,5 @@ npm run dev
4. 微信扫码登录

## .env 配置项
- MJ_PROXY_ENDPOINT: midjourney代理服务的地址
- BLOCK_WORDS: 敏感词,英文逗号分隔
- `MJ_PROXY_ENDPOINT` midjourney代理服务的地址
- `BLOCK_WORDS` 敏感词,英文逗号分隔
7 changes: 3 additions & 4 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ export class Bot {
+ "1.解释:附加参数指的是在prompt后携带的参数,可以使你的绘画更加别具一格\n"
+ "· 输入 /imagine prompt --v 5 --ar 16:9\n"
+ "2.使用:需要使用--key value ,key和value之间需要空格隔开,每个附加参数之间也需要空格隔开\n"
+ "3.详解:上述附加参数解释 版本 5,比例 16:9\n"
+ "------------------------------\n"
+ "📗 附加参数列表\n"
+ "1.(--version) 或 (--v) 《版本》 参数 1,2,3,4,5 默认5,不可与niji同用\n"
+ "2.(--niji)《卡通版本》 参数 空或 5 默认空,不可与版本同用\n"
+ "3.(--aspect) 或 (--ar) 《横纵比》 参数 n:n ,默认1:1 ,不通版本略有差异,具体详见机器人提示\n"
+ "3.(--aspect) 或 (--ar) 《横纵比》 参数 n:n ,默认1:1\n"
+ "4.(--chaos) 或 (--c) 《噪点》参数 0-100 默认0\n"
+ "5.(--quality) 或 (--q) 《清晰度》参数 .25 .5 1 2 分别代表,一般,清晰,高清,超高清,默认1\n"
+ "6.(--style) 《风格》参数 4a,4b,4c (v4)版本可用,参数 expressive,cute (niji5)版本可用\n"
Expand All @@ -58,8 +57,8 @@ export class Bot {
return;
}
let text = rawText;
if (rawText.startsWith(`@${this.botName} `)) {
text = rawText.substring(this.botName.length + 2);
if (text.startsWith(`@${this.botName} `)) {
text = text.substring(this.botName.length + 2);
}
if (isProhibited(text)) {
const content = `@${talkerName} \n❌ 任务被拒绝,可能包含违禁词`;
Expand Down
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ app.post("/notify", async (req: Request, res: Response): Promise<Response> => {
if (status == 'IN_PROGRESS') {
room.say(`@${userName} \n✅ 您的任务已提交\n✨ ${description}\n🚀 正在快速处理中,请稍后`);
} else if (status == 'FAILURE') {
room.say(`@${userName} \n❌ 执行失败\n✨ ${description}`);
room.say(`@${userName} \n❌ 任务执行失败\n✨ ${description}`);
} else if (status == 'SUCCESS') {
const time = req.body.finishDate - req.body.submitDate;
const time = req.body.finishTime - req.body.submitTime;
if (action == 'UPSCALE') {
await room.say(`@${userName} \n🎨 图片放大,用时: ${displayMilliseconds(time)}\n✨ ${description}`);
const image = FileBox.fromUrl(req.body.imageUrl);
room.say(image);
} else {
const taskId = req.body.id;
const prompt = req.body.prompt;
await room.say(`@${userName} \n🎨 ${action == 'IMAGINE' ? '绘图' : '变换'}成功,用时: ${displayMilliseconds(time)}\n✨ Prompt: ${prompt}\n📨 任务ID: ${taskId}\n🪄 放大 U1~U4 ,变换 V1~V4\n✏️ 使用[/up 任务ID 操作]\n/up ${taskId} U1`);
await room.say(`@${userName} \n🎨 ${action == 'IMAGINE' ? '绘图' : '变换'}成功,用时 ${displayMilliseconds(time)}\n✨ Prompt: ${prompt}\n📨 任务ID: ${taskId}\n🪄 放大 U1~U4 ,变换 V1V4\n✏️ 使用[/up 任务ID 操作]\n/up ${taskId} U1`);
const image = FileBox.fromUrl(req.body.imageUrl);
room.say(image);
}
Expand Down

0 comments on commit 8e31251

Please sign in to comment.