Clawdbot Gateway 配置
Clawdbot AI 助手 Gateway 完整配置指南。了解配置選項、環境變數和進階設定。
Clawdbot Gateway 配置概覽
Clawdbot Gateway 通過 ~/.clawdbot/clawdbot.json 進行配置。本指南涵蓋所有用於自訂 Gateway 的配置選項。
配置檔案
位置
~/.clawdbot/clawdbot.json基本結構
{
"gateway": {
"port": 3010,
"host": "localhost"
},
"providers": {},
"agents": {},
"tools": {},
"sessions": {}
}Gateway 設定
核心設定
{
"gateway": {
"port": 3010,
"host": "localhost",
"logLevel": "info",
"maxConnections": 100
}
}選項
| 選項 | 預設值 | 說明 |
|---|---|---|
port | 3010 | WebSocket 伺服器埠號 |
host | localhost | 綁定地址 |
logLevel | info | 日誌詳細程度 |
maxConnections | 100 | 最大並發連線數 |
服務提供者配置
{
"providers": {
"whatsapp": {
"enabled": true,
"authStrategy": "qr",
"dmPolicy": "main"
}
}
}Telegram
{
"providers": {
"telegram": {
"enabled": true,
"token": "${TELEGRAM_BOT_TOKEN}"
}
}
}Discord
{
"providers": {
"discord": {
"enabled": true,
"token": "${DISCORD_BOT_TOKEN}",
"intents": ["GUILDS", "GUILD_MESSAGES", "DIRECT_MESSAGES"]
}
}
}代理配置
單一代理
{
"agents": {
"main": {
"workspace": "~/.clawdbot/workspace",
"model": "claude-3-sonnet"
}
}
}多代理
{
"agents": {
"main": {
"workspace": "~/.clawdbot/agents/main/workspace"
},
"work": {
"workspace": "~/.clawdbot/agents/work/workspace"
}
}
}會話配置
會話策略
{
"sessions": {
"dmScope": "main",
"resetTime": "04:00",
"idleMinutes": 60,
"maxHistory": 100
}
}會話選項
| 選項 | 預設值 | 說明 |
|---|---|---|
dmScope | main | 私訊會話範圍 |
resetTime | 04:00 | 每日重置時間 |
idleMinutes | null | 閒置逾時 |
maxHistory | 100 | 歷史訊息最大數量 |
工具配置
工具策略
{
"tools": {
"profile": "full",
"allow": ["*"],
"deny": ["browser"]
}
}依服務提供者設定工具
{
"tools": {
"byProvider": {
"whatsapp": {
"deny": ["exec"]
}
}
}
}環境變數
使用環境變數
{
"providers": {
"telegram": {
"token": "${TELEGRAM_BOT_TOKEN}"
}
}
}常用變數
| 變數 | 說明 |
|---|---|
CLAWDBOT_CONFIG | 配置檔案路徑 |
CLAWDBOT_LOG_LEVEL | 日誌等級覆蓋 |
CLAWDBOT_PORT | 埠號覆蓋 |
CLI 配置
覆蓋配置
clawdbot gateway start --port 3011 --log-level debug配置命令
# 檢視目前配置
clawdbot config get
# 設定配置值
clawdbot config set gateway.port 3011
# 重置為預設值
clawdbot config reset進階設定
效能
{
"gateway": {
"messageBuffer": 1000,
"processTimeout": 30000,
"streamChunkSize": 50
}
}限制
{
"limits": {
"maxMessageLength": 10000,
"maxConcurrentRequests": 10,
"rateLimitPerMinute": 60
}
}後續步驟
- Clawdbot 安全性 - 安全性配置
- Clawdbot 故障排除 - 除錯問題
- Clawdbot Gateway - Gateway 概覽