fix(messaging): correct Weixin personal account labeling

This commit is contained in:
Diyon18 2026-06-14 18:42:51 +08:00 committed by Teknium
parent efbe1635dd
commit 288f7026e3
4 changed files with 34 additions and 11 deletions

View file

@ -527,7 +527,7 @@ const PLATFORM_INTRO: Record<string, string> = {
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.',

View file

@ -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。',

View file

@ -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": {

View file

@ -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