-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmp_rc_patch.py
More file actions
114 lines (94 loc) · 4.77 KB
/
Copy pathtmp_rc_patch.py
File metadata and controls
114 lines (94 loc) · 4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import sys
with open('/opt/clawgate/apps/web/dist/guide.html', 'r') as f:
html = f.read()
# Find the Rocket.Chat section and replace it
old_start = '<h3 id="rocketchat">3.1 Rocket.Chat'
old_end = '</table>\n</div>\n\n<!-- 3.2 Telegram -->'
start_idx = html.find(old_start)
end_idx = html.find(old_end)
if start_idx == -1 or end_idx == -1:
print(f'NOT FOUND: start={start_idx} end={end_idx}')
sys.exit(1)
new_rc = '''<h3 id="rocketchat">3.1 Rocket.Chat — 国内推荐 <span class="tag tag-hot">🔥 强烈推荐</span></h3>
<div class="highlight-box">
<strong>为什么选 Rocket.Chat?</strong>
<ul style="margin-top:8px;margin-bottom:0;">
<li>🇨🇳 <strong>国内直连</strong>,无需翻墙,无需科学上网</li>
<li>📱 支持 <strong>iOS / Android / 桌面端 / 网页端</strong></li>
<li>🔒 <strong>私有服务器</strong>,专为 ClawGate 用户搭建</li>
<li>🤖 支持切换 Claude / GPT / Gemini / GLM 全系列模型</li>
</ul>
</div>
<p>有两种使用方式:<strong>直接聊天</strong>(不需要装 OpenClaw)和 <strong>连接自己的 OpenClaw</strong>(高级玩法)。</p>
<h4>方式一:直接聊天(最简单)</h4>
<p>不需要安装任何东西,直接用 Rocket.Chat 客户端连接我们的服务器:</p>
<p><strong>📱 手机端(iOS / Android)</strong></p>
<ol class="step-list">
<li>在 App Store 或应用商店搜索 <strong>"Rocket.Chat"</strong> 并下载</li>
<li>打开 App,在服务器地址栏输入:<code>chat.xiaoclaw.com</code>,点击连接</li>
<li>注册一个新账号(或用已有账号登录)</li>
<li>在频道列表中找到 <strong>xiaoclaw</strong> 机器人,点击进入</li>
<li>发送消息即可获得 AI 回复</li>
</ol>
<p><strong>💻 桌面端(Mac / Windows / Linux)</strong></p>
<ol class="step-list">
<li>访问 <a href="https://rocket.chat/download">rocket.chat/download</a> 下载桌面客户端</li>
<li>安装后打开,服务器地址填:<code>chat.xiaoclaw.com</code></li>
<li>注册或登录,找到 <strong>xiaoclaw</strong> 机器人,开始聊天</li>
</ol>
<p><strong>🌐 网页端</strong></p>
<ol class="step-list">
<li>直接访问 <a href="https://chat.xiaoclaw.com">chat.xiaoclaw.com</a></li>
<li>注册或登录,找到 <strong>xiaoclaw</strong> 机器人,开始聊天</li>
</ol>
<h4>方式二:连接自己的 OpenClaw(高级)<span class="tag tag-tip">开发者</span></h4>
<p>如果你已经安装了 OpenClaw,可以把它连接到我们的 Rocket.Chat 服务器,让你的 AI 助手在 Rocket.Chat 里工作。</p>
<p><strong>第一步:在 Rocket.Chat 获取认证信息</strong></p>
<ol class="step-list">
<li>访问 <a href="https://chat.xiaoclaw.com">chat.xiaoclaw.com</a> 注册并登录</li>
<li>进入 <strong>个人设置 → 个人访问令牌</strong></li>
<li>创建一个新令牌,记下 <code>userId</code> 和 <code>authToken</code></li>
</ol>
<p><strong>第二步:配置 OpenClaw</strong></p>
<p>在 OpenClaw 配置文件(<code>openclaw.json</code>)中添加 Rocket.Chat 频道:</p>
<pre><code>{
<span class="cmd">"plugins"</span>: {
<span class="cmd">"installs"</span>: {
"rocketchat": {
"source": "npm",
"spec": "@cloudrise/openclaw-channel-rocketchat"
}
},
<span class="cmd">"entries"</span>: {
"openclaw-channel-rocketchat": {
"enabled": true
}
}
},
<span class="cmd">"channels"</span>: {
"rocketchat": {
"baseUrl": "https://chat.xiaoclaw.com",
"userId": "<span class="comment">你的 userId</span>",
"authToken": "<span class="comment">你的 authToken</span>"
}
}
}</code></pre>
<p><strong>第三步:重启 OpenClaw Gateway</strong></p>
<pre><code><span class="cmd">openclaw gateway restart</span></code></pre>
<p>重启后,你的 OpenClaw 助手就会出现在 Rocket.Chat 中,别人 @它 或私聊它就能获得 AI 回复。</p>
<div class="card">
<div class="card-title">💬 Rocket.Chat 中的常用命令</div>
<p style="font-size:13px;color:#64748b;margin-bottom:8px;">注意:Rocket.Chat 会拦截 <code>/</code> 开头的消息,请用 <code>@xiaoclaw --命令</code> 或 <code>--命令</code> 的方式:</p>
<table>
<tr><th>命令</th><th>说明</th></tr>
<tr><td><code>@xiaoclaw --model claude-sonnet-4-6</code></td><td>切换到 Claude Sonnet 4.6</td></tr>
<tr><td><code>@xiaoclaw --model gpt-5.2</code></td><td>切换到 GPT-5.2</td></tr>
<tr><td><code>--help</code></td><td>查看帮助信息</td></tr>
<tr><td><code>--clear</code></td><td>清除对话历史</td></tr>
</table>
</div>
<!-- 3.2 Telegram -->'''
html = html[:start_idx] + new_rc + html[end_idx + len(old_end):]
with open('/opt/clawgate/apps/web/dist/guide.html', 'w') as f:
f.write(html)
print('OK')