Skip to content

Commit

Permalink
Merge pull request #87 from BoynChan/main
Browse files Browse the repository at this point in the history
add README_ZH.md. chinese readme doc
  • Loading branch information
fuergaosi233 authored Dec 9, 2022
2 parents 85c6b5a + 3dcb86a commit c0a860a
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 12 deletions.
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -42,57 +42,74 @@ 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: <your email>
password: <your password>
# 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=<Your 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: <your 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!<br />Feel free to check [issues page](https://github.com/fuergaosi233/wechat-chatgpt/issues).
Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/fuergaosi233/wechat-chatgpt/issues).

## Show your support

Expand Down
117 changes: 117 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<h1 align="center">欢迎使用 wechat-chatgpt 👋</h1>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
<a href="#" target="_blank">
<img alt="License: ISC" src="https://img.shields.io/badge/License-ISC-yellow.svg" />
</a>
<a href="https://twitter.com/fuergaosi" target="_blank">
<img alt="Twitter: fuergaosi" src="https://img.shields.io/twitter/follow/fuergaosi.svg?style=social" />
</a>
</p>

> 在微信上迅速接入 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: <your email>
password: <your password>
# 如果你希望只有一些关键字可以在私人聊天中触发chatgpt,你可以这样设置:
chatPrivateTiggerKeyword: ""
```
⚠️ 触发关键字必须出现在接收到的消息的第一个位置
⚠️
请确保您的终端网络可以登陆 OpenAI。如果登陆失败,请尝试使用代理或使用 SessionToken 方法配置
**设置代理:**
```sh
export http_proxy=<Your 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: <your session_token>
```
### 启动项目
```sh
npm run dev
```

如果您是初次登陆,那么需要扫描二维码

## 作者

👤 **holegots**

- Twitter: [@fuergaosi](https://twitter.com/fuergaosi)
- GitHub: [@fuergaosi233](https://github.com/fuergaosi233)

## 🤝 为项目添砖加瓦

欢迎提出 Contributions, issues 与 feature requests!<br />随时查看 [issues page](https://github.com/fuergaosi233/wechat-chatgpt/issues).

## 感谢支持 🙏

如果这个项目对你产生了一点的帮助,请为这个项目点上一颗 ⭐️

0 comments on commit c0a860a

Please sign in to comment.