feat(hermes): 接入 polling 路徑 — @tsenyangbot @mention → Hermes NL (ADR-094)
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
_handle_group_message() 新增 Hermes NL 路由: HERMES_NL_ENABLED=true + @tsenyangbot @mention → process_nl_message() → send_hermes_reply(),不影響既有 OpenClaw/NemoClaw 路徑 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5267,6 +5267,31 @@ class TelegramGateway:
|
||||
await self._handle_group_command(cmd, chat_id, message_id, full_text=text.strip())
|
||||
return
|
||||
|
||||
# ── Hermes NL: @tsenyangbot @mention → Claude Agent SDK 12-Agent (ADR-094/095) ──
|
||||
# 2026-04-25 Claude Sonnet 4.6: 接入 polling 路徑,HERMES_NL_ENABLED 控制
|
||||
if settings.HERMES_NL_ENABLED:
|
||||
_bot_un = getattr(settings, "TELEGRAM_BOT_USERNAME", "tsenyangbot")
|
||||
import unicodedata as _uc
|
||||
if f"@{_bot_un}".lower() in _uc.normalize("NFKC", text).lower():
|
||||
_clean = text.replace(f"@{_bot_un}", "").strip()
|
||||
if _clean:
|
||||
from src.hermes.nl_gateway import process_nl_message as _nl
|
||||
try:
|
||||
_reply = await _nl(
|
||||
_clean,
|
||||
chat_id=str(chat_id),
|
||||
user_id=user_id,
|
||||
username=username,
|
||||
)
|
||||
await self.send_hermes_reply(
|
||||
text=_reply,
|
||||
chat_id=str(chat_id),
|
||||
reply_to_message_id=message_id,
|
||||
)
|
||||
except Exception as _hermes_err:
|
||||
logger.error("hermes_nl_polling_failed", error=str(_hermes_err))
|
||||
return
|
||||
|
||||
from src.services.chat_manager import get_chat_manager as _get_cm
|
||||
chat_mgr = _get_cm()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user