dify 添加 ollama 模型报错
win10安装好 ollama 后,启动后,在 dify 上添加 ollama 模型报错:
An error occurred during credentials validation: HTTPConnectionPool(host='xxx.xxx.xxx.xxx',
port=11434): Max retries exceeded with url: /api/chat (Caused by NewConnectionError(
'<urllib3.connection.HTTPConnection object at 0x7f25ae6b2fc0>:
Failed to establish a new connection: [Errno 111] Connection refused'))
如果浏览器输入 http://127.0.0.1:11434 输出 Ollama is running,则表示 ollama 启动正常,应该是防火墙或者是为开放端口导致的,防火墙的话可以关闭防火墙或者新建 tcp 11434 端口的入站规则,如果是未开放端口,需要添加 OLLAMA_HOST=0.0.0.0:11434的环境变量,然后关闭ollama,然后需要打开新的窗口执行 ollama 的任意一条命令(比如 ollama run xxx ,ollama list)来启动ollama,如果浏览器输出 http://ip:11434 也提示 Ollama is running 了,此时 dify 就可以添加 ollama 模型了。