# wechat-chatgpt
**Repository Path**: web1002/wechat-chatgpt
## Basic Information
- **Project Name**: wechat-chatgpt
- **Description**: wechat-chatgpt 方便大家使用
https://github.com/fuergaosi233/wechat-chatgpt
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 20
- **Created**: 2023-03-16
- **Last Updated**: 2023-03-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
欢迎使用 wechat-chatgpt 👋
> 在微信上迅速接入 ChatGPT,让它成为你最好的助手!
> [English](README.md) | 中文文档
[](https://railway.app/template/dMLG70?referralCode=bIYugQ)
## 🌟 功能点
- [x] 通过 [wechaty](https://github.com/wechaty/wechaty) 和 [官方 API](https://openai.com/blog/introducing-chatgpt-and-whisper-apis),将 ChatGPT 接入微信
- [x] 加入了持续对话的功能
- [x] 加入 Dockerfile, 通过 [Docker](#通过docker使用-推荐) 进行部署
- [x] 发布到 Docker.hub
- [x] 使用[docker compose](#通过docker-compose使用-推荐)进行部署
- [x] 通过 Railway 进行部署
## 🚀 使用
- [在 Railway 部署](#使用railway进行部署)(PaaS, 免费, 稳定, ✅推荐)
- [在 Fly.io 部署](#通过flyio进行部署)(PaaS, 免费, ✅推荐)
- [使用 Docker 部署](#通过docker使用)(自托管, 稳定, ✅推荐)
- [使用 Docker Compose 部署](#通过docker-compose使用)(自托管, 稳定, ✅推荐)
- [使用 NodeJS 部署](#使用nodejs运行)
## 使用Railway进行部署
> Railway 是一个免费的 PaaS 平台,5刀以内的账单免费或者每个月500小时的运行时间
1. 点击 [Railway](https://railway.app/template/dMLG70?referralCode=bIYugQ) 按钮,进入 Railway 部署页面
2. 点击 `Deploy Now` 按钮,进入 Railway 部署页面
3. 填写 仓库名称和 `OPENAI_API_KEY`(需要连接 GitHub 账号)
4. 点击 `Deploy` 按钮
5. 点击 `View Logs` 按钮,等待部署完成
## 通过Fly.io进行部署
> 请为应用程序分配 512 MB 内存,否则可能会出现内存溢出
> Fly.io 5刀以内的账单免费(免费计划的3个256MB的应用不在账单内)也就是可以同时可以部署 `1*512MB + 3*256MB`
1. 安装 [flyctl](https://fly.io/docs/getting-started/installing-flyctl/)
```shell
# macOS
brew install flyctl
# Windows
scoop install flyctl
# Linux
curl https://fly.io/install.sh | sh
```
2. 克隆项目并进入项目目录
```shell
git clone https://github.com/fuergaosi233/wechat-chatgpt.git && cd wechat-chatgpt
```
3. 创建应用
```shell
➜ flyctl launch
? Would you like to copy its configuration to the new app? No
? App Name (leave blank to use an auto-generated name):
? Select region:
? Would you like to setup a Postgresql database now? No
? Would you like to deploy now? No
```
4. 配置环境变量
```shell
flyctl secrets set OPENAI_API_KEY="" MODEL=""
```
5. 部署应用
```shell
flyctl deploy
```
## 通过Docker使用
```sh
# 拉取镜像
docker pull holegots/wechat-chatgpt:latest
# 运行容器
docker run -it --name wechat-chatgpt \
-e OPENAI_API_KEY= \
-e MODEL="gpt-3.5-turbo" \
-e CHAT_PRIVATE_TRIGGER_KEYWORD="" \
-v $(pwd)/data:/app/data/wechat-assistant.memory-card.json \
holegots/wechat-chatgpt:latest
# 使用二维码登陆
docker logs -f wechat-chatgpt
```
> 如何获取 OPENAI API KEY?请参考 [OpenAI API](https://platform.openai.com/account/api-keys)。
## 通过docker compose使用
```sh
# 根据模板拷贝配置文件
cp .env.example .env
# 使用你喜欢的文本编辑器修改配置文件
vim .env
# 在Linux或WindowsPowerShell上运行如下命令
docker compose up -d
# 使用二维码登陆
docker logs -f wechat-chatgpt
```
## 使用NodeJS运行
> 请确认安装的NodeJS版本为18.0.0以上
```sh
# 克隆项目
git clone https://github.com/fuergaosi233/wechat-chatgpt.git && cd wechat-chatgpt
# 安装依赖
npm install
# 编辑配置
cp .env.example .env
vim .env # 使用你喜欢的文本编辑器修改配置文件
# 启动项目
npm run dev
# 如果您是初次登陆,那么需要扫描二维码
```
> 请确保您的账号可以登陆 [网页版微信](https://wx.qq.com/)。
## ✨ Contributor
## 🤝 为项目添砖加瓦
欢迎提出 Contributions, issues 与 feature requests!
随时查看 [issues page](https://github.com/fuergaosi233/wechat-chatgpt/issues).
## 感谢支持 🙏
如果这个项目对你产生了一点的帮助,请为这个项目点上一颗 ⭐️