tao-shen Claude Opus 4.6 commited on
Commit
c099f47
·
1 Parent(s): 4c38c03

feat: restore Telegram plugin functionality

Browse files

- Add telegram entry to plugins.entries with enabled: true
- Update Dockerfile to verify telegram extension exists
- Fix sync_hf.py to enable telegram instead of removing it
- Update openclaw.json to include telegram plugin

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (4) hide show
  1. Dockerfile +2 -1
  2. config_for_dataset.json +54 -0
  3. openclaw.json +3 -0
  4. scripts/sync_hf.py +12 -7
Dockerfile CHANGED
@@ -29,9 +29,10 @@ RUN pnpm build
29
  ENV OPENCLAW_PREFER_PNPM=1
30
  RUN pnpm ui:build
31
 
32
- # 验证构建产物完整
33
  RUN test -f dist/entry.js && echo "[build-check] dist/entry.js OK" \
34
  && test -f dist/plugin-sdk/index.js && echo "[build-check] dist/plugin-sdk/index.js OK" \
 
35
  && test -d extensions/whatsapp && echo "[build-check] extensions/whatsapp OK" \
36
  && test -d dist/control-ui && echo "[build-check] dist/control-ui OK"
37
 
 
29
  ENV OPENCLAW_PREFER_PNPM=1
30
  RUN pnpm ui:build
31
 
32
+ # 验证构建产物完整(包含 Telegram 和 WhatsApp 扩展)
33
  RUN test -f dist/entry.js && echo "[build-check] dist/entry.js OK" \
34
  && test -f dist/plugin-sdk/index.js && echo "[build-check] dist/plugin-sdk/index.js OK" \
35
+ && test -d extensions/telegram && echo "[build-check] extensions/telegram OK" \
36
  && test -d extensions/whatsapp && echo "[build-check] extensions/whatsapp OK" \
37
  && test -d dist/control-ui && echo "[build-check] dist/control-ui OK"
38
 
config_for_dataset.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "gateway": {
3
+ "mode": "local",
4
+ "bind": "lan",
5
+ "port": 7860,
6
+ "auth": { "token": "openclaw-space-default" },
7
+ "controlUi": {
8
+ "allowInsecureAuth": true,
9
+ "allowedOrigins": [
10
+ "https://tao-shen-openclaw-ai.hf.space",
11
+ "https://huggingface.co"
12
+ ]
13
+ }
14
+ },
15
+ "session": { "scope": "global" },
16
+ "models": {
17
+ "mode": "merge",
18
+ "providers": {
19
+ "zhipu": {
20
+ "baseUrl": "https://open.bigmodel.cn/api/paas/v4",
21
+ "apiKey": "<ENV_VAR>",
22
+ "api": "openai-completions",
23
+ "models": [
24
+ { "id": "glm-4-plus", "name": "GLM-4 Plus" },
25
+ { "id": "glm-4-flash", "name": "GLM-4 Flash" }
26
+ ]
27
+ },
28
+ "hf": {
29
+ "baseUrl": "https://router.huggingface.co/v1",
30
+ "apiKey": "<ENV_VAR>",
31
+ "api": "openai-completions",
32
+ "models": [
33
+ { "id": "Qwen/Qwen2.5-7B-Instruct", "name": "Qwen2.5 7B (HF Router)" }
34
+ ]
35
+ }
36
+ }
37
+ },
38
+ "plugins": {
39
+ "entries": {
40
+ "telegram": {
41
+ "enabled": true
42
+ },
43
+ "whatsapp": {
44
+ "enabled": true
45
+ }
46
+ }
47
+ },
48
+ "agents": {
49
+ "defaults": {
50
+ "workspace": "~/.openclaw/workspace",
51
+ "model": { "primary": "zhipu/glm-4-plus" }
52
+ }
53
+ }
54
+ }
openclaw.json CHANGED
@@ -43,6 +43,9 @@
43
  },
44
  "plugins": {
45
  "entries": {
 
 
 
46
  "whatsapp": {
47
  "enabled": true
48
  }
 
43
  },
44
  "plugins": {
45
  "entries": {
46
+ "telegram": {
47
+ "enabled": true
48
+ },
49
  "whatsapp": {
50
  "enabled": true
51
  }
scripts/sync_hf.py CHANGED
@@ -165,6 +165,7 @@ class OpenClawHFSync:
165
  },
166
  "plugins": {
167
  "entries": {
 
168
  "whatsapp": {"enabled": True}
169
  }
170
  },
@@ -229,17 +230,21 @@ class OpenClawHFSync:
229
  modified = True
230
 
231
  # 3. Ensure Telegram Config
232
- # Telegram plugin has empty configSchema (properties: {}), so it only accepts empty object {}
233
- # or no entry at all. The allowFrom is configured via credentials/telegram-allowFrom.json
234
  if 'plugins' not in data: data['plugins'] = {}
235
  if 'entries' not in data['plugins']: data['plugins']['entries'] = {}
236
 
237
- # Remove telegram entry entirely from config - plugin will be auto-discovered
238
- # and configured via credentials/telegram-allowFrom.json
239
- if 'telegram' in data['plugins']['entries']:
240
- print("[SYNC] Removing telegram from config (should be in credentials/telegram-allowFrom.json)")
241
- del data['plugins']['entries']['telegram']
242
  modified = True
 
 
 
 
 
 
243
 
244
  if modified:
245
  with open(config_path, 'w') as f:
 
165
  },
166
  "plugins": {
167
  "entries": {
168
+ "telegram": {"enabled": True},
169
  "whatsapp": {"enabled": True}
170
  }
171
  },
 
230
  modified = True
231
 
232
  # 3. Ensure Telegram Config
233
+ # Telegram plugin needs to be enabled in plugins.entries
 
234
  if 'plugins' not in data: data['plugins'] = {}
235
  if 'entries' not in data['plugins']: data['plugins']['entries'] = {}
236
 
237
+ # Add telegram entry if not present or disabled
238
+ if 'telegram' not in data['plugins']['entries']:
239
+ print("[SYNC] Adding telegram to plugins.entries")
240
+ data['plugins']['entries']['telegram'] = {"enabled": True}
 
241
  modified = True
242
+ elif isinstance(data['plugins']['entries']['telegram'], dict):
243
+ # Ensure it's enabled even if present
244
+ if not data['plugins']['entries']['telegram'].get('enabled', False):
245
+ print("[SYNC] Enabling telegram plugin")
246
+ data['plugins']['entries']['telegram']['enabled'] = True
247
+ modified = True
248
 
249
  if modified:
250
  with open(config_path, 'w') as f: