# Ollama

使用 Cline-胜算云增强版 设置 Ollama 以执行本地 AI 模型的快速指南。

#### 📋 先决条件 <a href="#prerequisites" id="prerequisites"></a>

* Windows、macOS 或 Linux 计算机
* 在 VS Code 中安装 Cline

#### 🚀 设置步骤 <a href="#setup-steps" id="setup-steps"></a>

**1.安装 Ollama**

* 访问 [ollama.com](https://ollama.com/)
* 根据您的操作系统下载并安装

<figure><img src="https://docs.cline.bot/~gitbook/image?url=https%3A%2F%2F3321249260-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ff8Oh1Lcy6yWYq1caYESV%252Fuploads%252F8z5yfpC0EHIHSKaSkKQk%252Fimage.png%3Falt%3Dmedia%26token%3D04a389e5-76bd-46d7-a54d-68ecbb5dee5e&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=27783f58&#x26;sv=2" alt=""><figcaption></figcaption></figure>

**2. 选择并下载模型**

* 在 [ollama.com/search](https://ollama.com/search) 浏览模型
* 选择模型并复制命令：

  复制

  ```
  ollama run [model-name]
  ```

![](https://docs.cline.bot/~gitbook/image?url=https%3A%2F%2F3321249260-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ff8Oh1Lcy6yWYq1caYESV%252Fuploads%252F5qasRAyYhybTUUqf3oC4%252Follama-model-grab.gif%3Falt%3Dmedia%26token%3D4af97fbf-b43c-46d7-bd42-19d0696fd57d\&width=768\&dpr=4\&quality=100\&sign=96346b63\&sv=2)

* 打开终端并运行以下命令：
  * 例子：

    ```
    ollama run llama2
    ```

<figure><img src="https://docs.cline.bot/~gitbook/image?url=https%3A%2F%2F3321249260-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ff8Oh1Lcy6yWYq1caYESV%252Fuploads%252FJKxtNSs0rV7EdEpnYqHJ%252Fstarting-ollama-terminal.gif%3Falt%3Dmedia%26token%3D0c48b366-eef5-46fc-a97d-b87310ed83c5&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=f354b3f5&#x26;sv=2" alt=""><figcaption></figcaption></figure>

**✨ 您的模型现在可以在 Cline-胜算云增强版 中使用了！**

**3.配置 Cline-胜算云增强版**

1. 打开 VS Code
2. 单击 Cline-胜算云增强版 设置图标
3. 选择“Ollama”作为 API 提供商
4. 输入配置：
   * 基本 URL： `http://localhost:11434/` （默认值，可以保留）
   * 从可用选项中选择型号

![](https://docs.cline.bot/~gitbook/image?url=https%3A%2F%2F3321249260-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ff8Oh1Lcy6yWYq1caYESV%252Fuploads%252F9tGgGtdYlMhc1KNmEwcw%252Fselecting-ollama-model-cline.gif%3Falt%3Dmedia%26token%3Dcdc4792a-9a0b-4016-9b46-8d98e7b10bf3\&width=768\&dpr=4\&quality=100\&sign=ae75d61c\&sv=2)

#### ⚠️ 重要提示 <a href="#important-notes" id="important-notes"></a>

* 与 Cline-胜算云增强版 一起使用之前先启动 Ollama
* 保持 Ollama 在后台运行
* 首次下载模型可能需要几分钟

#### 🔧 故障排除 <a href="#troubleshooting" id="troubleshooting"></a>

如果 Cline-胜算云增强版 无法连接到 Ollama：

1. 验证 Ollama 是否正在运行
2. 检查基本 URL 是否正确
3. 确保模型已下载

需要更多信息？阅读 [Ollama 文档 ](https://github.com/ollama/ollama/blob/main/docs/api.md)。

[以前的](https://docs.cline.bot/running-models-locally/read-me-first)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/ben-di-yun-xing-mo-xing/ollama.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
