如何進階設定 OpenClaw?

深入自訂你的 OpenClaw,解鎖完整功能。

多平台串接

Telegram Bot

  1. 1. 在 Telegram 搜尋 @BotFather,輸入 /newbot 建立新 Bot
  2. 2. 取得 Bot Token
  3. 3. 在 openclaw.json 中設定:
{
  "gateways": {
    "telegram": {
      "enabled": true,
      "token": "YOUR_TELEGRAM_BOT_TOKEN"
    }
  }
}

WhatsApp

  1. 1. 透過 WhatsApp Business API 取得存取憑證
  2. 2. 設定 Webhook URL 指向你的 OpenClaw 服務
  3. 3. 在 openclaw.json 中加入 WhatsApp gateway 設定

Line

  1. 1. Line Developers 建立 Messaging API Channel
  2. 2. 取得 Channel Secret 和 Channel Access Token
  3. 3. 在 openclaw.json 中設定 Line gateway

本地模型設定

搭配 Ollama 可以實現 100% 本地運行,完全不需要網路連線,資料絕不外洩。

安裝 Ollama

# macOS
brew install ollama

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

# Windows
# 至 ollama.com 下載安裝

下載並啟動模型

⚠️

使用本地端模型前,請先確認顯卡記憶體(VRAM)大小。建議需要 24 GB VRAM 以上,才能順暢執行 20B 以下的本地端模型。

# 下載推薦模型
ollama pull llama3
ollama pull mistral

# 啟動服務
ollama serve

設定 OpenClaw 使用本地模型

{
  "ai": {
    "provider": "ollama",
    "model": "llama3",
    "baseUrl": "http://localhost:11434"
  }
}

記憶與知識庫

讓 OpenClaw 讀取你的 PDF、文件,成為真正了解你的 AI 管家。

匯入 PDF 或文件

# 將文件放入知識庫目錄
cp your-document.pdf ~/.openclaw/knowledge/

# 重建索引
openclaw knowledge rebuild

設定知識庫

{
  "knowledge": {
    "enabled": true,
    "directory": "~/.openclaw/knowledge",
    "fileTypes": ["pdf", "txt", "md", "docx"]
  }
}

Config 設定檔說明

設定檔位置:~/.openclaw/openclaw.json

{
  "ai": {
    "provider": "openai",
    "model": "gpt-4",
    "apiKey": "sk-...",
    "fallback": {
      "provider": "ollama",
      "model": "llama3"
    }
  },
  "gateways": {
    "telegram": { ... },
    "whatsapp": { ... },
    "line": { ... }
  },
  "knowledge": {
    "enabled": true,
    "directory": "~/.openclaw/knowledge"
  },
  "rescue": {
    "enabled": true,
    "telegramChatId": "YOUR_CHAT_ID"
  }
}

常見問題