Skip to main content

OpenClaw配置

tip

这不是完整的教程,只是记录一些关键的配置 and 踩过的坑。

浏览器配置

OpenClaw中的浏览器,相当于一个内置的browser-use。因为很多(大多数)网站要登录、要人工通过bot验证后才能继续操作。但是默认的headless模式浏览器却没法实现交互。

浏览器配置~/.openclaw/openclaw.json

"browser": {
"enabled": true,
"executablePath": "/usr/bin/google-chrome-stable",
"headless": false,
"defaultProfile": "openclaw",
"profiles": {}
},

通常云主机都是用VNC或者XRDP登录,但是如果只用上述配置,却无法启动一个可以正常交互的浏览器

本文试验环境中使用的VNC为:KasmVNC

修改systemd服务文件:~/.config/systemd/user/openclaw-gateway.service

[Service]
Environment=DISPLAY=:1.0
Environment=XAUTHORITY=/home/debian/.Xauthority

其中:DISPLAY的值通过在VNC桌面的Terminal中执行echo $DISPLAY若是通过SSH登录执行结果为空
修改完成后,把服务器重启一次。登录VNC,在Terminal中执行openclaw browser start,就能正常启动浏览器(Chrome窗口自动打开)。
用于查询browser状态和profile的命令

openclaw browser status
openclaw browser profiles
warning
  • 不要使用snap包安装Chrome,snap有沙箱机制,即便开启了CDP也很难正常连接
  • 不要使用自带的Chrome relay extension,这个插件的稳定性很差,运行一会就断开了

Discord配置

飞书个人版抠抠搜搜的,API调用数量和调用频率都有这样那样的限制。但确实比鹅厂微信完全关门要好太多。如果用的是飞书企业版,那就尽情的玩吧。飞书channel最大的优点就是:不用梯子

在不同的Discord channel中使用不同的agent。

创建agent

openclaw agents add news_bot

根据上述命令执行完成后的提示找到新建agent的Workspace目录,可以按需修改其中的*.md文件。
channel配置.openclaw/openclaw.json

"channels": {
"discord": {
"enabled": true,
"token": "MTQ2N2qvI",
"groupPolicy": "open",
"guilds": {
"812756": {
"requireMention": false,
"users": ["13173"]
}
}
}
}

其中:

  • guilds中的属性是Discord的ServerID
  • users数组中是Discord的UserID

除了channel配置之外,还需要配置bindings,将每个agent对应到一个Discord channel:

  "bindings": [
{
"agentId": "news_bot",
"match": {
"channel": "discord",
"peer": {
"kind": "channel",
"id": "503285"
},
"guildId": "812756"
}
},
{
"agentId": "main",
"match": {
"channel": "discord",
"peer": {
"kind": "channel",
"id": "118666"
},
"guildId": "812756"
}
}
]

其中:

  • guildId是Discord的ServerID
  • peer.id是Discord的channelID

SOUL.md文件示例,用于收集热点新闻和热门讨论话题。

# Role: OpenClaw Information Specialist

## Profile
- **Expertise**: Expert at collecting and synthesizing internet news and resources.
- **Tools**: Always use the browser profile `openclaw` for all web activities.
- **Language**: Summaries must be written in Chinese (中文).
- **Special Requirement**: News titles must be presented in both English and Chinese (Bilingual).

## Rules
1. **Search & Collect**: Actively browse the web using the `openclaw` profile to gather the latest and most relevant information.
2. **Bilingual Titles**: For every piece of news or material, the title must be displayed in both the original English and the translated Chinese.
3. **Chinese Summarization**: Provide a concise and high-quality summary of the content in Chinese.
4. **Source Attribution**: Always attach the original URL (link) for every collected item.
5. **No Tables**: Markdown tables are strictly prohibited. Use headings, bullet points, and bold text for organization.

## Output Format
- **Title**: [English Title] / [中文标题]
- **Summary**: [此处输入中文摘要内容]
- **Source**: 原文链接: [URL]

## Workflow
1. Access the internet via the `openclaw` browser profile.
2. Identify key information and news.
3. Translate the title into a bilingual format (English/Chinese).
4. Summarize the findings into Chinese.
5. Present the results using Markdown headers and lists (avoiding tables).