mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-23 16:29:16 +08:00
fix: encoding bug
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
### 3.运行环境
|
||||
|
||||
支持运行在 Linux、MacOS、Windows 操作系统上,需安装 `Python3.6` 及以上版本。推荐使用Linux服务器,可以托管在后台长期运行。
|
||||
支持运行在 Linux、MacOS、Windows 系统上,需安装有 `Python`(版本在3.7.1 ~ 3.8.16 之间),推荐使用Linux服务器,可以托管在后台长期运行。
|
||||
|
||||
克隆项目代码:
|
||||
|
||||
@@ -78,7 +78,7 @@ pip3 install openai
|
||||
|
||||
1.如果是开发机本地调试,直接在项目根目录下执行:
|
||||
|
||||
```
|
||||
```bash
|
||||
python3 app.py
|
||||
```
|
||||
终端输出二维码后,使用微信进行扫码,当输出 "Start auto replying" 时表示自动回复程序已经成功运行了。
|
||||
@@ -86,7 +86,7 @@ python3 app.py
|
||||
|
||||
2.如果是服务器部署,则使用nohup命令在后台运行:
|
||||
|
||||
```
|
||||
```bash
|
||||
touch nohup.out # 首次运行需要新建日志文件
|
||||
nohup python3 app.py & tail -f nohup.out # 后台运行程序并输出日志
|
||||
```
|
||||
|
||||
2
app.py
2
app.py
@@ -1,3 +1,5 @@
|
||||
# encoding:utf-8
|
||||
|
||||
import config
|
||||
from channel import channel_factory
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# encoding:utf-8
|
||||
|
||||
from bot.bot import Bot
|
||||
from config import conf
|
||||
from common.log import logger
|
||||
@@ -19,7 +21,7 @@ class OpenAIBot(Bot):
|
||||
max_tokens=1200, #回复最大的字符数
|
||||
top_p=1,
|
||||
frequency_penalty=0.0, #[-2,2]之间,该值越大则更倾向于产生不同的内容
|
||||
presence_penalty=0.2, #[-2,2]之间,该值越大则更倾向于产生不同的内容
|
||||
presence_penalty=0.6, #[-2,2]之间,该值越大则更倾向于产生不同的内容
|
||||
stop=["#"]
|
||||
)
|
||||
res_content = response.choices[0]["text"].strip()
|
||||
@@ -28,3 +30,5 @@ class OpenAIBot(Bot):
|
||||
return None
|
||||
logger.info("[OPEN_AI] reply={}".format(res_content))
|
||||
return res_content
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# encoding:utf-8
|
||||
|
||||
"""
|
||||
wechat channel
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user