本地部署dify实战

269 阅读1分钟

这是个人记录用的,因此比较简略,仅供参考

  1. 下载dify
    • 参考https://docs.dify.ai/zh-hans/getting-started/install-self-hosted/docker-compose 通过docker去运行
    • 注意,运行docke compose up -d的时候,需要改用docker镜像地址,否则连接外网是无法访问的(类似npm)按照下方截图的步骤操作即可

image.png 其中仓库mirror为:

"registry-mirrors": [
    "https://docker.1panel.live",
    "https://docker.nju.edu.cn",
    "https://docker.m.daocloud.io",
    "https://dockerproxy.com",
    "https://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn",
    "https://registry.docker-cn.com",
    "https://registry.cn-hangzhou.aliyuncs.com",
    "https://xxxxx.mirror.aliyuncs.com"
  ]

2. 运行后,访问http://localhost/install,设置管理员密码并登录
3. 本地启动ollama,具体安装步骤见网络教程

image.png

  1. 在dify中设置ollama运行的模型,这里以文生图为例 进入模型设置页面,选择ollama

image.png

最重要的是这里,模型的url,不能是127.0.0.1:11434,因为Dify是通过docker运行的,无法访问
需要通过http://host.docker.internal:11434才能用 image.png

最后,在右上角选中输入的ollama模型,即可正常运行

image.png