问题描述
Dify 配置 ollama 模型时返回以下报错,无法连接到 ollama 服务:
An error occurred during credentials validation: HTTPConnectionPool(host=‘xxx ip’, port=11434): Max retries exceeded with url: /api/chat (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x7ff6c00d4440>: Failed to establish a new connection: [Errno 111] Connection refused’))
添加 ollama 模型时的报错截图:

问题排查
该问题主要是无法外部访问 ollama 服务引起。
以下排查命令主要基于 ubuntu 系统,Dify 和 ollama 都配置在 ubuntu 服务器上,Ollama 以 systemd 服务的形式运行。
第一步、检查ollama服务是否运行
首先在ollama部署的服务器上,用命令行验证 ollama 服务是否运行:
curl http://localhost:11434
结果显示:Ollama is running 证明ollama服务在运行状态。
如果 ollam

最低0.47元/天 解锁文章
5446






