前提:购买一台服务器,使用的是Ubuntu系统(我使用的版本是Ubuntu-22.04-x64系统)
dify接入服务器
克隆 Dify 源代码至本地。
git clone https://github.com/langgenius/dify.git
进入 Dify 源代码的 docker 目录
cd dify/docker
cp .env.example .env
下载docker容器
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
systemctl start docker
systemctl status docker
systemctl enable docker
docker compose up -d
一键启动
docker compose up -d
使用浏览器输入服务器ID+80端口进行访问如(123.456.789.10:80)
进入设置完应用后记录好api和apikey
回到服务器,按ctrl+z键再输入cd回到根目录
cd
dify接入微信的服务器部署
下载项目代码
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
先点击一下a键,再把下面内容复制到里面
{
"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": "通过好友发送的提示语"
}
仅需改这两项内容
"dify_api_base": "改为你的接口"
"dify_api_key": "改为你的密钥”
按Esc键,再输入:wq!保存文件
启动
python3 app.py
扫码登陆即可(注意这里的微信号必须是实名注册过的)