mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
feat(dingtalk): proactive messaging via Robot OpenAPI + send_message_tool media
- Add DingTalk access-token management (_dingtalk_fetch_access_token, _dingtalk_fetch_oapi_token) with process-wide cache, 5 min safety margin, and asyncio.Lock for concurrent safety. - Add _dingtalk_upload_media() — upload local files to /media/upload (legacy OAPI token) with mime auto-detection and 20 MB guard. - Add _dingtalk_classify_chat_id() — route on chat_id shape: 'cidXXX==' → group /groupMessages/send, plain staffId or 'user:<staffId>' → 1:1 /oToMessages/batchSend. - Add dingtalk_send_proactive() orchestrator — text + media delivery. - In send(), fall back to dingtalk_send_proactive() when no session webhook is cached (proactive/cron/cross-platform delivery). - Fix /sethome DM chat_id: persist 'user:<staffId>' instead of DM conversation_id so proactive DM delivery works (gateway/run.py). - Enhance send_message_tool.py: MEDIA:<path> tag extraction, native DingTalk/Feishu routing with media_files support. - Update test assertions for proactive-send error path.
This commit is contained in:
parent
563ed0e61f
commit
8221966ad6
10 changed files with 2190 additions and 42 deletions
|
|
@ -76,7 +76,15 @@ termux = [
|
|||
"hermes-agent[honcho]",
|
||||
"hermes-agent[acp]",
|
||||
]
|
||||
dingtalk = ["dingtalk-stream>=0.20,<1", "alibabacloud-dingtalk>=2.0.0", "qrcode>=7.0,<8"]
|
||||
dingtalk = [
|
||||
"dingtalk-stream>=0.20,<1",
|
||||
"alibabacloud-dingtalk>=2.0.0",
|
||||
"qrcode>=7.0,<8",
|
||||
# File content parsing for rich-media messages (docx/pdf/xlsx)
|
||||
"python-docx>=1.0,<2",
|
||||
"pdfplumber>=0.10,<1",
|
||||
"openpyxl>=3.1,<4",
|
||||
]
|
||||
feishu = ["lark-oapi>=1.5.3,<2", "qrcode>=7.0,<8"]
|
||||
web = ["fastapi>=0.104.0,<1", "uvicorn[standard]>=0.24.0,<1"]
|
||||
rl = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue