← Zurück zur Liste

OpenClaw, in Verbindung mit Ollamas lokalem Einsatz, super einfach!

itadol5j

OpenClaw + Ollama

OpenClaw mit Ollama lokalen Bereitstellung, super einfach!

Sind Sie immer noch besorgt über die Kosten für den Aufruf eines großen Cloud-Modells? Immer noch besorgt über Datenschutz?

Ich werde Ihnen beibringen, wie man es heute benutzt. OpenClaw + Ollama Erstellen Sie einen vollständig lokalisierten KI-Assistenten, alle Daten laufen lokal, sicher und kostengünstig!

Was ist Ollama?

Ollama ist ein Werkzeug, mit dem Sie große Sprachmodelle lokal ausführen können. Es unterstützt viele Open-Source-Modelle wie Llama 2, Llama 3, Mistral, Gemma, die ohne GPU ausgeführt werden können.

Offizielle Website: https://ollama.com

Zubereitungen

1. Installation von Ollama

MacOS/Linux:

curl -fsSL https://ollama.com/install.sh | bash

Windows:
Gehen Sie direkt zu https://ollama.com, um das Installationspaket herunterzuladen

Download-Modelle

Laden Sie nach der Installation das benötigte Modell herunter:

# 推荐:下载 Llama 3(8B 参数,一般配置够用)
ollama pull llama3

# 或者下载 Mistral(性能不错)
ollama pull mistral

# 配置低的可以选 qwen(阿里开源,中文效果好)
ollama pull qwen:7b

3. Validierung von Ollama run

# 启动 Ollama 服务(一般安装后自动启动)
ollama serve

# 测试模型
ollama run llama3

Okay!

OpenClaw Konfiguration

1. Profil finden

OpenClaw Profil in ~/.openclaw/openclaw.json

2. Hinzufügen von Ollama als Custom

Fügen Sie dem Profil Folgendes hinzu:

{
  models: {
    providers: {
      ollama: {
        type: "openai",  // Ollama 兼容 OpenAI API
        baseUrl: "http://localhost:11434/v1",
        api: "key",
        defaultHeaders: {
          "Content-Type": "application/json"
        }
      }
    }
  },
  agents: {
    defaults: {
      model: {
        primary: "ollama/llama3"
      },
      models: {
        "ollama/llama3": {
          // 支持的参数
        },
        "ollama/mistral": {},
        "ollama/qwen:7b": {}
      }
    }
  }
}

3. Beispiele für die vollständige Konfiguration

{
  models: {
    providers: {
      ollama: {
        type: "openai",
        baseUrl: "http://localhost:11434/v1"
      }
    }
  },
  agents: {
    defaults: {
      model: {
        primary: "ollama/llama3",
        fallbacks: ["ollama/mistral"]
      },
      models: {
        "ollama/llama3": {
          description: "Meta Llama 3, 8B 参数"
        },
        "ollama/mistral": {
          description: "Mistral 7B, 性能强劲"
        },
        "ollama/qwen:7b": {
          description: "阿里 Qwen 7B, 中文效果好"
        }
      }
    }
  }
}

4. OpenClaw neu starten

# 重启 Gateway
openclaw gateway restart

# 查看模型状态
openclaw models status

Gemeinsame Probleme

Q1: Was ist mit langsamem Laden?

Das anfängliche Laden des Modells wird langsamer sein, da die Modelldatei heruntergeladen werden muss. Sie können Ollama in der Backstage laufen lassen und jeden Neustart vermeiden.

# 让 Ollama 保持运行
nohup ollama serve &

Q2: Was ist, wenn es nicht genug gibt?

Wählen Sie das Geruchsmodell:
Es tut mir leid. llama3:8b ~ Benötigen Sie etwa 8 GB sichtbar
Es tut mir leid. mistral:7b ~ Benötigen Sie etwa 8 GB sichtbar
Es tut mir leid. qwen:7b ~ Benötigen Sie etwa 8 GB sichtbar
Es tut mir leid. llama3:70b ~ Es braucht etwa 40 GB, um sichtbar zu sein.

Q3: Wie betrachten wir die Modelle?

ollama list

Q4: Langsame Reaktion?

Lokale Modell-Responseraten hängen ab von:
- Modellgröße
Sichtbarkeit/RAM-Geschwindigkeit
CPU-Leistung

Empfohlene quantitative Modelle (Band) :q4_K_M Warte, warte, warte.

Q5: OpenClaw kann kein Modell finden?

Gewährleistung, dass
Ollama läuft:ollama serve
2. Das konfigurierte Modell wurde heruntergeladen:ollama list
3. BaseUrl Richtig:http://localhost:11434/v1

Progress: Multimodel Switching

Mehrere Fallbacks konfigurieren:

{
  agents: {
    defaults: {
      model: {
        primary: "ollama/llama3",
        fallbacks: ["ollama/qwen:7b", "ollama/mistral"]
      }
    }
  }
}

Wenn also llama3 nicht verfügbar ist, wechselt es automatisch zum nächsten Modell.

Zusammenfassung

Durch den lokalen Einsatz von Ollama können Sie:

  • Zen KosteneinsparungenTotal kostenlos, kein API Key
  • Zen Datenschutz: Daten nicht lokal verfügbar
  • Zen Custom: Freie Wahl des Modells
  • Zen Stabiler.: Nicht abhängig vom Netzwerk

Mach weiter und versuche es. Stellen Sie mir irgendwelche Fragen.


OpenClaw, in Verbindung mit Ollamas lokalem Einsatz, super einfach!

Finde Freunde, füge mich der Gruppe hinzu und teile A.I. und Cyber-Sicherheitstechnologie.