JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix: 修复频道文档的易用性问题
xiaoxiawangf5be96788953
diff --git a/docs/en/Channels.md b/docs/en/Channels.mdindex 56794b4987..3260afaa06 100644--- a/docs/en/Channels.md+++ b/docs/en/Channels.md@@ -1,38 +1,57 @@-# Channels — unified chat hub+# Channels-**Channels** are how JiuwenSwarm connects to chat platforms. **HarmonyOS Xiaoyi**, **Feishu (Lark)**, and more are supported, with more coming. You can talk to JiuwenSwarm from **Feishu**, **Xiaoyi on Harmony devices**, and others.+## Concept Overview-## Digital Avatar+### What is a Channel?++A **Channel** is JiuwenSwarm's message ingress layer. As a unified messaging hub, it connects various external chat platforms (such as Feishu, DingTalk, WeCom, Telegram, etc.) and provides the following core capabilities:++| Capability | Description |+|------------|-------------|+| **Message Ingestion** | Receives messages from different platforms, normalizes them, and forwards them to JiuwenSwarm for processing |+| **Multi-platform Sync** | A single JiuwenSwarm service can connect to multiple platforms simultaneously, with messages interoperable across them |+| **Identity Mapping** | Establishes unique identifiers for users on each platform and maintains independent conversation contexts |+| **Security Isolation** | Message flows across channels are isolated from each other; supports whitelists, permission controls, etc. |++### Introduction++JiuwenSwarm's **Channels** are the **gateways** through which you converse with different chat platforms. JiuwenSwarm has already achieved seamless integration with **HarmonyOS Xiaoyi**, **Feishu**, and more, with continuous expansion to additional platforms. You can talk to JiuwenSwarm directly through **Feishu**, the **Xiaoyi app on HarmonyOS devices**, and others.++### Digital AvatarJiuwenSwarm supports **Group Digital Avatar** on **Feishu** and **WeCom** channels. When enabled, the bot acts as a designated user's "digital avatar" in group chats — it automatically identifies messages relevant to that user and replies on their behalf in first person. For personal action items such as to-dos and reminders, the avatar sends the reply as a private message to the user while posting a brief confirmation in the group. Irrelevant messages are filtered out automatically, saving Agent resources.This feature is disabled by default. See the configuration instructions under each channel below.+### Configuration Methods+Configure channels in either of two ways:-* **Web UI (recommended)** — In the app, open **Agent** / **Channels**, then fill in the channel form.+- **Web UI** (recommended) — In JiuwenSwarm's frontend, click the **Agent** / **Channels** card, then fill in the channel management form.-* **Edit `config.yaml` manually** — Usually `~/.jiuwenswarm/config/config.yaml` (created on first `jiuwenswarm-start`). Set `enabled: true` and credentials; save to auto-reload without a full restart.+- **Edit `config.yaml` manually** — Default location is `~/.jiuwenswarm/config.yaml` (created automatically on first `jiuwenswarm-start`). Set the desired channel to `enabled: true` and fill in the credentials; saving triggers an automatic reload without restarting.-+----# Xiaoyi+## Channel Setup++### Xiaoyi[Demo video](../assets/videos/xiaoyi_channel.mp4)-## 1. Create a Xiaoyi agent+#### 1. Create a Xiaoyi AgentCreate a **JiuwenSwarm-mode** agent on the [Xiaoyi Open Platform](https://developer.huawei.com/consumer/cn/hag/abilityportal/#/) to connect to your JiuwenSwarm service.-Step 1: create a JiuwenSwarm-mode agent.+Step 1: Create a JiuwenSwarm-mode agent.-Step 2: create credentials and whitelist+Step 2: Create credentials and whitelist-Create credentials and **save the AK and SK**.+Click to create new credentials and **save the AK and SK**.@@ -40,7 +59,7 @@ Create credentials and **save the AK and SK**.-The platform supports on-device debugging: add users to a whitelist group to test on Harmony devices. After approval and publishing, the agent appears in the Xiaoyi app.+The Xiaoyi Open Platform provides on-device debugging capabilities. By configuring whitelist groups and adding user accounts, you can test the agent on HarmonyOS terminals. After successful addition and publishing, the agent can be used in the Xiaoyi app on the terminal.@@ -48,125 +67,168 @@ The platform supports on-device debugging: add users to a whitelist group to tes-Select the new user group.+Select the new user group:-Step 3: publish+Step 3: Publish the agent-Fill in the opening lines and click publish.+Fill in the opening dialogue and click the publish button:-## 2. Bind the channel+Step 4: Enable push notifications (optional)++Click to enable the trigger, fill in the name and save, then enter the apiID in JiuwenSwarm:++++Click variable editing and enable the push_id system variable:++++> 💡 **Note**: `api_id` is the API identifier of the trigger, and `push_id` is the identifier for receiving push messages. When enabling push notifications, both must be used together — neither can be omitted.++#### 2. Bind the Channel++**Option A: Web UI**-**Option A**: Paste **AK**, **SK**, and **agentId** from the platform into the Xiaoyi channel in JiuwenSwarm, enable, and save.+Paste the **AK**, **SK**, and **agentId** from the Xiaoyi Open Platform into JiuwenSwarm's Xiaoyi channel, enable it, and save to start chatting. If push is enabled, you can also fill in the api_id (optional):-**Option B**: Edit `~/.jiuwenswarm/config/config.yaml`:+**Option B: Edit config file**++Edit `~/.jiuwenswarm/config/config.yaml`:``````channels:xiaoyi:- # Huawei Xiaoyi A2A+ # Huawei Xiaoyi A2A configuration+ mode: xiaoyi_channelak: "<ak from platform>"sk: "<sk from platform>"agent_id: "<your agent id>"+ api_id: "<trigger apiId>"+ push_id: "<trigger push_id (required when push notifications are enabled, used together with api_id)>"+ uid: "" # User identifier (optional)+ api_key: "" # API key (optional)+ push_url: "" # Push URL (optional)+ file_upload_url: "" # File upload URL (optional)+ phone_tools_enabled: false # Enable phone tools (optional)+ send_file_allowed: true # Allow sending files (optional)enable_streaming: trueenabled: true``````-If the service is already running it reloads; otherwise run `jiuwenswarm-start`.+If the service is already running it will auto-reload; otherwise run `jiuwenswarm-start`.-## 3. Chat+#### 3. Chat with the Agent-Option 1: Web UI.+**Option 1:** Chat directly on the web with the agent application-Option 2: On a Harmony phone, open the published agent in the Xiaoyi app.+**Option 2:** On a HarmonyOS terminal, open the Xiaoyi app, find the published agent, and chat directly-# Feishu (Lark)+### Feishu (Lark)-## 1. Create a Feishu custom app-1. Open [Feishu Open Platform](https://open.feishu.cn/) and sign in.+#### 1. Create a Feishu Custom App-2. In the developer console, **Create custom app**.+1. Visit [Feishu Open Platform](https://open.feishu.cn/) and sign in.-3. Set name, description, icon, and create.+2. In the developer console, click **Create custom app**.++3. Fill in the app name, description, and upload an icon, then click **Create**.-## 2. Add bot capability-1. In the app, open **Add capability**.+#### 2. Add Bot Capability++1. In the app configuration page, select **Add capability** from the left sidebar.2. Under **Bot**, click **Add**.-## 3. Save app credentials-1. Open the Feishu bot admin.+#### 3. Save App Credentials-2. Copy **App ID** and **App Secret** into JiuwenSwarm’s Feishu channel, enable, and save.+1. Open the Feishu bot admin console.++2. Copy **App ID** and **App Secret** into JiuwenSwarm's Feishu channel, enable, and save.-## 4. Permissions-1. **Permission management** → **API permissions**.-2. Enable at least:- - `im:message` (send/receive as app, DMs, group @mentions).- - `im:resource` (upload images/files).- - `contact:user.employee_id:readonly` (user IDs).- - Or import a preset bundle from Volcengine docs.+#### 4. Configure Permissions++1. Select **Permission management** → **API permissions** from the left sidebar.++2. Search and enable the following key permissions (for sending and receiving messages):+ - `im:message:send`: Send messages as the app+ - `im:message.p2p_msg:readonly`: Get private messages sent to the bot+ - `im:message.group_at_msg:readonly`: Receive group chat @bot message events+ - `im:resource:upload`: Upload images and files (for sending images/files to users)+ - `contact:user.employee_id:readonly`: Get user ID information+ - You can also batch-import permissions; refer to the Feishu Open Platform documentation for the permission list-## 5. Event subscription-1. **Events & callbacks**.+#### 5. Configure Event Subscription (Receive Messages)++1. Select **Events & callbacks** from the left sidebar.+2. **Add events**:- - `im.message.receive_v1`- - `im.message.message_read_v1` (optional)-3. **Add trigger**:- - `card.action.trigger`-4. If encryption is on, save **Encrypt Key**.+ - `im.message.receive_v1` (receive message event)+ - `im.message.message_read_v1` (message read)++3. **Add callback**:+ - `card.action.trigger` (card interaction callback)++4. (Optional) **Configure encryption policy**: If encryption is enabled, save the **Encrypt Key**.-## 6. Publish-1. **Version & release** → **Create version**.-2. Set version notes and visibility (often **All members**).-3. Submit. If review is off, it goes live immediately.-4. In the Feishu app, sign in as the submitter to see the bot.+#### 6. Publish the App++1. Select **Version management & release** from the left sidebar, click **Create version**.++2. Fill in the version number, update notes, and select the availability scope (typically **All members** or partial members).++3. Submit for review. If the enterprise has review exemption enabled, the version goes live immediately.++4. Sign in to the Feishu app with the account that submitted the app to see the published chat bot.-## 7. Add bot to a group (optional)-1. Open the target group in Feishu.-2. **Group settings** → **Group bots** → **Add bot**, search your app name.+#### 7. Add Bot to a Group (Optional)++1. Open the Feishu client and enter the group where you want to add the bot.++2. Click **Group settings** → **Group bots** → **Add bot**, search for your app name and add it.-## 8. Enable Feishu channel in JiuwenSwarm-Start the web UI, open **Channels → Feishu**, enable, and paste **App ID** and **App Secret**.+#### 8. Configure Feishu Channel-## 9. Enable Group Digital Avatar (optional)+After starting the frontend service, open **Channels → Feishu**, enable it, and configure the **App ID** and **App Secret** saved in step 3.++#### 9. Enable Group Digital Avatar (Optional)After completing the basic Feishu bot setup, you can enable the digital avatar feature so the bot automatically replies in group chats on behalf of a designated user.> In Feishu, the digital avatar responds when someone **@mentions the bot**, **@mentions the represented user**, or **mentions the user's name** in the message text.-### Prerequisites+##### Prerequisites- Feishu bot has been created, published, and added to the target group (see step 7)-### Configuration steps+##### Configuration Steps1. In the JiuwenSwarm channel management page, open the Feishu channel settings and enable the **`group_digital_avatar`** toggle. Configure **`my_user_id`** and **`bot_name`**.@@ -197,7 +259,7 @@ channels:app_id: "your App ID"app_secret: "your App Secret"enabled: true- # Group digital avatar+ # Group digital avatar configurationgroup_digital_avatar: truemy_user_id: "ou_xxxx" # Feishu open_id of the represented userbot_name: "bot name" # Bot display name in the group@@ -206,6 +268,7 @@ channels:# Digital avatar tool permissions (scoped by channel_id + user_id)permissions:owner_scopes:+ # channel_id: use "feishu" for single bot, "feishu_enterprise:<app_id>" for multi-botfeishu:"ou_xxxx": # Must match my_user_id abovedefaults:@@ -221,14 +284,14 @@ permissions:deny_guidance_message: "This tool is not authorized in digital avatar mode."``````-6\. The Feishu robot needs to be granted the following permissions:+6\. The Feishu bot needs the following additional permissions:- - `im:message.group_msg` - Retrieve all messages in the group (with sensitive permissions)- - `contact:contact.base:readonly` - Retrieve basic information of the contact list- - `contact:user.base:readonly` - Retrieve basic information of the user- - `im:message.p2p_msg:readonly` - Retrieve private messages sent to the bot+ - `im:message.group_msg:readonly` - Retrieve all messages in the group (sensitive permission)+ - `contact:contact.base:readonly` - Retrieve basic contact information+ - `contact:user.base:readonly` - Retrieve basic user information+ - `im:message.p2p_msg:readonly` - Retrieve private messages sent to the bot (for receiving DM events)-### Fields+##### Fields| Field | Description ||:------|:------------|@@ -238,13 +301,13 @@ permissions:| `enable_memory` | Enable group chat memory. When on, the bot can read and search local memory files in group chats || `owner_scopes` | Tool permissions scoped by `channel_id` + `user_id`. Supports `allow` / `deny`; `ask` is automatically downgraded to `deny` in avatar mode. Web UI configuration is recommended |-## 10. Multiple Feishu bots (`feishu_enterprise`)+#### 10. Multiple Feishu Bots (`feishu_enterprise`)Use `channels.feishu_enterprise` when one JiuwenSwarm instance must serve **multiple Feishu apps** (multiple bots).Each bot is a separate channel; `channel_id` looks like `feishu_enterprise:<app_id>`.-Configure only via `~/.jiuwenswarm/config/config.yaml`:+Currently, multi-bot only supports manual editing of `~/.jiuwenswarm/config/config.yaml`:``````channels:@@ -269,97 +332,106 @@ channels:enabled: true``````-### Fields+##### Fields| Field | Description ||:------|:------------|| `app_id` | Feishu App ID (required) || `app_secret` | Feishu App Secret (required) |-| `encrypt_key` | Event encryption key (optional) |-| `verification_token` | Event verification token (optional) |-| `allow_from` | Allowed user `open_id` list; empty = no filter |-| `enable_streaming` | Stream assistant output |+| `encrypt_key` | Event subscription encryption key (optional) |+| `verification_token` | Event subscription token (optional) |+| `allow_from` | Allowed user `open_id` list; empty list means no restriction |+| `enable_streaming` | Enable streaming output || `chat_id` | Fixed push target (optional) || `enabled` | Enable this bot |-### vs single `feishu`+##### vs Single `feishu`++- `feishu`: single channel, `channel_id` is always `feishu`+- `feishu_enterprise`: multiple channels, each bot uses an independent `channel_id` (`feishu_enterprise:<app_id>`)+- In multi-bot scenarios, recent session information is tracked per bot to prevent bots from overwriting each other-- `feishu`: one channel, `channel_id` is always `feishu`.-- `feishu_enterprise`: multiple channels, one per bot (`feishu_enterprise:<app_id>`).-- Session state is tracked per bot so bots do not overwrite each other.-# DingTalk-## 1. Prerequisites+### DingTalk++#### 1. Prerequisites- Your account must be an **enterprise admin** or have **developer permissions**.-- The org must have **DingTalk Open Platform** enabled.+- The enterprise must have **DingTalk Developer Console** enabled.-## 2. Create an internal app bot+#### 2. Create an Internal App Bot-### Step 1: Open the console+##### Step 1: Open the Developer Console- Visit [https://open-dev.dingtalk.com](https://open-dev.dingtalk.com)-- **App development** → **Internal org apps** → **Create app**+- After logging in, select **App development** → **Internal org apps** → **Create app**-### Step 2: App info+##### Step 2: Fill in App Information-- Name, e.g. `JiuwenSwarm`-- Type: **Bot**+- App name: e.g. `JiuwenSwarm`+- App type: **Bot**-### Step 3: Enable bot+##### Step 3: Add Bot Capability-- Open the app → **Capabilities** → **Bot** → configure name and short intro.+- After creation, open the app details page+- Click **Capabilities** → **Bot** → **Enable bot configuration**+- Fill in the bot name (e.g. `JiuwenSwarm`), bot intro (≤10 characters), etc.-### Step 4: Message mode+##### Step 4: Configure Message Receiving Mode-Choose **Stream mode** (WebSocket long connection) — no public IP required; good for cloud functions or local dev.+Select **Stream mode** (WebSocket long connection) — no public IP required; suitable for cloud functions or local debugging.-## 3. Permissions-Under **Permissions**, enable as needed, e.g.:+#### 3. Configure Permissions+On the **Permission management** page, enable the following permissions as needed:- Send DM/group messages: `qyapi_robot_sendmsg`-- Lookup user by mobile: `topapi_v2_user_getbymobile`-- Interactive cards: `Card.Instance.Write`-- Streaming cards: `Card.Streaming.Write`+- Lookup user by mobile (for DMs): `topapi_v2_user_getbymobile`+- Send interactive cards: `Card.Instance.Write`+- Streaming card updates (essential for AI scenarios): `Card.Streaming.Write`-## 4. Publish+#### 4. Publish the App & Bot-### Step 1: Save and publish+##### Step 1: Save and Publish the Bot-- Save bot settings.-- **Version & publish** → publish with notes and scope.+- On the bot configuration page, click **Save**+- Return to the app homepage, click **Version management & release** → **Publish**+- Fill in the version number, update log, visibility scope, etc.-### Step 2: Confirm+##### Step 2: Confirm Publishing++- Click **Confirm publish**+- Status changes to **Published** and the bot is ready to use-- After **Published**, the bot can be used in DingTalk.+> 💡 After publishing, search the bot name in the DingTalk client to add it to group chats or DMs.-> After publishing, search the bot name in DingTalk to add it to chats.-## 5. Configure DingTalk in JiuwenSwarm+#### 5. Configure DingTalk Channel-Copy **Client ID** and **Client Secret** from **Credentials**.+Copy **Client ID** and **Client Secret** from **Credentials & basic info**.-In JiuwenSwarm **Channels → DingTalk**, enable and paste **client_id** / **client_secret**, then save.+In JiuwenSwarm, open **Channels → DingTalk**, enable it, and configure **client_id** and **client_secret**, then save:-# WeCom (WeChat Work)-## 1. Create a bot in WeCom-1. Open WeCom → **Workbench** → **Smart bot** → **Create bot** → **Manual creation**+### WeCom (WeChat Work)++#### 1. Create a Bot in WeCom++1. Open the WeCom client, go to **Workbench** → **Smart bot**, click **Create bot** → **Manual creation**@@ -367,62 +439,63 @@ In JiuwenSwarm **Channels → DingTalk**, enable and paste **client_id** / **cli-2. Choose **API mode**.+2. On the creation page, select **API mode**-3. Set connection to **Long connection**.+3. On the API configuration page, select **Long connection** as the connection method-4. After creation, save **Bot ID** and **Secret** for JiuwenSwarm.+4. After configuration, the page will automatically generate and display **Bot ID** and **Secret** — save these securely (needed for linking with JiuwenSwarm later)-## 2. Link JiuwenSwarm+#### 2. Link JiuwenSwarm-1. In JiuwenSwarm, open **Channels** → **WeCom**.+1. In JiuwenSwarm, open **Channels** and select **WeCom**.-2. Enter **bot id** and **secret**, then save.+2. Enter the **botId** and **secret** saved in step 1, then click save.-## 3. Chat with the bot+#### 3. Chat with the WeCom Bot-> If you cannot find the bot: **Workbench → Smart bot → Details → Use → Send message**.+> ⚠️ **Note**: If you cannot find the bot after configuration, navigate to: Workbench → Smart bot → Details → Use → Send message.-1. On PC WeCom, send a test message; a reply means success.+1. In WeCom, find the newly added bot, send a test message — receiving a reply means the connection is successful.-2. On mobile WeCom, do the same.+2. On mobile WeCom, send a test message — receiving a reply means the connection is successful.+-## 4. Enable Group Digital Avatar (optional)+#### 4. Enable Group Digital Avatar (Optional)After completing the basic WeCom bot setup, you can enable the digital avatar feature.> ⚠️ **Note**: In WeCom, group messages must **@mention the bot** for the bot to receive them. Messages that do not @mention the bot will not trigger the digital avatar.-### Prerequisites+##### Prerequisites- WeCom bot has been created and linked to JiuwenSwarm-- Bot has been added to the target group: open WeCom, enter the group, tap add member → **Group bots** → **Smart bot**, and search for your app+- Bot has been added to the target group: open WeCom, enter the group, tap add member → **Group bots** → **Smart bot**, and search for your app name-### Configuration steps+##### Configuration Steps-1. In the JiuwenSwarm channel management page, open the WeCom channel settings and enable the **`group_digital_avatar`** toggle. Configure **`my_user_id`** and **`bot_name`**. Before enabling the digital avatar, you need to have a private chat with the robot once; otherwise, an error message `[AiBotSDK] [WARN] Reply ack error` will be reported.+1. In the JiuwenSwarm channel management page, open the WeCom channel settings and enable the **`group_digital_avatar`** toggle. Configure **`my_user_id`** and **`bot_name`**. Before enabling the digital avatar, you need to have a private chat with the bot once; otherwise, an error `[AiBotSDK] [WARN] Reply ack error` will be reported.2. Set **`my_user_id`** (required): the WeCom account of the user this avatar represents. To obtain it:- Open the [WeCom Admin Console](https://work.weixin.qq.com/wework_admin/login)- - Go to **Contacts → Organization → Department → Member details**- - The **Account** field is the `my_user_id`+ - Go to **Contacts** → **Organization** → **Department** → **Member details**+ - The **Account** field shown on the page is the `my_user_id`@@ -443,8 +516,9 @@ channels:wecom:bot_id: "your Bot ID"secret: "your Secret"+ send_file_allowed: true # Allow sending files (optional)enabled: true- # Group digital avatar+ # Group digital avatar configurationgroup_digital_avatar: truemy_user_id: "account" # WeCom account of the represented userbot_name: "bot name" # Bot display name in the group (optional)@@ -468,7 +542,7 @@ permissions:deny_guidance_message: "This tool is not authorized in digital avatar mode."``````-### Fields+##### Fields| Field | Description ||:------|:------------|@@ -478,179 +552,201 @@ permissions:| `enable_memory` | Enable group chat memory. When on, the bot can read and search local memory files in group chats; memory is not written in group chats || `owner_scopes` | Tool permissions scoped by `channel_id` + `user_id`. Supports `allow` / `deny`; `ask` is automatically downgraded to `deny` in avatar mode. Web UI configuration is recommended |-# Telegram-## 1. Create a bot++### Telegram++#### 1. Create a Telegram BotUse [@BotFather](https://t.me/BotFather) to create a bot and get a **Bot Token**.-Step 1: open `@BotFather`.+Step 1: Search for `@BotFather` in Telegram and open the conversation.-Step 2: send `/newbot` and follow prompts.--You will set:+Step 2: Send `/newbot` and follow the prompts.-- **Display name** (e.g. `JiuwenSwarm Bot`)-- **Username** (must end with `bot`, e.g. `jiuwenswarm_bot`)+BotFather will ask you to enter:+- **Bot display name** (e.g. `JiuwenSwarm Bot`)+- **Bot username** (must end with `bot`, e.g. `jiuwenswarm_bot`)-Step 3: **Save the token** (format like `123456789:ABCDefGhIJKlmN...`).+Step 3: **Save the Bot Token**-> The token is a password for the bot — do not leak it. Use `/revoke` in BotFather if exposed.+After creation, BotFather returns a token in the format `123456789:ABCDefGhIJKlmN...`. Save it securely — you'll need it for configuration.-## 2. Bind the channel+> ⚠️ **Note**: The Bot Token is equivalent to the bot's password — do not leak it. If the token is exposed, use `/revoke` in BotFather to regenerate it.-**Option A: Web UI**+#### 2. Bind the Channel++**Option A: Web UI (recommended)**-Open **Agent / Channels** → Telegram, paste **Bot Token**, enable, save.+In JiuwenSwarm's frontend, click the **Agent** / **Channels** card, fill in the Bot Token in the Telegram channel module, enable it, and save.-**Option B: `config.yaml`**+**Option B: Edit `config.yaml`**Edit `~/.jiuwenswarm/config/config.yaml`:``````channels:telegram:- bot_token: "<token from BotFather>"+ # Bot Token from @BotFather+ bot_token: "<your Bot Token>"+ # User whitelist (Telegram user_id); empty allows all usersallow_from: []+ # Message parse mode: Markdown, HTML, Noneparse_mode: Markdown+ # Group chat mode: mention, reply, all, offgroup_chat_mode: mentionenabled: true``````-Reload or start `jiuwenswarm-start`.+If the service is already running it will auto-reload; otherwise run `jiuwenswarm-start`.-## 3. Options+#### 3. Configuration| Field | Description | Default ||:------|:------------|:--------|-| `bot_token` | Bot token from BotFather (**required**) | empty |-| `allow_from` | Allowed Telegram `user_id` list; empty = everyone | `[]` |-| `parse_mode` | `Markdown`, `HTML`, or `None` | `Markdown` |-| `group_chat_mode` | See below | `mention` |-| `enabled` | Enable Telegram | `false` |+| `bot_token` | Bot Token from @BotFather (**required**) | empty |+| `allow_from` | Allowed Telegram `user_id` whitelist; empty = all users | `[]` |+| `parse_mode` | Message parse mode: `Markdown`, `HTML`, or `None` (plain text) | `Markdown` |+| `group_chat_mode` | Group chat response mode (see details below) | `mention` |+| `enabled` | Enable Telegram channel | `false` |++##### Group Chat Modes-### Group modes+When the bot is added to a Telegram group, `group_chat_mode` controls how the bot responds to group messages:-| Mode | Behavior |-|:-----|:---------|-| `mention` | Only when the bot is @mentioned (recommended) |-| `reply` | Only when replying to the bot |-| `all` | All text messages in the group |-| `off` | Ignore group messages |+| Mode | Description |+|:-----|:------------|+| `mention` | **Only respond to @mentions**: only processes messages when the bot is @mentioned (recommended) |+| `reply` | **Only respond to replies**: only processes messages that reply to the bot |+| `all` | **Respond to all messages**: all text messages in the group are processed |+| `off` | **Disable group chat**: no messages are responded to in the group |-## 4. Start chatting+#### 4. Start Chatting-DM the bot or add it to a group per `group_chat_mode`.+**Option 1:** Search for your bot's username in Telegram and send a message to start chatting.+**Option 2:** Add the bot to a group and interact based on the `group_chat_mode` setting.+-## 5. Find `user_id` (allowlist)+#### 5. Get `user_id` (Whitelist)++To configure the `allow_from` whitelist, you need to obtain the user's Telegram `user_id`:-1. Message `@userinfobot` to get your id.-2. Put ids in `allow_from`:+1. Search for `@userinfobot` in Telegram and send any message to get your `user_id`.++2. Add the obtained `user_id` to the `allow_from` list:``````channels:telegram:- bot_token: "<token>"+ bot_token: "<your Bot Token>"allow_from:- - "123456789"- - "987654321"+ - "123456789" # User A's user_id+ - "987654321" # User B's user_idenabled: true``````-> Empty `allow_from` allows everyone; non-empty restricts to listed users.+> 💡 **Tip**: When `allow_from` is an empty list, all users can use the bot. After setting a whitelist, only users in the list can chat with the bot.+-# Discord-Discord is supported. Configure in **Channel management** or edit `config.yaml`.+### Discord-**Step-by-step guide** (Developer Portal, intents, install link, channel management): see [Discord.md](Discord.md).+Discord channel integration is supported in the current version. Configure and enable the Discord Bot in **Channel Management**, or manually edit `config.yaml`.+### For step-by-step instructions (Developer Portal bot creation, intents, install link, channel management), see [Discord.md](Discord.md).++Configuration fields:- `bot_token`- `application_id`- `guild_id`- `channel_id`+- `block_dm`- `allow_from`- `enabled`-Example `~/.jiuwenswarm/config/config.yaml`:+Configure in `~/.jiuwenswarm/config/config.yaml` as follows:``````channels:discord:bot_token: "Discord Bot Token"application_id: "Application ID"- guild_id: "Guild ID"- channel_id: "Channel ID"+ guild_id: "Target server Guild ID"+ channel_id: "Target channel Channel ID"+ block_dm: falseallow_from: []- enabled: false+ enabled: true``````-## Usage+#### Quick Start Guide-1. Create a bot in the Discord Developer Portal; copy `bot_token`.-2. Enable **Message Content Intent** for the bot.-3. Invite the bot to the server with channel permissions.-4. Fill JiuwenSwarm and set `enabled: true`.+1. Create a Bot in the Discord Developer Portal and get the `bot_token`+2. On the Bot tab, enable **Message Content Intent**+3. Invite the bot to the target server and grant read/write channel permissions+4. Fill in the configuration in JiuwenSwarm and enable `enabled: true`-## Fields+#### Fields-| Field | Description |-|:------|:------------|-| `bot_token` | Discord bot token (required) |-| `application_id` | Application id (optional, recommended) |-| `guild_id` | Limit to one server (optional; empty = any) |-| `channel_id` | Limit listen/reply to one channel (optional) |-| `allow_from` | Allowed Discord user ids; empty = all |-| `enabled` | Enable Discord channel |+| Field | Description | Default |+|:------|:------------|:--------|+| `bot_token` | Discord Bot Token (required) | empty |+| `application_id` | Application ID (optional, recommended) | empty |+| `guild_id` | Listen only to the specified server (optional; empty = no restriction) | empty |+| `channel_id` | Listen/reply only to the specified channel (optional; empty = reply based on message context) | empty |+| `block_dm` | When `true`, DMs are not processed | `false` |+| `allow_from` | Allowed Discord user ID list; empty list means all users are allowed | `[]` |+| `enabled` | Enable Discord channel | `false` |-# Personal WeChat-## 1. Prerequisites-- You are an **Android** or **iOS** user.-- Or, you are a **HarmonyOS** user and can use **ZhuoYiTong**.-- Due to restrictions on WeChat, long-term inactivity in WeChat has prevented scheduled tasks from being sent. It is recommended to set up scheduled tasks via alternative channels.+### Personal WeChat-## 2. Android / iOS Setup+#### 1. Prerequisites-### Step 1: Upgrade WeChat+- You are an **Android** or **iOS** user+- You are a **HarmonyOS** user and don't mind using **Zhuoyitong**+- Due to current Personal WeChat limitations, scheduled tasks cannot be sent after a long period of inactivity in Personal WeChat. It is recommended to use other channels for scheduled tasks.-- In WeChat, go to **Me** -> **Settings** -> **About WeChat** -> **Version Update**:- - iOS upgrade to the latest `8.0.70` version.- - Android upgrade to the latest `8.0.69` version.+> 💡 **Tip**: After a user sends a message to ClawBot, the app can send up to **10** independent messages to that user (including the reply message). If the user sends another message to ClawBot, the quota resets to 10.-+#### 2. Android or iOS Setup+##### Step 1: Upgrade WeChat Version-### Step 2: Connect via WeChat QR Scan+In WeChat, go to **Me** → **Settings** → **About WeChat** → **Version Update**:+- iOS: upgrade to the latest version+- Android: upgrade to the latest version-- In the latest JiuwenSwarm frontend, go to **Channels** -> **WeChat**, enable WeChat configuration, and click **Save**. A QR code will be displayed.+-+##### Step 2: Scan QR Code to Connect++- Open the latest version of JiuwenSwarm frontend, click **Channels** → **WeChat**, enable the WeChat configuration and save. A **QR code** will appear on the page.-- On your phone, open WeChat and go to **+** -> **Start Scanning**, scan the QR code generated in the previous step to finish the connection.++- Open WeChat on your phone, tap the **+** in the top right → **Scan**, scan the QR code generated in the previous step, and follow the prompts to complete the connection.-## 3. HarmonyOS Setup+#### 3. HarmonyOS Setup-Native HarmonyOS WeChat does not currently support **ClawBot**. You can still connect through **ZhuoYiTong** as follows:+Since the HarmonyOS WeChat version does not yet support the **ClawBot** feature, **native HarmonyOS WeChat cannot currently be connected**. However, users can connect through **Zhuoyitong** by following these steps:-### Step 1: Install WeChat Dual-App+##### Step 1: Install WeChat Dual Account-- Download and install **WeifenShen Dual-App** via **ZhuoYiTong**, then sign in to WeChat again.+- Download **WeChat Dual Account** through **Zhuoyitong** and log in to WeChat again.-### Step 2: Upgrade and Connect+##### Step 2: Upgrade & Connect- Follow the same upgrade and connection steps as in **Android / iOS Setup**.diff --git "a/docs/zh/\351\242\221\351\201\223.md" "b/docs/zh/\351\242\221\351\201\223.md"index 755be6433f..7872c78487 100644--- "a/docs/zh/\351\242\221\351\201\223.md"+++ "b/docs/zh/\351\242\221\351\201\223.md"@@ -87,6 +87,8 @@ JiuwenSwarm 在**飞书**和**企业微信**频道中支持**群聊数字分身*+> 💡 **说明**:`api_id` 是触发器的 API 标识,`push_id` 是用于接收推送消息的标识。启用 push 通知时,两者需配合使用,缺一不可。+#### 2. 绑定频道### 方式一:网页配置@@ -108,6 +110,13 @@ channels:sk: "小艺平台凭证 sk"agent_id: "创建的agent ID"api_id: "创建的触发器apiId"+ push_id: "触发器的 push_id(与 api_id 配合使用,启用 push 通知时必填)"+ uid: "" # 用户标识(可选)+ api_key: "" # API 密钥(可选)+ push_url: "" # 推送 URL(可选)+ file_upload_url: "" # 文件上传 URL(可选)+ phone_tools_enabled: false # 是否启用电话工具(可选)+ send_file_allowed: true # 是否允许发送文件(可选)enable_streaming: trueenabled: true``````@@ -163,10 +172,12 @@ channels:1. 左侧选择**权限管理** -> **API 权限**。2. 搜索并开通以下关键权限(用于收发消息):- - `im:message` 相关:以应用的身份发消息、获取用户发给机器人的单聊消息、接收群聊中 @ 机器人消息事件- - `im:resource`:上传图片和文件(用于发送图片/文件给用户)+ - `im:message:send`:以应用的身份发送消息+ - `im:message.p2p_msg:readonly`:获取用户发给机器人的单聊消息+ - `im:message.group_at_msg:readonly`:接收群聊中 @ 机器人消息事件+ - `im:resource:upload`:上传图片和文件(用于发送图片/文件给用户)- `contact:user.employee_id:readonly`:获取用户 ID 信息- - 也可以批量导入权限,参考火山引擎文档中的权限列表+ - 也可以批量导入权限,参考飞书开放平台文档中的权限列表@@ -259,6 +270,7 @@ channels:# 数字分身工具权限配置(按 channel_id + user_id 维度)permissions:owner_scopes:+ # channel_id:单 bot 场景使用 "feishu",多 bot 场景使用 "feishu_enterprise:<app_id>"feishu:"ou_xxxx": # 与上方 my_user_id 一致defaults:@@ -276,10 +288,10 @@ permissions:6\. 飞书机器人需要新增以下权限:- - `im:message.group_msg` - 获取群组中所有消息(敏感权限)+ - `im:message.group_msg:readonly` - 获取群组中所有消息(敏感权限)- `contact:contact.base:readonly` - 获取通讯录基本信息- `contact:user.base:readonly` - 获取用户基本信息- - `im:message.p2p_msg:readonly` - 获取用户发给机器人的单聊消息+ - `im:message.p2p_msg:readonly` - 获取用户发给机器人的单聊消息(用于接收单聊消息事件)### 配置项说明@@ -506,6 +518,7 @@ channels:wecom:bot_id: "你的 Bot ID"secret: "你的 Secret"+ send_file_allowed: true # 是否允许发送文件(可选)enabled: true# 群聊数字分身配置group_digital_avatar: true@@ -686,15 +699,15 @@ channels:#### 字段说明-| 配置项 | 说明 |-|:------|:-----|-| `bot_token` | Discord Bot Token(必填) |-| `application_id` | 应用 ID(可选,建议填写) |-| `guild_id` | 仅监听指定服务器(可选,留空表示不限制) |-| `channel_id` | 仅监听/回复指定频道(可选,留空按消息上下文回复) |-| `block_dm` | 为 `true` 时不处理私信(DM) |-| `allow_from` | 允许访问的 Discord 用户 ID 列表,空列表表示允许所有 |-| `enabled` | 是否启用 Discord 频道 |+| 配置项 | 说明 | 默认值 |+|:------|:-----|:------|+| `bot_token` | Discord Bot Token(必填) | 空 |+| `application_id` | 应用 ID(可选,建议填写) | 空 |+| `guild_id` | 仅监听指定服务器(可选,留空表示不限制) | 空 |+| `channel_id` | 仅监听/回复指定频道(可选,留空按消息上下文回复) | 空 |+| `block_dm` | 为 `true` 时不处理私信(DM) | `false` |+| `allow_from` | 允许访问的 Discord 用户 ID 列表,空列表表示允许所有 | `[]` |+| `enabled` | 是否启用 Discord 频道 | `false` |