From 288f7026e332396ab74641b128ae7c23f7fd0a1d Mon Sep 17 00:00:00 2001 From: Diyon18 Date: Sun, 14 Jun 2026 18:42:51 +0800 Subject: [PATCH] fix(messaging): correct Weixin personal account labeling --- apps/desktop/src/app/messaging/index.tsx | 2 +- apps/desktop/src/i18n/zh.ts | 3 ++- hermes_cli/web_server.py | 18 +++++++++--------- tests/hermes_cli/test_web_server.py | 22 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/apps/desktop/src/app/messaging/index.tsx b/apps/desktop/src/app/messaging/index.tsx index 158360aea88..7fc6ce212ef 100644 --- a/apps/desktop/src/app/messaging/index.tsx +++ b/apps/desktop/src/app/messaging/index.tsx @@ -527,7 +527,7 @@ const PLATFORM_INTRO: Record = { wecom_callback: 'Set up a WeCom self-built app, expose its callback URL, and provide the corp ID, secret, agent ID, and AES key.', weixin: - 'Sign in to the WeChat Official Account platform, copy the AppID and Token, and point the message callback URL at Hermes.', + 'Run `hermes gateway setup`, select Weixin, then scan and confirm the QR code with a personal WeChat account. Hermes connects through Tencent\'s iLink Bot API and saves the credentials.', qqbot: 'Register an app on the QQ Open Platform (q.qq.com) and copy the App ID and Client Secret.', api_server: 'Expose Hermes as an OpenAI-compatible API. Set an auth key, then point Open WebUI / LobeChat / etc. at the host:port.', diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts index 381aac9496e..7fac54c0f7d 100644 --- a/apps/desktop/src/i18n/zh.ts +++ b/apps/desktop/src/i18n/zh.ts @@ -1093,7 +1093,8 @@ export const zh: Translations = { feishu: '创建飞书 / Lark 应用,配置机器人能力,复制 App ID、App secret 和事件加密密钥。', wecom: '在企业微信中添加群机器人,复制其 webhook key 作为 WECOM_BOT_ID。仅可发送——双向请用企业微信 (应用) 选项。', wecom_callback: '设置一个企业微信自建应用,暴露其回调 URL,并提供 corp ID、secret、agent ID 和 AES key。', - weixin: '登录微信公众平台,复制 AppID 和 Token,并把消息回调 URL 指向 Hermes。', + weixin: + '运行 `hermes gateway setup`,选择 Weixin,然后使用个人微信账号扫描并确认二维码。Hermes 会通过腾讯 iLink Bot API 连接并保存凭据。', qqbot: '在 QQ 开放平台 (q.qq.com) 注册一个应用,复制 App ID 和 Client Secret。', api_server: '把 Hermes 暴露为兼容 OpenAI 的 API。设置一个鉴权密钥,然后把 Open WebUI / LobeChat 等指向 host:port。', diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.py index 4450c02af61..0e77b3d7a25 100644 --- a/hermes_cli/web_server.py +++ b/hermes_cli/web_server.py @@ -3856,9 +3856,9 @@ _PLATFORM_OVERRIDES: dict[str, dict[str, Any]] = { ), }, "weixin": { - "name": "WeChat (Official Account)", - "description": "Connect a WeChat Official Account.", - "docs_url": "https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Overview.html", + "name": "Weixin / WeChat (Personal)", + "description": "Connect a personal WeChat account through Tencent's iLink Bot API.", + "docs_url": "https://hermes-agent.nousresearch.com/docs/user-guide/messaging/weixin/", "env_vars": ("WEIXIN_ACCOUNT_ID", "WEIXIN_TOKEN", "WEIXIN_BASE_URL"), "required_env": ("WEIXIN_ACCOUNT_ID", "WEIXIN_TOKEN"), }, @@ -4029,17 +4029,17 @@ _MESSAGING_ENV_FALLBACKS: dict[str, dict[str, Any]] = { "password": True, }, "WEIXIN_ACCOUNT_ID": { - "description": "WeChat Official Account ID", - "prompt": "Account ID", + "description": "iLink Bot account ID obtained through QR login in hermes gateway setup", + "prompt": "iLink Bot account ID", }, "WEIXIN_TOKEN": { - "description": "WeChat callback token", - "prompt": "Token", + "description": "iLink Bot token obtained through QR login in hermes gateway setup", + "prompt": "iLink Bot token", "password": True, }, "WEIXIN_BASE_URL": { - "description": "WeChat platform base URL", - "prompt": "Base URL", + "description": "iLink API base URL saved by QR login (default: https://ilinkai.weixin.qq.com)", + "prompt": "iLink API base URL", }, "FEISHU_APP_ID": {"description": "Feishu / Lark app ID", "prompt": "App ID"}, "FEISHU_APP_SECRET": { diff --git a/tests/hermes_cli/test_web_server.py b/tests/hermes_cli/test_web_server.py index ea3091ed95c..b042c76210e 100644 --- a/tests/hermes_cli/test_web_server.py +++ b/tests/hermes_cli/test_web_server.py @@ -1386,6 +1386,28 @@ class TestWebServerEndpoints: assert telegram["enabled"] is False assert any(field["key"] == "TELEGRAM_BOT_TOKEN" and field["required"] for field in telegram["env_vars"]) + def test_weixin_messaging_metadata_describes_personal_ilink_setup(self): + resp = self.client.get("/api/messaging/platforms") + + assert resp.status_code == 200 + weixin = next( + platform + for platform in resp.json()["platforms"] + if platform["id"] == "weixin" + ) + assert weixin["name"] == "Weixin / WeChat (Personal)" + assert "personal WeChat" in weixin["description"] + assert "Official Account" not in f"{weixin['name']} {weixin['description']}" + assert weixin["docs_url"] == ( + "https://hermes-agent.nousresearch.com/docs/user-guide/messaging/weixin/" + ) + + fields = {field["key"]: field for field in weixin["env_vars"]} + for key in ("WEIXIN_ACCOUNT_ID", "WEIXIN_TOKEN", "WEIXIN_BASE_URL"): + assert "iLink" in fields[key]["description"] + assert "QR login" in fields[key]["description"] + assert "Official Account" not in fields[key]["description"] + def test_messaging_catalog_covers_gateway_platforms(self): """Catalog is derived from the Platform enum, so every built-in shows up.""" from gateway.config import Platform