日期:2026年5月30日 23:00 — 5月31日 00:15 (CST)
服务器:VM-0-2-ubuntu · Linux 6.8.0-71-generic · 宝塔面板
域名:oc.allinai.uno → Nginx 反代 → OpenClaw Gateway
| 组件 | 配置 |
|---|---|
| Gateway | systemd user service,端口 19920,loopback 模式 |
| Nginx | 反代 127.0.0.1:19920,SSL + WebSocket 支持 |
| Control UI | https://oc.allinai.uno,token 认证 |
| Agent: main | 模型 zai/glm-5.1(智谱),工作目录 ~/.openclaw/workspace |
| Agent: STBOT 🤖 | 模型 sensenova/sensenova-6.7-flash-lite(商汤),绑定 Discord「商汤」频道 |
| Discord Bot | @虾搞,Guild: 虾搞,Channel: 商汤 |
访问 oc.allinai.uno 返回 502 Bad Gateway。排查发现 Nginx 配置正确(反代到 127.0.0.1:19920),但 Gateway 进程未运行,端口无人监听。
首次使用 nohup openclaw gateway & 手动启动,502 消除,页面返回 200。但这种方式重启后会丢失。
执行 openclaw gateway install,注册为 systemd user service,实现开机自启。
sudo loginctl enable-linger root 和设置 XDG_RUNTIME_DIR,否则 systemd user session 不可用。浏览器访问 oc.allinai.uno 提示「浏览器来源不被允许」。需要在配置中添加 gateway.controlUi.allowedOrigins。
在 openclaw.json 中添加:
"controlUi": {
"allowedOrigins": ["https://oc.allinai.uno"]
}
重启后 Control UI 正常访问。
添加商汤 SenseNova 作为模型提供商。在 openclaw.json 和 auth-profiles.json 中配置 provider、模型列表和 API Key。
api.sensenova.cn/compatible-mode/v2,实际 platform.sensenova.cn 的新平台应使用 token.sensenova.cn/v1。用错地址会返回 401/403。创建 sensenova-agent(后命名为 STBOT 🤖),配置独立的 workspace、auth 和模型。
openclaw agents add sensenova-agent \ --model "sensenova/sensenova-6.7-flash-lite" \ --workspace "/bingo2026/.openclaw/workspace-sensenova" openclaw agents set-identity --agent sensenova-agent --name "STBOT" --emoji "🤖"
最初用 _default 作为 Guild ID,导致频道无法解析。日志显示 channels unresolved。
修改为真实 Guild ID 1510296477338046554 后,频道解析成功:channels resolved: 虾搞/商汤。
Bot 在线但跳过所有频道消息,日志:skipping guild message (reason: no-mention)
原因一:频道默认 requireMention: true,需要 @bot 才触发。
设置 requireMention: false 后消息能收到。
原因二:日志持续提示 Message Content Intent is limited,但 Developer Portal 中已开启。实际不影响功能(limited 只是提示,bot <100 服务器可正常使用)。
消息被路由到 main agent(智谱模型)而非 STBOT(商汤模型)。
原因:binding 格式 discord:1510296478214520926 被当成 accountId 而非频道 ID。Discord 的 account 是 bot 自身。
解决:使用 peer match 绑定方式:
"bindings": [
{
"agentId": "sensenova-agent",
"match": {
"channel": "discord",
"accountId": "default",
"peer": { "kind": "group", "id": "1510296478214520926" }
}
}
]
STBOT 路由正确,但商汤 API 返回 HTTP 401/403 Forbidden。
根因一:Base URL 错误,使用了旧地址 api.sensenova.cn/compatible-mode/v2。
根因二:API Key 格式问题,聊天中发送的 key 包含省略号占位符。
最终确认正确的 API 地址为 https://token.sensenova.cn/v1,配合完整 API Key 后 curl 测试返回 200。
Discord「商汤」频道消息 → STBOT(sensenova-6.7-flash-lite)→ 正常回复。
{
"gateway": {
"port": 19920,
"bind": "loopback",
"controlUi": {
"allowedOrigins": ["https://oc.allinai.uno"]
}
},
"models": {
"providers": {
"sensenova": {
"baseUrl": "https://token.sensenova.cn/v1",
"api": "openai-completions",
"models": [
{ "id": "sensenova-6.7-flash-lite", ... },
{ "id": "sensenova-u1-fast", ... },
{ "id": "deepseek-v4-flash", ... }
]
}
}
},
"bindings": [
{
"agentId": "sensenova-agent",
"match": {
"channel": "discord",
"accountId": "default",
"peer": { "kind": "group", "id": "频道ID" }
}
}
],
"channels": {
"discord": {
"groupPolicy": "allowlist",
"guilds": {
"服务器ID": {
"requireMention": false,
"channels": {
"频道ID": { "enabled": true, "requireMention": false }
}
}
}
}
}
}
https://token.sensenova.cn/v1,旧平台用 https://api.sensenova.cn/compatible-mode/v2。以 platform.sensenova.cn 的文档为准。
bindings 配合 peer match 来绑定特定频道到特定 Agent,不要用频道 ID 作为 accountId。
_default 占位。
openclaw gateway install 注册 systemd 服务,配合 loginctl enable-linger 确保重启后自动运行。
| 文件 | 路径 |
|---|---|
| 主配置 | ~/.openclaw/openclaw.json |
| main agent 认证 | ~/.openclaw/agents/main/agent/auth-profiles.json |
| STBOT agent 认证 | ~/.openclaw/agents/sensenova-agent/agent/auth-profiles.json |
| STBOT workspace | /bingo2026/.openclaw/workspace-sensenova/ |
| Nginx 配置 | /www/server/panel/vhost/nginx/oc.allinai.uno.conf |
| systemd 服务 | ~/.config/systemd/user/openclaw-gateway.service |
| 日志 | /tmp/openclaw/openclaw-2026-05-30.log |
| 操作 | 命令 |
|---|---|
| 启动终端对话 | openclaw chat |
| 重启 Gateway | systemctl --user restart openclaw-gateway.service |
| 查看状态 | openclaw status |
| 查看日志 | journalctl --user -u openclaw-gateway.service -f |
| 查看 Agent 列表 | openclaw agents list --bindings |
| 频道状态 | openclaw channels status --probe |