3、安装python
- 安装构建Python源所需的包:
apt update apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
- curl命令从Python下载页面下载最新版本的源代码:
curl -O https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tar.xz
- 下载完成后解压tar压缩包
tar -xf Python-3.8.18.tar.xz
- 导航到Python源目录并运行configure脚本
cd Python-3.8.18 ./configure --enable-optimizations
- 编译并安装程序
make && make install
4、安装ffmpeg
apt install ffmpeg
5、安装git
apt install git
6、克隆项目代码:
git clone https://github.com/zhayujie/chatgpt-on-wechat cd
chatgpt-on-wechat/
7、安装核心依赖 :pip3 install -r requirements.txt
8、配置config.json(配置文件的模板在根目录中config-template.json,需要复制该模板创建最终生效的config.json文件)
cp config-template.json config.json
9、在后台运行程序使用nohup命令:
touch nohup.out # 首次运行需要新建日志文件
nohup python3 app.py & tail -f nohup.out # 在后台运行程序并通过日志输出二维码
配置config.json
{
"channel_type": "wechatmp",
"model": "gemini",
"gemini_api_key": "YOUR_API_KEY",
"single_chat_prefix" :"",
"wechatmp_token": "*",
"wechatmp_port": 80,
"wechatmp_app_id": "*",
"wechatmp_app_secret": "*",
"wechatmp_aes_key": "*b",
"single_chat_prefix": [""],
"single_chat_reply_prefix": "",
"plugin_trigger_prefix": "&",
"speech_recognition": true,
"group_speech_recognition": false,
"voice_reply_voice": true,
"conversation_max_tokens": 2500,
"expires_in_seconds": 3600,
"character_desc": "你是Gemini,一个由Google AI训练的大型语言模型,你旨在回答并解决人们的问题,并且可以使用多种语言与人交流。",
"use_linkai": false,
"linkai_api_key": "*",
"linkai_app_code": "*"
}