Skip to content

Commit

Permalink
Merge pull request #9 from zhayujie/feature-wechat-mp
Browse files Browse the repository at this point in the history
fix: adjust the retry count
  • Loading branch information
zhayujie authored Feb 16, 2023
2 parents f7dcf1b + 710f485 commit bce946a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cd bot-on-anything/
cp config-template.json config.json
```

配置文件结构如下
完整的配置文件结构如下

```bash
{
Expand Down Expand Up @@ -78,7 +78,15 @@ cp config-template.json config.json

> 项目中使用的对话模型是 davinci,计费方式是约每 750 字 (包含请求和回复) 消耗 $0.02,图片生成是每张消耗 $0.016,账号创建有免费的 $18 额度,使用完可以更换邮箱重新注册。
#### 1.2 配置项说明
#### 1.2 安装依赖

```bash
pip3 install --upgrade openai
```
> 注: 如果安装失败可先升级pip, `pip3 install --upgrade pip`

#### 1.3 配置项说明

```bash
{
Expand Down Expand Up @@ -125,6 +133,8 @@ cp config-template.json config.json
### 2.个人订阅号
**需要:**一台服务器,一个个人订阅号,一个已备案的域名。
#### 2.1 依赖安装
安装 [werobot](https://github.com/offu/WeRoBot) 依赖:
Expand Down Expand Up @@ -164,8 +174,8 @@ Hit Ctrl-C to quit.
![wx_mp_config.png](docs/images/wx_mp_config.png)
- 服务器地址 (URL):在浏览器访问该URL需要能访问到服务器上运行的python程序 (默认为8088端口),智能填写 80/443端口,所以需要在服务器进行端口转发 (如使用nginx),并将域名地址配置在url处 (仅用ip不行)
- 令牌 (Token):需和配置中的token一致
- **服务器地址 (URL)**:在浏览器访问该URL需要能访问到服务器上运行的python程序 (默认监听8088端口)。由于公众号只能配置 80/443端口,所以需要在服务器进行端口转发 (如使用nginx),或改为直接监听80端口,并将对应的域名地址配置在url处 (仅用ip不行)
- **令牌 (Token)**:需和配置中的token一致
#### 2.3 使用
Expand Down
2 changes: 1 addition & 1 deletion channel/wechat/wechat_mp_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def handle(self, msg, count=0):
return res['data']

elif res.get('flag', False) and not res.get('data', None):
if res.get('req_times') == 3 and count == 9:
if res.get('req_times') == 3 and count == 8:
return '不好意思我的CPU烧了,请再问我一次吧~'
if count < 10:
time.sleep(0.5)
Expand Down

0 comments on commit bce946a

Please sign in to comment.