File size: 8,012 Bytes
eaa272b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9846719
eaa272b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9846719
eaa272b
7a2f614
 
eaa272b
 
 
 
 
 
9846719
eaa272b
7a2f614
 
eaa272b
 
 
 
 
 
9846719
eaa272b
7a2f614
 
eaa272b
 
 
 
 
 
9846719
eaa272b
7a2f614
 
eaa272b
 
 
 
 
 
 
 
 
 
 
 
 
9846719
eaa272b
7a2f614
 
eaa272b
 
 
 
 
 
9846719
eaa272b
7a2f614
 
eaa272b
 
 
 
 
 
 
 
 
 
 
 
 
9846719
eaa272b
7a2f614
 
eaa272b
 
 
 
 
 
 
 
 
7a2f614
eaa272b
 
 
 
 
 
 
 
 
7a2f614
9846719
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eaa272b
 
 
9846719
7a2f614
9846719
eaa272b
 
 
 
 
 
 
7a2f614
9846719
 
 
 
7a2f614
 
 
 
9846719
 
 
eaa272b
 
 
 
7a2f614
 
d26e380
 
 
 
 
 
 
 
 
9846719
 
7a2f614
eaa272b
 
 
 
 
 
 
 
9846719
 
 
 
eaa272b
0291d1e
eaa272b
 
 
 
0291d1e
eaa272b
 
 
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#!/bin/bash
set -e

BASE_DIR="/home/node/.openclaw"

# โ”€โ”€โ”€ ๆธ…็†ๅ‡ฝๆ•ฐ๏ผš้€€ๅ‡บๆ—ถๅผบๅˆถๆ€ๆމๆ‰€ๆœ‰ๅŽๅฐไปปๅŠก โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
cleanup() {
  echo "[cleanup] Received exit signal, cleaning up..."

  if [ -n "$BACKUP_PID" ]; then
    kill "$BACKUP_PID" 2>/dev/null || true
    echo "[cleanup] Backup process $BACKUP_PID stopped."
  fi

  echo "[cleanup] Done."
}

trap cleanup EXIT SIGTERM SIGINT

# โ”€โ”€โ”€ 1. ๅˆ›ๅปบๅฟ…่ฆ็š„็›ฎๅฝ•็ป“ๆž„ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
mkdir -p $BASE_DIR/agents/main/sessions
mkdir -p $BASE_DIR/credentials
mkdir -p $BASE_DIR/sessions
mkdir -p $BASE_DIR/workspace
mkdir -p $BASE_DIR/extensions

# โ”€โ”€โ”€ 2. ๆ‰ง่กŒๆขๅค๏ผˆไปŽ HF Dataset ๆขๅคๆ—ง็š„ไผš่ฏๅ’Œ้…็ฝฎ๏ผ‰ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
python3 /app/sync.py restore || true

# โ”€โ”€โ”€ 3. ็”Ÿๆˆ openclaw.json๏ผˆไป…ๅœจๆ–‡ไปถไธๅญ˜ๅœจๆ—ถ๏ผ‰ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
if [ ! -f $BASE_DIR/openclaw.json ]; then
  echo "openclaw.json not found, generating..."
  cat > $BASE_DIR/openclaw.json <<EOF
{
  "meta": {
    "lastTouchedVersion": "2026.3.13",
    "lastTouchedAt": "2026-03-22T14:56:52.442Z"
  },
  "wizard": {
    "lastRunAt": "2026-03-22T14:56:52.442Z",
    "lastRunVersion": "2026.3.13",
    "lastRunCommand": "onboard",
    "lastRunMode": "local"
  },
  "models": {
    "mode": "merge",
    "providers": {
      "custom-nvidia": {
        "baseUrl": "https://integrate.api.nvidia.com/v1",
        "apiKey": "${NVIDIA_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "minimaxai/minimax-m2.5",
            "name": "minimaxai/minimax-m2.5 (Custom Provider)",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 8192
          },
          {
            "id": "nvidia/nemotron-3-super-120b-a12b",
            "name": "nvidia/nemotron-3-super-120b-a12b",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          },
          {
            "id": "openai/gpt-oss-120b",
            "name": "openai/gpt-oss-120b",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          },
          {
            "id": "qwen/qwen3.5-397b-a17b",
            "name": "qwen/qwen3.5-397b-a17b",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          }
        ]
      },
      "gemini-auth": {
        "baseUrl": "http://107.173.211.130:3000/gemini-cli-oauth/v1",
        "apiKey": "${GEMINI_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "gemini-3-flash-preview",
            "name": "gemini-3-flash-preview",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          },
          {
            "id": "gemini-3.1-flash-lite-preview",
            "name": "gemini-3.1-flash-lite-preview",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          }
        ]
      },
      "qwen-auth": {
        "baseUrl": "http://107.173.211.130:3000/openai-qwen-oauth/v1",
        "apiKey": "${QWEN_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3-coder-flash",
            "name": "qwen3-coder-flash",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 16384
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": { "primary": "gemini-auth/gemini-3.1-flash-lite-preview" },
      "models": {
        "gemini-auth/gemini-3.1-flash-lite-preview": {},
        "custom-nvidia/minimaxai/minimax-m2.5": {},
        "custom-nvidia/nvidia/nemotron-3-super-120b-a12b": {},
        "custom-nvidia/openai/gpt-oss-120b": {},
        "custom-nvidia/qwen/qwen3.5-397b-a17b": {},
        "gemini-auth/gemini-3-flash-preview": {},
        "qwen-auth/qwen3-coder-flash": {}
      },
      "workspace": "/home/node/.openclaw/workspace"
    },
    "list": [
      {
        "id": "main",
        "model": {
          "primary": "gemini-auth/gemini-3.1-flash-lite-preview",
          "fallbacks": [
            "custom-nvidia/minimaxai/minimax-m2.5",
            "custom-nvidia/nvidia/nemotron-3-super-120b-a12b",
            "custom-nvidia/openai/gpt-oss-120b",
            "custom-nvidia/qwen/qwen3.5-397b-a17b",
            "gemini-auth/gemini-3-flash-preview",
            "qwen-auth/qwen3-coder-flash"
          ]
        }
      }
    ]
  },
  "tools": {
    "profile": "full",
    "web": {
      "search": { "enabled": true, "provider": "duckduckgo" }
    }
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto",
    "restart": true,
    "ownerDisplay": "raw"
  },
  "session": { "dmScope": "per-channel-peer" },
  "hooks": {
    "internal": {
      "enabled": true,
      "entries": {
        "boot-md": { "enabled": true },
        "bootstrap-extra-files": { "enabled": true },
        "command-logger": { "enabled": true },
        "session-memory": { "enabled": true }
      }
    }
  },
  "gateway": {
    "port": 7860,
    "mode": "local",
    "bind": "lan",
    "auth": { "mode": "token", "token": "${OPENCLAW_TOKEN}" },
    "tailscale": { "mode": "off", "resetOnExit": false },
    "trustedProxies": ["10.16.0.0/16"],
    "controlUi": {
      "allowedOrigins": [
        "http://localhost:7860",
        "http://127.0.0.1:7860",
        "https://wenyin-openclaw.hf.space"
      ]
    }
  },
  "plugins": {
    "entries": {
      "duckduckgo": { "enabled": true }
    }
  }
}
EOF
else
  echo "openclaw.json already exists (restored from backup), skipping."
fi

# โ”€โ”€โ”€ 4. ๅฎ‰่ฃ…ๅพฎไฟกๆ’ไปถ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
echo "[setup] Installing WeChat plugin..."
CI=true npx -y @tencent-weixin/openclaw-weixin-cli@latest install --force
echo "[setup] WeChat plugin installed."

# โ”€โ”€โ”€ 5. ๅฏๅŠจๅฎšๆ—ถๅค‡ไปฝ๏ผˆๆฏ 1 ๅฐๆ—ถ๏ผ‰ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
(while true; do sleep 3600; python3 /app/sync.py backup; done) &
BACKUP_PID=$!
echo "[setup] Backup loop started (PID: $BACKUP_PID)"

# โ”€โ”€โ”€ 6. ่ฟ่กŒ่‡ชๆฃ€ๅนถๅฏๅŠจ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
openclaw doctor --fix

exec openclaw gateway run --port 7860 --bind lan