前提:使用的是Ubuntu-22.04-x64系统
下载项目代码
git clone https://github.com/hanfangyuan4396/dify-on-wechat
进入dify-on-wechat文件夹
cd dify-on-wechat/
安装核心依赖
pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
如果出现下面错误,表示你的系统中没有安装 pip
命令(如果没有错误,可跳到安装拓展依赖)
依次执行下面代码
sudo apt update
sudo apt install python3-pip
安装拓展依赖
pip3 install -r requirements-optional.txt -i https://mirrors.aliyun.com/pypi/simple
在项目根目录创建名为config.json的文件
touch config.json
使用vim打开并填写下面的内容
vim config.json
{
"dify_api_base": "改为你的接口",
"dify_api_key": "改为你的密钥",
"dify_app_type": "agent",
"channel_type": "wx",
"model": "dify",
"single_chat_prefix": [""],
"single_chat_reply_prefix": "",
"group_chat_prefix": ["@bot"],
"group_name_white_list": ["ALL_GROUP"],
"accept_friend_commands": ["加好友"],
"group_exit_msg": "退群聊通知文案",
"accept_friend_msg": "通过好友发送的提示语"
}
启动
python3 app.py
扫码登陆即可(注意这里的微信号必须是实名注册过的)