Skip to content

Commit

Permalink
Merge pull request #1 from atorber/dev
Browse files Browse the repository at this point in the history
优化dockerfile
  • Loading branch information
atorber authored Aug 4, 2023
2 parents d6deb63 + 7c35c5d commit 874dd5d
Show file tree
Hide file tree
Showing 21 changed files with 1,860 additions and 804 deletions.
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
HTTP_PORT=9503
WS_PORT=9504
OPENAI_API_KEY=ADD_YOUR_VALUE
OPENAI_API_BASE_URL=https://api.openai-proxy.com
OPENAI_MODEL=gpt-3.5-turbo
OPENAI_ENDPOINT=https://api.openai-proxy.com/v1/chat/completions
ADMIN_ROOMID=ADD_YOUR_VALUE
ADMIN_WXID=ADD_YOUR_VALUE
BAIDUVOP_AK=ADD_YOUR_VALUE
BAIDUVOP_SK=ADD_YOUR_VALUE
WECHATY_PUPPET=wechaty-puppet-wechat4u
WECHATY_TOKEN=ADD_YOUR_VALUE
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,10 @@ dist
.yarn/install-state.gz
.pnp.*
package-lock.json
src/config.ts
.DS_Store
data/config.json
data/contactList.json
data/history.json
data/record.json
data/roomList.json
data/talk.json
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 使用官方Node.js 16镜像(包含基于Ubuntu的节点环境)
FROM node:16
FROM node:16-alpine

# 安装需要的软件
RUN apt-get update && \
Expand Down
87 changes: 22 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ WechatGPT是一个使用微信充当ChatGPT对话窗口的工具,目前已实现

## 启动项目

> 首先重命名src/config.ts.example为config.ts
> 首先重命名根目录下.env.example为.env
1.安装依赖及启动

Expand All @@ -33,64 +33,17 @@ npm start
修改配置文件可更换puppet及配置百度云语音转文字接口ak、sk

```
const baseConfig:BaseConfig = {
admin:{
name:'管理员信息',
items:{
roomid: {
name:'管理员群ID',
value:process.env['admin_roomid'] || '', // 管理群ID
},
wxid: {
name:'管理员微信ID',
value:process.env['admin_wxid'] || '', // 管理员微信ID
},
},
},
baiduvop: {
name: '百度云语音转文字服务',
items:{
ak: {
name:'Access Key',
value:process.env['baiduvop_ak'] || '', // 百度云语音转文字接口ak
},
sk: {
name:'Secret Key',
value:process.env['baiduvop_sk'] || '', // 百度云语音转文字接口sk
},
},
},
openai:{
name:'ChatGPT配置信息',
items:{
endpoint: {
name:'API地址',
value:process.env['openai_endpoint'] || 'https://api.openai-proxy.com', // openai api地址
},
key: {
name:'API密钥',
value:process.env['openai_key'] || '', // openai api密钥
},
},
},
wechaty: {
name:'Wechaty',
items:{
puppet: {
name:'Puppet名称',
value:process.env['wechaty_puppet'] || 'wechaty-puppet-wechat', // wechaty-puppet-padlocal、wechaty-puppet-service、wechaty-puppet-wechat、wechaty-puppet-wechat4u、wechaty-puppet-xp(运行npm run wechaty-puppet-xp安装)
},
token:{
name:'PuppetToken',
value: process.env['wechaty_token'] || '', // wechaty token
},
},
},
}
HTTP_PORT=9503
WX_PORT=9504
OPENAI_API_KEY=ADD_YOUR_VALUE
OPENAI_MODEL=gpt-3.5-turbo
OPENAI_ENDPOINT=https://api.openai-proxy.com
ADMIN_ROOMID=ADD_YOUR_VALUE
ADMIN_WXID=ADD_YOUR_VALUE
BAIDUVOP_AK=ADD_YOUR_VALUE
BAIDUVOP_SK=ADD_YOUR_VALUE
WECHATY_PUPPET=wechaty-puppet-wechat4u
WECHATY_TOKEN=ADD_YOUR_VALUE
```

> 百度云语音转文字接口开通详见官网 [语音转文字](https://ai.baidu.com/tech/speech?track=b6d7c141cb9ed59bcbbc91553767924a6c41a067cf9e9572)
Expand Down Expand Up @@ -156,12 +109,12 @@ brew install ffmpeg
```
docker run -d
--restart=always
--env wechaty_puppet="wechaty-puppet-wechat4u"
--env wechaty_token="wehcaty token"
--env baiduvop_ak="百度语音转文字服务ak"
--env baiduvop_ak="百度语音转文字服务sk"
--env admin_wxid="管理员微信ID"
--env openai_key="你的openai api key"
--env WECHATY_PUPPET="wechaty-puppet-wechat4u"
--env WECHATY_TOKEN="wehcaty token"
--env BAIDUVOP_AK="百度语音转文字服务ak"
--env BAIDUVOP_AK="百度语音转文字服务sk"
--env ADMIN_WXID="管理员微信ID"
--env OPENAI_API_KEY="你的openai api key"
atorber/wechatgpt:v0.8.2
```

Expand Down Expand Up @@ -209,6 +162,10 @@ atorber/wechatgpt:v0.8.2

## 更新日志

v0.11.0

- 没有新增功能,优化为使用.env配置全局环境变量

v0.8.1

- 通过在群或好友私聊中发送 #开通 开通chatgpt聊天
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WechatGPT",
"version": "0.10.0",
"version": "0.11.1",
"description": "wechat & chatgpt",
"type": "module",
"engines": {
Expand Down Expand Up @@ -37,8 +37,11 @@
"koa-bodyparser": "^4.4.0",
"koa-router": "^12.0.0",
"koa-websocket": "^7.0.0",
"nedb": "^1.8.0",
"nedb-promises": "^6.2.1",
"qrcode-terminal": "^0.12.0",
"request": "^2.88.2",
"typechat": "^0.0.10",
"uuid": "^9.0.0",
"wechaty": "^1.20.2",
"wechaty-puppet-padlocal": "^1.20.1",
Expand All @@ -56,6 +59,7 @@
"@types/koa-bodyparser": "^4.3.10",
"@types/koa-router": "^7.4.4",
"@types/koa-websocket": "^5.0.7",
"@types/nedb": "^1.8.13",
"@types/node": "^18.15.11",
"@types/qrcode-terminal": "^0.12.0",
"@types/uuid": "^9.0.1",
Expand Down
Loading

0 comments on commit 874dd5d

Please sign in to comment.