sharween commited on
Commit
c65aeea
·
verified ·
1 Parent(s): 9f7268e

Update start-openclaw.sh

Browse files
Files changed (1) hide show
  1. start-openclaw.sh +19 -9
start-openclaw.sh CHANGED
@@ -19,7 +19,7 @@ echo "✅ 目录创建完成"
19
  CLEAN_BASE=$(echo "$OPENAI_API_BASE" | sed "s|/chat/completions||g" | sed "s|/v1/|/v1|g" | sed "s|/v1$|/v1|g")
20
 
21
  # ================================================
22
- # 3. 生成基础配置文件
23
  # ================================================
24
  cat > /root/.openclaw/openclaw.json <<EOF
25
  {
@@ -40,6 +40,9 @@ cat > /root/.openclaw/openclaw.json <<EOF
40
  "model": { "primary": "nvidia/$MODEL" }
41
  }
42
  },
 
 
 
43
  "commands": {
44
  "restart": true
45
  },
@@ -67,7 +70,7 @@ echo "✅ 基础配置文件生成完成"
67
  python3 /app/sync.py restore
68
 
69
  # ================================================
70
- # 5. 微信插件激活(只检查 accounts.json)
71
  # ================================================
72
  echo "🔄 微信 ClawBot 激活流程..."
73
 
@@ -100,6 +103,9 @@ else
100
  "model": { "primary": "nvidia/$MODEL" }
101
  }
102
  },
 
 
 
103
  "commands": {
104
  "restart": true
105
  },
@@ -130,20 +136,24 @@ echo "🔧 执行 openclaw doctor --fix ..."
130
  openclaw doctor --fix || true
131
 
132
  # ================================================
133
- # 7. 创建独立微信 Agent 并强制绑定(最强版本)
134
  # ================================================
135
- echo "🔧 创建独立微信 Agent 并强制绑定(所有微信消息走独立会话)..."
136
 
137
- # 创建独立 Agent
138
  openclaw agents add wechat-agent --workspace /root/.openclaw/agents/wechat-agent --non-interactive || true
139
 
140
- # 强路由:任何来自 openclaw-weixin 通道的消息都使用 wechat-agent
141
- openclaw config set --json bindings '[{"agentId":"wechat-agent","match":{"channel":"openclaw-weixin"}}]' || true
 
 
 
142
 
143
- # 额外保险配置
144
  openclaw config set channels.openclaw-weixin.defaultAgent "wechat-agent" || true
145
 
146
- echo "✅ 微信强制绑定完成(所有 openclaw-weixin 消息将路由到 wechat-agent"
 
 
 
147
 
148
  # ================================================
149
  # 8. 启动定时备份
 
19
  CLEAN_BASE=$(echo "$OPENAI_API_BASE" | sed "s|/chat/completions||g" | sed "s|/v1/|/v1|g" | sed "s|/v1$|/v1|g")
20
 
21
  # ================================================
22
+ # 3. 生成基础配置文件(增加 plugins.allow)
23
  # ================================================
24
  cat > /root/.openclaw/openclaw.json <<EOF
25
  {
 
40
  "model": { "primary": "nvidia/$MODEL" }
41
  }
42
  },
43
+ "plugins": {
44
+ "allow": ["openclaw-weixin"]
45
+ },
46
  "commands": {
47
  "restart": true
48
  },
 
70
  python3 /app/sync.py restore
71
 
72
  # ================================================
73
+ # 5. 微信插件激活
74
  # ================================================
75
  echo "🔄 微信 ClawBot 激活流程..."
76
 
 
103
  "model": { "primary": "nvidia/$MODEL" }
104
  }
105
  },
106
+ "plugins": {
107
+ "allow": ["openclaw-weixin"]
108
+ },
109
  "commands": {
110
  "restart": true
111
  },
 
136
  openclaw doctor --fix || true
137
 
138
  # ================================================
139
+ # 7. 强制微信独立会话绑定(最强版本)
140
  # ================================================
141
+ echo "🔧 强制微信消息走独立 Agent (wechat-agent) ..."
142
 
 
143
  openclaw agents add wechat-agent --workspace /root/.openclaw/agents/wechat-agent --non-interactive || true
144
 
145
+ # 强路由规则:任何来自 openclaw-weixin 的消息都强制使用 wechat-agent
146
+ openclaw config set --json bindings '[
147
+ {"agentId": "wechat-agent", "match": {"channel": "openclaw-weixin"}},
148
+ {"agentId": "wechat-agent", "match": {"channelId": "openclaw-weixin"}}
149
+ ]' || true
150
 
 
151
  openclaw config set channels.openclaw-weixin.defaultAgent "wechat-agent" || true
152
 
153
+ # 禁用 main agent 处理微信消息(重要
154
+ openclaw config set agents.main.enabled false || true
155
+
156
+ echo "✅ 微信独立会话绑定已强制设置"
157
 
158
  # ================================================
159
  # 8. 启动定时备份