Skip to content

Commit

Permalink
feat: 发布2.0,适配midjourney-proxy2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
zhukai committed May 29, 2023
1 parent 1a374cc commit 5f6b8ab
Show file tree
Hide file tree
Showing 14 changed files with 467 additions and 336 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,4 @@ config.yaml
.vscode

data/
.DS_Store
93 changes: 49 additions & 44 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,55 +1,60 @@
FROM node:18.16.0

WORKDIR /app
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list && \
sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

RUN apt-get update \
&& apt-get install -y ca-certificates \
&& apt-get install -y fonts-liberation \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm-dev \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
lsb-release \
wget \
xdg-utils \
libnss3 \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
ca-certificates \
fonts-liberation \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm-dev \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
lsb-release \
wget \
xdg-utils \
libnss3 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app

COPY package*.json ./

RUN npm install
RUN npm config set registry https://registry.npm.taobao.org && npm install

COPY . .
RUN cp .env.example .env
RUN cp /app/config/.env.example /app/config/.env

VOLUME ["/app/config"]

EXPOSE 4120

Expand Down
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,44 @@
## 注意事项
- 依赖 [midjourney-proxy](https://github.com/novicezk/midjourney-proxy) 提供的api接口
- 仅作为midjourney-proxy项目的示例应用场景,有问题需自行解决
- 推荐使用docker启动;mac M或其他arm架构电脑,暂时使用npm启动

## 快速启动

1. 下载镜像
```shell
docker pull novicezk/wechat-midjourney:1.0.1
docker pull novicezk/wechat-midjourney:2.0
```
2. 启动容器,并设置参数
2. 启动容器
```shell
# /xxx/xxx/config目录下创建.env和sensitive_words.txt
docker run -d --name wechat-midjourney \
-p 4120:4120 \
-v /xxx/xxx/config:/app/config \
--restart=always \
novicezk/wechat-midjourney:2.0

# 或启动时添加配置
docker run -d --name wechat-midjourney \
-p 4120:4120 \
-e MJ_PROXY_ENDPOINT=http://172.17.0.1:8080/mj \
-e MJ_NOFIFY_HOOK=http://172.17.0.1:4120/notify \
--restart=always \
novicezk/wechat-midjourney:1.0.1
novicezk/wechat-midjourney:2.0
```

3. 查看启动日志,微信扫描二维码,若二维码无法扫码,复制二维码链接浏览器打开扫码
```shell
docker logs -f -n 200 wechat-midjourney
```
## npm启动
```shell
git clone [email protected]:novicezk/wechat-midjourney.git
cd wechat-midjourney.git
cd wechat-midjourney
npm install
# 可能执行错误,缺少library,按提示解决
cp .env.example .env
cp config/.env.example config/.env
# 更改配置项,启动服务
npm run serve
```
Expand All @@ -41,5 +52,5 @@ npm run serve
| 变量名 | 非空 | 描述 |
| :-----| :----: | :---- |
| MJ_PROXY_ENDPOINT || midjourney代理服务的地址 |
| BLOCK_WORDS | | 敏感词,英文逗号分隔 |

| MJ_NOFIFY_HOOK | | 当前服务的回调接收地址 |
| HTTP_PROXY || http代理地址 |
2 changes: 2 additions & 0 deletions config/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MJ_PROXY_ENDPOINT="http://localhost:8080/mj"
MJ_NOFIFY_HOOK="http://localhost:4120/notify"
5 changes: 5 additions & 0 deletions config/sensitive_words.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
转法轮
自焚
吸毒
贩毒
赌博
Loading

0 comments on commit 5f6b8ab

Please sign in to comment.