mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix(wecom): visible poll progress + clearer no-bot-info failure + docstring note
Follow-ups on top of salvaged #13923 (@keifergu): - Print QR poll dot every 3s instead of every 18s so "Fetching configuration results..." doesn't look hung. - On "status=success but no bot_info" from the WeCom query endpoint, log the full payload at WARNING and tell the user we're falling back to manual entry (was previously a single opaque line). - Document in the qr_scan_for_bot_info() docstring that the work.weixin.qq.com/ai/qc/* endpoints are the admin-console web-UI flow, not the public developer API, and may change without notice. Also add keifergu@tencent.com to scripts/release.py AUTHOR_MAP so release notes attribute the feature correctly.
This commit is contained in:
@@ -1488,6 +1488,11 @@ def qr_scan_for_bot_info(
|
|||||||
|
|
||||||
Returns ``{"bot_id": ..., "secret": ...}`` on success, ``None`` on
|
Returns ``{"bot_id": ..., "secret": ...}`` on success, ``None`` on
|
||||||
failure or timeout.
|
failure or timeout.
|
||||||
|
|
||||||
|
Note: the ``work.weixin.qq.com/ai/qc/{generate,query_result}`` endpoints
|
||||||
|
used here are not part of WeCom's public developer API — they back the
|
||||||
|
admin-console web UI's bot-creation flow and may change without notice.
|
||||||
|
The same pattern is used by the feishu/dingtalk QR setup wizards.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import urllib.request
|
import urllib.request
|
||||||
@@ -1561,8 +1566,8 @@ def qr_scan_for_bot_info(
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
poll_count += 1
|
poll_count += 1
|
||||||
if poll_count % 6 == 0:
|
# Print a dot on every poll so progress is visible within 3s.
|
||||||
print(".", end="", flush=True)
|
print(".", end="", flush=True)
|
||||||
|
|
||||||
result_data = result.get("data") or {}
|
result_data = result.get("data") or {}
|
||||||
status = str(result_data.get("status") or "").lower()
|
status = str(result_data.get("status") or "").lower()
|
||||||
@@ -1574,8 +1579,15 @@ def qr_scan_for_bot_info(
|
|||||||
secret = str(bot_info.get("secret") or "").strip()
|
secret = str(bot_info.get("secret") or "").strip()
|
||||||
if bot_id and secret:
|
if bot_id and secret:
|
||||||
return {"bot_id": bot_id, "secret": secret}
|
return {"bot_id": bot_id, "secret": secret}
|
||||||
logger.warning("WeCom QR: success but missing bot_info: %s", result_data)
|
logger.warning(
|
||||||
print(" QR scan succeeded but bot info was not returned")
|
"WeCom QR: scan reported success but bot_info missing or incomplete: %s",
|
||||||
|
result_data,
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
" QR scan reported success but no bot credentials were returned.\n"
|
||||||
|
" This usually means the bot was not actually created on the WeCom side.\n"
|
||||||
|
" Falling back to manual credential entry."
|
||||||
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
time.sleep(_QR_POLL_INTERVAL)
|
time.sleep(_QR_POLL_INTERVAL)
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ AUTHOR_MAP = {
|
|||||||
"71184274+MassiveMassimo@users.noreply.github.com": "MassiveMassimo",
|
"71184274+MassiveMassimo@users.noreply.github.com": "MassiveMassimo",
|
||||||
"massivemassimo@users.noreply.github.com": "MassiveMassimo",
|
"massivemassimo@users.noreply.github.com": "MassiveMassimo",
|
||||||
"82637225+kshitijk4poor@users.noreply.github.com": "kshitijk4poor",
|
"82637225+kshitijk4poor@users.noreply.github.com": "kshitijk4poor",
|
||||||
|
"keifergu@tencent.com": "keifergu",
|
||||||
"kshitijk4poor@users.noreply.github.com": "kshitijk4poor",
|
"kshitijk4poor@users.noreply.github.com": "kshitijk4poor",
|
||||||
"kshitijk4poor@gmail.com": "kshitijk4poor",
|
"kshitijk4poor@gmail.com": "kshitijk4poor",
|
||||||
"16443023+stablegenius49@users.noreply.github.com": "stablegenius49",
|
"16443023+stablegenius49@users.noreply.github.com": "stablegenius49",
|
||||||
|
|||||||
Reference in New Issue
Block a user