arfandi7322 commited on
Commit
de215dc
·
1 Parent(s): 21b888e

Restore OpenClaw config template generation

Browse files
Files changed (1) hide show
  1. start.sh +107 -0
start.sh CHANGED
@@ -13,6 +13,113 @@ export PLAYWRIGHT_BROWSERS_PATH="${PLAYWRIGHT_BROWSERS_PATH:-/ms-playwright}"
13
  mkdir -p /root/workspace
14
 
15
  /app/sync-root-data.sh restore
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  /app/sync-root-data.sh loop &
17
 
18
  run_openclaw() {
 
13
  mkdir -p /root/workspace
14
 
15
  /app/sync-root-data.sh restore
16
+ mkdir -p /root/.openclaw
17
+
18
+ generate_openclaw_config() {
19
+ local clean_base
20
+ clean_base="$(printf '%s' "${OPENAI_API_BASE:-}" | sed 's|/chat/completions||g' | sed 's|/v1/|/v1|g' | sed 's|/v1$|/v1|g')"
21
+ local allow_id
22
+ allow_id="${TELEGRAM_ALLOW_ID:-0}"
23
+
24
+ cat > /root/.openclaw/openclaw.json <<JSONEOF
25
+ {
26
+ "models": {
27
+ "providers": {
28
+ "kilo_gateway": {
29
+ "baseUrl": "https://api.kilo.ai/api/gateway",
30
+ "apiKey": "anonymous",
31
+ "api": "openai-completions",
32
+ "models": [
33
+ { "id": "kilo-auto/free", "name": "Kilo Auto Free", "contextWindow": 128000, "maxTokens": 16000 }
34
+ ]
35
+ },
36
+ "nvidia": {
37
+ "baseUrl": "${clean_base}",
38
+ "apiKey": "${OPENAI_API_KEY:-}",
39
+ "api": "openai-completions",
40
+ "models": [
41
+ { "id": "${MODEL:-gpt-5.5}", "name": "${MODEL:-gpt-5.5}", "contextWindow": 128000 },
42
+ { "id": "${VISION_MODEL:-${MODEL:-gpt-5.5}}", "name": "Nvidia Vision", "contextWindow": 128000, "input": ["text", "image"] }
43
+ ]
44
+ }
45
+ }
46
+ },
47
+ "agents": {
48
+ "defaults": {
49
+ "model": {
50
+ "primary": "nvidia/${MODEL:-gpt-5.5}",
51
+ "fallbacks": ["kilo_gateway/kilo-auto/free"]
52
+ },
53
+ "imageModel": {
54
+ "primary": "nvidia/${VISION_MODEL:-${MODEL:-gpt-5.5}}"
55
+ },
56
+ "llm": {
57
+ "idleTimeoutSeconds": 0,
58
+ "maxTokens": 16384
59
+ }
60
+ }
61
+ },
62
+ "commands": { "restart": true },
63
+ "browser": {
64
+ "enabled": true,
65
+ "requirePairing": false,
66
+ "headless": true,
67
+ "noSandbox": true,
68
+ "defaultProfile": "openclaw",
69
+ "ssrfPolicy": { "dangerouslyAllowPrivateNetwork": true },
70
+ "profiles": {
71
+ "openclaw": {
72
+ "cdpPort": 18800,
73
+ "color": "0088FF"
74
+ }
75
+ }
76
+ },
77
+ "channels": {
78
+ "telegram": {
79
+ "enabled": true,
80
+ "botToken": "${TELEGRAM_BOT_TOKEN:-}",
81
+ "dmPolicy": "allowlist",
82
+ "allowFrom": [${allow_id}],
83
+ "apiRoot": "https://tg-relay.markdevil11.workers.dev",
84
+ "webhookUrl": "https://elysiadev11-openclaw.hf.space/tg-webhook",
85
+ "webhookSecret": "${OPENCLAW_GATEWAY_PASSWORD:-}",
86
+ "webhookPath": "/tg-webhook",
87
+ "webhookHost": "0.0.0.0",
88
+ "webhookPort": 8787,
89
+ "streaming": {
90
+ "mode": "partial"
91
+ }
92
+ }
93
+ },
94
+ "gateway": {
95
+ "mode": "local",
96
+ "bind": "lan",
97
+ "port": ${OPENCLAW_PORT},
98
+ "trustedProxies": ["0.0.0.0/0"],
99
+ "auth": { "mode": "token", "token": "${OPENCLAW_GATEWAY_PASSWORD:-}" },
100
+ "http": {
101
+ "endpoints": {
102
+ "chatCompletions": { "enabled": true }
103
+ }
104
+ },
105
+ "controlUi": {
106
+ "enabled": true,
107
+ "allowInsecureAuth": true,
108
+ "dangerouslyDisableDeviceAuth": true,
109
+ "dangerouslyAllowHostHeaderOriginFallback": true
110
+ }
111
+ }
112
+ }
113
+ JSONEOF
114
+ }
115
+
116
+ if [ ! -f /root/.openclaw/openclaw.json ] || ! python3 -c 'import json; json.load(open("/root/.openclaw/openclaw.json"))' 2>/dev/null; then
117
+ echo "Generating default /root/.openclaw/openclaw.json..."
118
+ generate_openclaw_config
119
+ else
120
+ echo "Existing /root/.openclaw/openclaw.json found; keeping it."
121
+ fi
122
+
123
  /app/sync-root-data.sh loop &
124
 
125
  run_openclaw() {