Ollama FAQ add solutions zh-cn&en (#68)

* FAQ add solutions

* FAQ add solutions
pull/75/head
Yuki 2024-05-06 11:14:55 +08:00 committed by GitHub
parent 9698bd8650
commit 834d535ac7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 1 deletions

View File

@ -87,6 +87,15 @@ If Ollama is run as a macOS application, environment variables should be set usi
2. Restart Ollama application. 2. Restart Ollama application.
3. If the above steps are ineffective, you can use the following method:
The issue lies within Docker itself, and to access the Docker host.
you should connect to `host.docker.internal`. Therefore, replacing `localhost` with `host.docker.internal` in the service will make it work effectively.
```bash
http://host.docker.internal:11434
```
### Setting environment variables on Linux ### Setting environment variables on Linux
If Ollama is run as a systemd service, environment variables should be set using `systemctl`: If Ollama is run as a systemd service, environment variables should be set using `systemctl`:

View File

@ -65,7 +65,7 @@ Dify 支持接入 Ollama 部署的大型语言模型推理和 embedding 能力
## FAQ ## FAQ
### ⚠️ If you are using docker to deploy Dify and Ollama, you may encounter the following error: ### ⚠️ 如果您使用Docker部署Dify和Ollama您可能会遇到以下错误:
``` ```
httpconnectionpool(host=127.0.0.1, port=11434): max retries exceeded with url:/cpi/chat (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8562812c20>: fail to establish a new connection:[Errno 111] Connection refused')) httpconnectionpool(host=127.0.0.1, port=11434): max retries exceeded with url:/cpi/chat (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f8562812c20>: fail to establish a new connection:[Errno 111] Connection refused'))
@ -75,6 +75,26 @@ httpconnectionpool(host=localhost, port=11434): max retries exceeded with url:/c
这个错误是因为 Docker 容器无法访问 Ollama 服务。localhost 通常指的是容器本身,而不是主机或其他容器。要解决此问题,您需要将 Ollama 服务暴露给网络。 这个错误是因为 Docker 容器无法访问 Ollama 服务。localhost 通常指的是容器本身,而不是主机或其他容器。要解决此问题,您需要将 Ollama 服务暴露给网络。
### 在Mac上设置环境变量
如果 `Ollama` 作为 `macOS` 应用程序运行,则应使用以下命令设置环境变量`launchctl`
1. 通过调用`launchctl setenv`设置环境变量:
```bash
launchctl setenv OLLAMA_HOST "0.0.0.0"
```
2. 重启Ollama应用程序。
3. 如果以上步骤无效,可以使用以下方法:
问题是在docker内部你应该连接到`host.docker.internal`才能访问docker的主机所以将`localhost`替换为`host.docker.internal`服务就可以生效了:
```bash
http://host.docker.internal:11434
```
### 在Linux上设置环境变量 ### 在Linux上设置环境变量
如果Ollama作为systemd服务运行应该使用`systemctl`设置环境变量: 如果Ollama作为systemd服务运行应该使用`systemctl`设置环境变量: