diff --git a/README.md b/README.md index 8153df2..3460afe 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,14 @@ ### 🏠 [Homepage](https://github.com/fuergaosi233/wechat-chatgpt) ## 🌟 Feature + - [x] Use ChatGPT On Wechat via wechaty - [x] Support OpenAI Accounts Pool - [x] Support use proxy to login -- [X] Simulated at message receive -- [X] Add conversation Support (Everyone will have their own session) -- [X] Add Dockerfile -- [X] Publish to Docker.hub -- [ ] Add Raiway deploy +- [x] Add conversation Support (Everyone will have their own session) +- [x] Add Dockerfile +- [x] Publish to Docker.hub +- [ ] Add Railway deploy - [ ] Auto Reload OpenAI Accounts Pool - [ ] Add sendmessage retry for 429/503 @@ -42,16 +42,24 @@ npm install && poetry install ``` ## Usage with manual + ### Copy config + You need copy config file for setting up your project. + ```sh cp config.yaml.example config.yaml ``` + ### Get and config Openai account + > If you don't have this OpenAI account and you live in China, you can get it [here](https://mirror.xyz/boxchen.eth/9O9CSqyKDj4BKUIil7NC1Sa1LJM-3hsPqaeW_QjfFBc). + #### **A:Use account and password** + You need get OpenAI account and password. Your config.yaml should be like this: + ```yaml chatGPTAccountPool: - email: @@ -59,40 +67,49 @@ chatGPTAccountPool: # if you hope only some keywords can trigger chatgpt on private chat, you can set it like this: chatPrivateTiggerKeyword: "" ``` + ⚠️ Trigger keywords must appear in the first position of the received message. ⚠️ Pls make sure your network can log in to OpenAI, and if you fail to login in try setting up a proxy or using SessionToken. **Setup proxy:** + ```sh export http_proxy= ``` + #### **B: Use Session Token** -If you cant use email and password to login your openai account or your network can't login, you can use session token. You need to follow these steps: + +If you cant use email and password to login your openai account or your network can't login, you can use session token. You need to follow these steps: + 1. Go to https://chat.openai.com/chat and log in or sign up. 2. Open dev tools. 3. Open Application > Cookies. -![image](docs/images/session-token.png) -4. Copy the value for __Secure-next-auth.session-token and save it to your config -Your config.yaml should be like this: + ![image](docs/images/session-token.png) +4. Copy the value for \_\_Secure-next-auth.session-token and save it to your config + Your config.yaml should be like this: + ```yaml chatGPTAccountPool: - session_token: ``` ### Start Project + ```sh npm run dev ``` + If you are logging in for the first time, then you need to scan the qrcode. + ## Author 👤 **holegots** -* Twitter: [@fuergaosi](https://twitter.com/fuergaosi) -* GitHub: [@fuergaosi233](https://github.com/fuergaosi233) +- Twitter: [@fuergaosi](https://twitter.com/fuergaosi) +- GitHub: [@fuergaosi233](https://github.com/fuergaosi233) ## 🤝 Contributing -Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/fuergaosi233/wechat-chatgpt/issues). +Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/fuergaosi233/wechat-chatgpt/issues). ## Show your support diff --git a/README_ZH.md b/README_ZH.md new file mode 100644 index 0000000..98b5648 --- /dev/null +++ b/README_ZH.md @@ -0,0 +1,117 @@ +

欢迎使用 wechat-chatgpt 👋

+

+ Version + + License: ISC + + + Twitter: fuergaosi + +

+ +> 在微信上迅速接入 ChatGPT,让它成为你最好的助手! + +### 🏠 [主页](https://github.com/fuergaosi233/wechat-chatgpt/blob/main/README_ZH.md) + +## 🌟 功能点 + +- [x] 通过 wechaty,将 ChatGPT 接入微信 +- [x] 创建 OpenAI 的账户池 +- [x] 支持通过代理登陆 OpenAI +- [x] 加入了持续对话的功能(每一个微信用户都保持自己的对话上下文) +- [x] 加入 Dockerfile +- [x] 发布到 Docker.hub +- [ ] 通过 Railway 进行部署 +- [ ] 实现 OpenAI 账户池的热加载 +- [ ] 当 OpenAI 返回码为 429/503 时自动重试 + +## 通过 Docker 使用(✅ 推荐) + +```sh +cp config.yaml.example config.yaml +# Change Config.yaml +docker run -d --name wechat-chatgpt -v $(pwd)/config.yaml:/app/config.yaml holegots/wechat-chatgpt:latest +# 使用二维码登陆 +docker logs -f wechat-chatgpt +``` + +## 安装 + +```sh +npm install && poetry install +``` + +## 手动安装 + +### 复制配置文件 + +将配置文件复制一份以配置您的项目 + +```sh +cp config.yaml.example config.yaml +``` + +### 获取 OpenAI 的账户并配置到项目中 + +> 如果你没有 OpenAI 的账号,并且您在无法访问 OpenAI 的国家或地区,你可以查看[here](https://mirror.xyz/boxchen.eth/9O9CSqyKDj4BKUIil7NC1Sa1LJM-3hsPqaeW_QjfFBc). + +#### **配置方法 A:使用账号密码** + +可以在配置文件中输入你的账号密码,格式如下 + +```yaml +chatGPTAccountPool: + - email: + password: +# 如果你希望只有一些关键字可以在私人聊天中触发chatgpt,你可以这样设置: +chatPrivateTiggerKeyword: "" +``` + +⚠️ 触发关键字必须出现在接收到的消息的第一个位置 +⚠️ + +请确保您的终端网络可以登陆 OpenAI。如果登陆失败,请尝试使用代理或使用 SessionToken 方法配置 + +**设置代理:** + +```sh +export http_proxy= +``` + +#### **B: 使用 Session Token** + +如果您无法使用账号密码登陆您的 OpenAI 账户,或者您的终端网络不支持连接到 OpenAI,那么您可以尝试使用 Session Token,请根据如下指示获取: + +1. 前往 https://chat.openai.com/chat 并登陆。 +2. 按下 F12 打开开发者工具. +3. 点击 Application 选项卡 > Cookies. + ![image](docs/images/session-token.png) +4. 复制 \_\_Secure-next-auth.session-token 的值,并且以如下方式配置到您的项目中: + +```yaml +chatGPTAccountPool: + - session_token: +``` + +### 启动项目 + +```sh +npm run dev +``` + +如果您是初次登陆,那么需要扫描二维码 + +## 作者 + +👤 **holegots** + +- Twitter: [@fuergaosi](https://twitter.com/fuergaosi) +- GitHub: [@fuergaosi233](https://github.com/fuergaosi233) + +## 🤝 为项目添砖加瓦 + +欢迎提出 Contributions, issues 与 feature requests!
随时查看 [issues page](https://github.com/fuergaosi233/wechat-chatgpt/issues). + +## 感谢支持 🙏 + +如果这个项目对你产生了一点的帮助,请为这个项目点上一颗 ⭐️