Skip to content

Commit 3d55227

Browse files
Add WeChat iLink (WxClaw) channel integration
- Introduced WxClawChannel class for handling WeChat messages using the openilink SDK. - Added WxClawTools for sending text and media through WeChat, with support for long messages and file uploads. - Updated app lifecycle management to start and stop WxClaw channel alongside existing channels. - Enhanced README files to include WxClaw configuration details and usage instructions, improving user guidance for integration. - Updated JSON configuration schema to include WxClaw settings, allowing for flexible channel activation.
1 parent 707e214 commit 3d55227

9 files changed

Lines changed: 437 additions & 35 deletions

File tree

README-zh_CN.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<p align="center">
1010
<strong>企业级自托管 AI 助手</strong><br />
11-
飞书通道 · 内置 Web 控制台 · LiteLLM 多模型
11+
飞书 · 微信 iLink(WxClaw)· 内置 Web 控制台 · LiteLLM 多模型
1212
</p>
1313

1414
<p align="center">
@@ -21,7 +21,7 @@
2121

2222
## 它是什么
2323

24-
**OpenFox** 跑在你自己的机器上:把 **大模型对话、定时任务、飞书机器人、浏览器工具、MCP、本地技能** 收拢到同一套 HTTP 服务里。默认带 **嵌入式 Web UI**`/web`),也可在飞书中与助手对话
24+
**OpenFox** 跑在你自己的机器上:把 **大模型对话、定时任务、飞书机器人、微信 iLink 机器人(WxClaw)、浏览器工具、MCP、本地技能** 收拢到同一套 HTTP 服务里。默认带 **嵌入式 Web UI**`/web`),可在 **飞书****微信**(启用 WxClaw 后)与助手对话
2525

2626
| 路径 | 说明 |
2727
|------|------|
@@ -45,7 +45,7 @@ OpenFox 从 **`~/.openfox/config.json`** 读取 JSON 配置,字段对应 `open
4545
| `search_knowledge` |`true` 时启用 **RAG**(Chroma 数据目录为 `~/.openfox/chromadb`,不在本文件中配置路径)。 |
4646
| `llm` | 对话模型:`model_name``api_base``api_key`(LiteLLM 风格模型 id)。 |
4747
| `knowledge` | `search_knowledge` 为 true 时生效:`vector_db`(集合名、`search_type`**embedder** / **reranker** 等)、`max_results``isolate_vector_search`|
48-
| `channels` | 通道集成,如 `channels.feishu``app_id``app_secret``encrypt_key``verification_token`)。 |
48+
| `channels` | 通道集成`channels.feishu``activate``app_id``app_secret``encrypt_key``verification_token` 等);`channels.wxclaw``activate`,及对 **WxClawTools** 可选的 `include_tools` / `exclude_tools`)。WxClaw 为扫码登录,令牌与同步游标持久化在 `~/.openfox/channels/wxclaw/`(见 `WxClawTools``OPENFOX_HOME_PATH`)。 |
4949
| `mcps` | MCP 服务列表(`command`/`args`/`env``url`/`headers` 等)。 |
5050
| `tools` | 各工具包开关与参数(`mcp``scheduler``shell``websearch``arxiv` 等);常见字段含 `activate``include_tools``exclude_tools` 及各自专用字段。 |
5151

@@ -75,11 +75,15 @@ OpenFox 从 **`~/.openfox/config.json`** 读取 JSON 配置,字段对应 `open
7575
"api_base": "https://api.deepseek.com",
7676
"api_key": "<llm_api_key>"
7777
},
78-
// 通道配置(示例为飞书
78+
// 通道配置(飞书 + 可选微信 iLink
7979
"channels": {
8080
"feishu": {
81+
"activate": true,
8182
"app_id": "<feishu_app_id>",
8283
"app_secret": "<feishu_app_secret>"
84+
},
85+
"wxclaw": {
86+
"activate": false
8387
}
8488
},
8589
// MCP 服务列表:每项要么 stdio(command+args),要么 HTTP(url+headers)
@@ -273,6 +277,7 @@ OpenFox 从 **`~/.openfox/config.json`** 读取 JSON 配置,字段对应 `open
273277
| **评估体系** | 内置 **评估** 流程:从 **性能****可靠性****准确性** 等维度衡量 Agent 或团队表现(Web 控制台 `/evals`)。 |
274278
| **运行追踪** | **追踪 Agent 运行全过程**:查看链路、span、会话等可观测数据,便于排查与优化(Web 控制台 `/traces`)。 |
275279
| **飞书** | 事件与消息接入,单聊/群聊(可 @ 机器人) |
280+
| **WxClaw(微信 iLink)** | 长轮询接收微信消息;首次需在**终端**扫码登录;Bot Token 与同步游标写入 `~/.openfox/channels/wxclaw/`。配置 **`channels.wxclaw.activate`****`true`** 并重启服务后启用。 |
276281
| **定时任务** | 内置调度器;在配置中通过 `tools.scheduler`**SchedulerConfig**)开启。对 Agent 暴露 **SchedulerTools**,可用自然语言创建周期任务(Cron 表达式 → POST 本 Agent 运行端点) |
277282
| **工具** | 见下文「内置 Agent 工具」;另可通过 `config.mcps` 挂载 **MCP**,Web 控制台中的配置编辑对应 **ConfigTools**(非 Agent 对话工具) |
278283
| **技能** | **`SKILLS_PATH`**`~/.openfox/skills`)下各子目录中的 `SKILL.md`(LocalSkills);Web 端支持上传技能包 |
@@ -287,6 +292,7 @@ OpenFox 从 **`~/.openfox/config.json`** 读取 JSON 配置,字段对应 `open
287292
| **ShellTools** | 在运行 OpenFox 的机器上执行 Shell 命令(Agno) |
288293
| **SchedulerTools** |`tools.scheduler.activate` 为 true 时注册。创建 / 列出 / 获取 / 删除 / 禁用定时任务;Cron 表达式触发对本 Agent 运行端点的回调 |
289294
| **FeiShuTools** | 飞书消息发送工具:`send_text_message``send_image_message``send_file_message``send_audio_message``send_media_message` |
295+
| **WxClawTools** | 微信 iLink 工具:`send_text``upload_file`(本地文件经 CDN 上传后发送图片/视频/文件)。仅用于 `@im.wechat` / `channel.type=wxclaw`;勿将微信用户 id 当作飞书 `open_id` 调用飞书工具。 |
290296
| **MCPConfigTools** | 在对话中增删改 MCP 相关配置声明,便于动态扩展工具 |
291297
| **WebSearchTools** | 联网搜索网页信息 |
292298
| **ArxivTools** | 检索 [arXiv](https://arxiv.org/) 论文与元数据 |
@@ -309,7 +315,7 @@ OpenFox 从 **`~/.openfox/config.json`** 读取 JSON 配置,字段对应 `open
309315
pip install openfox
310316
```
311317

312-
**首次启动**:若没有 `~/.openfox/config.json`,会先走一轮交互式初始化(API 文档开关、鉴权、`os_security_key`、时区、LLM、飞书等),然后启动服务。
318+
**首次启动**:若没有 `~/.openfox/config.json`,会先走一轮交互式初始化(API 文档开关、鉴权、`os_security_key`、时区、LLM、飞书等),然后启动服务。若仅使用微信通道,可将 **`channels.wxclaw.activate`** 设为 **`true`**,并将 **`channels.feishu.activate`** 设为 **`false`**(按需);修改配置后需**重启** `python -m openfox`
313319

314320
```bash
315321
python -m openfox
@@ -349,6 +355,19 @@ FeiShuTools 可用方法(对话工具):
349355

350356
---
351357

358+
## WxClaw(微信 iLink)
359+
360+
**WxClaw** 是 OpenFox 的 **微信** 通道:长轮询接收入站消息,并可用文本或上传图片/视频/文件回复。
361+
362+
### 先决条件(手机微信)
363+
364+
1. 打开手机 **微信** → 点击 ******设置****插件**
365+
2. 安装 **微信 ClawBot**(微信 clawbot)。
366+
3. 在运行 OpenFox 的机器上,将 `~/.openfox/config.json`**`channels.wxclaw.activate`** 设为 **`true`****启动** `python -m openfox`(修改配置后需**重启**进程)。
367+
4. 尚未保存 Bot Token 时,**终端**会打印 **二维码**,用 **手机微信** 扫码完成登录;令牌与同步游标写入 **`~/.openfox/channels/wxclaw/`**(见 `openfox/tools/wxclaw.py` 中的 `TOKEN_FILE``BUF_FILE`)。
368+
369+
---
370+
352371
## 模型(LiteLLM)
353372

354373
OpenFox 使用 **LiteLLM** 调用模型,只要在 [LiteLLM 支持的提供商](https://docs.litellm.ai/docs/providers) 范围内、走 OpenAI Chat Completions 风格接口,一般只需改 `llm.model_name` / `llm.api_base` / `llm.api_key`
@@ -425,7 +444,7 @@ ollama/llama3.1
425444
| 维度 | OpenClaw | OpenFox |
426445
|------|----------|---------|
427446
| 技术栈 | Node / TypeScript | Python、Agno、FastAPI |
428-
| 通道 | 多平台即时通讯 | 飞书为主(可扩展) |
447+
| 通道 | 多平台即时通讯 | 飞书 + 可选 **微信 iLink(WxClaw)** |
429448
| 扩展 | 浏览器、Canvas、Cron 等 | Cron、Shell、浏览器(Playwright)、MCP、本地 Skills |
430449
| 定位 | 全平台个人助手 | 企业级自托管 AI 助手,中英文友好,内置一体化 Web 控制台 |
431450

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<p align="center">
1010
<strong>Enterprise-grade self-hosted AI assistant</strong><br />
11-
Feishu channel · Built-in Web console · LiteLLM multi-model
11+
Feishu · WeChat iLink (WxClaw) · Built-in Web console · LiteLLM multi-model
1212
</p>
1313

1414
<p align="center">
@@ -21,7 +21,7 @@
2121

2222
## What it is
2323

24-
**OpenFox** runs on your own machine: it brings **LLM chat, scheduled jobs, Feishu bot, browser tools, MCP, and local skills** together in one HTTP service. It ships with an **embedded Web UI** at `/web`, and you can also talk to the assistant from Feishu.
24+
**OpenFox** runs on your own machine: it brings **LLM chat, scheduled jobs, Feishu bot, WeChat iLink (WxClaw) bot, browser tools, MCP, and local skills** together in one HTTP service. It ships with an **embedded Web UI** at `/web`, and you can chat from **Feishu** or **WeChat** when **WxClaw** is enabled.
2525

2626
| Path | Description |
2727
|------|-------------|
@@ -45,7 +45,7 @@ OpenFox reads a single JSON file at **`~/.openfox/config.json`**. Fields map to
4545
| `search_knowledge` | When `true`, enables **RAG** (Chroma under `~/.openfox/chromadb`; path is not configured here). |
4646
| `llm` | Chat model: `model_name`, `api_base`, `api_key` (LiteLLM-style id). |
4747
| `knowledge` | RAG details when `search_knowledge` is true: `vector_db` (collection, `search_type`, `embedder`, `reranker`, …), `max_results`, `isolate_vector_search`. |
48-
| `channels` | Integrations, e.g. `channels.feishu` (`app_id`, `app_secret`, `encrypt_key`, `verification_token`). |
48+
| `channels` | Integrations: `channels.feishu` (`activate`, `app_id`, `app_secret`, …) and `channels.wxclaw` (`activate`, optional `include_tools` / `exclude_tools` for **WxClawTools**). WxClaw uses QR login; tokens persist under `~/.openfox/channels/wxclaw/` (see `WxClawTools` / `OPENFOX_HOME_PATH`). |
4949
| `mcps` | List of MCP server entries (`command`/`args`/`env` or `url`/`headers`). |
5050
| `tools` | Per-toolkit switches and options (`mcp`, `scheduler`, `shell`, `websearch`, `arxiv`, …); each may include `activate`, `include_tools`, `exclude_tools`, and toolkit-specific fields. |
5151

@@ -75,11 +75,15 @@ The **key order, nesting, and non-secret values** match a full on-disk layout; s
7575
"api_base": "https://api.deepseek.com",
7676
"api_key": "<llm_api_key>"
7777
},
78-
// Channel integrations (example: Feishu)
78+
// Channel integrations (Feishu + optional WeChat iLink)
7979
"channels": {
8080
"feishu": {
81+
"activate": true,
8182
"app_id": "<feishu_app_id>",
8283
"app_secret": "<feishu_app_secret>"
84+
},
85+
"wxclaw": {
86+
"activate": false
8387
}
8488
},
8589
// MCP servers: each entry is stdio (command+args) or HTTP (url+headers)
@@ -273,6 +277,7 @@ You can edit the live file in the Web **Config** page or via the **expand/config
273277
| **Evaluations** | Built-in **evaluation** workflow in the Web UI: measure **performance**, **reliability**, and **accuracy** of your agent or team against datasets and criteria. |
274278
| **Run tracing** | **Trace** each **agent run** end-to-end: inspect spans, sessions, and execution flow stored for observability (Web UI `/traces`). |
275279
| **Feishu** | Event and message intake; DM and group chat (mention the bot) |
280+
| **WxClaw (WeChat iLink)** | Long-poll **WeChat** messages; first-time **QR login** in the terminal; bot token and sync buffer under `~/.openfox/channels/wxclaw/`. Enable with `channels.wxclaw.activate`: `true`. |
276281
| **Scheduled jobs** | Built-in scheduler; enable with `tools.scheduler` (**SchedulerConfig**). Agent toolkit **SchedulerTools** creates recurring tasks (cron → POST Agent run endpoint) |
277282
| **Tools** | See “Built-in Agent tools” below; you can also attach **MCP** via `config.mcps`. JSON config editing in the Web console uses **ConfigTools** (not an Agent chat tool). |
278283
| **Skills** | `SKILL.md` under `SKILLS_PATH` (`~/.openfox/skills`, LocalSkills); upload skill packs from the Web UI |
@@ -287,6 +292,7 @@ You can edit the live file in the Web **Config** page or via the **expand/config
287292
| **ShellTools** | Run shell commands on the host where OpenFox runs (Agno) |
288293
| **SchedulerTools** | Registered when `tools.scheduler.activate` is true. Create / list / get / delete / disable jobs; cron expressions invoke this Agent's run endpoint |
289294
| **FeiShuTools** | Feishu outbound messaging toolkit: `send_text_message`, `send_image_message`, `send_file_message`, `send_audio_message`, `send_media_message` |
295+
| **WxClawTools** | WeChat iLink toolkit: `send_text`, `upload_file` (local file → CDN upload → send image/video/file). Use **only** for `@im.wechat` / `channel.type=wxclaw`; do not pass WeChat ids to Feishu tools. |
290296
| **MCPConfigTools** | Add / remove / update MCP-related config in chat to extend tools dynamically |
291297
| **WebSearchTools** | Search the web |
292298
| **ArxivTools** | Search [arXiv](https://arxiv.org/) papers and metadata |
@@ -309,7 +315,7 @@ You can edit the live file in the Web **Config** page or via the **expand/config
309315
pip install openfox
310316
```
311317

312-
**First run**: If `~/.openfox/config.json` is missing, an interactive setup runs (API docs toggle, auth, `os_security_key`, timezone, LLM, Feishu, etc.), then the server starts.
318+
**First run**: If `~/.openfox/config.json` is missing, an interactive setup runs (API docs toggle, auth, `os_security_key`, timezone, LLM, Feishu, etc.), then the server starts. Set `channels.wxclaw.activate` to `true` (and optionally `channels.feishu.activate` to `false` if you only use WeChat) to enable **WxClaw**; restart after editing config.
313319

314320
```bash
315321
python -m openfox
@@ -349,6 +355,19 @@ FeiShuTools methods (chat tools):
349355

350356
---
351357

358+
## WxClaw (WeChat iLink)
359+
360+
**WxClaw** is OpenFox’s **WeChat** channel: long-poll inbound messages and reply with text or uploaded image/video/file.
361+
362+
### Prerequisites (WeChat on your phone)
363+
364+
1. Open **WeChat** on the phone → **Me****Settings****Plugins**.
365+
2. Install **WeChat ClawBot** (微信 ClawBot).
366+
3. On the machine running OpenFox, set **`channels.wxclaw.activate`** to **`true`** in `~/.openfox/config.json`, then start **`python -m openfox`** (restart after config edits).
367+
4. When no bot token is saved yet, a **QR code** is printed in the **terminal** — scan it with **WeChat** to complete login. Tokens and the sync cursor are stored under **`~/.openfox/channels/wxclaw/`** (see `TOKEN_FILE` / `BUF_FILE` in `openfox/tools/wxclaw.py`).
368+
369+
---
370+
352371
## Models (LiteLLM)
353372

354373
OpenFox uses **LiteLLM**. For any provider in [LiteLLM’s supported list](https://docs.litellm.ai/docs/providers) that exposes an OpenAI-style Chat Completions API, you usually only need `llm.model_name`, `llm.api_base`, and `llm.api_key`.
@@ -425,7 +444,7 @@ ollama/llama3.1
425444
| Aspect | OpenClaw | OpenFox |
426445
|--------|----------|---------|
427446
| Stack | Node / TypeScript | Python, Agno, FastAPI |
428-
| Channels | Many IM platforms | Feishu-first (extensible) |
447+
| Channels | Many IM platforms | Feishu + optional **WeChat iLink (WxClaw)** |
429448
| Extensions | Browser, Canvas, Cron, etc. | Cron, Shell, browser (Playwright), MCP, local Skills |
430449
| Focus | Cross-platform personal assistant | Enterprise-grade self-hosted AI assistant, bilingual-friendly, with an integrated Web control plane |
431450

0 commit comments

Comments
 (0)