fix(qqbot): refactor C2C media routing and fix event loop binding issues - #35153
Closed
zz327455573 wants to merge 2 commits into
Closed
fix(qqbot): refactor C2C media routing and fix event loop binding issues#35153zz327455573 wants to merge 2 commits into
zz327455573 wants to merge 2 commits into
Conversation
Automated Triage: Merge BlockerThis PR is submitted from the |
23 tasks
zz327455573
added a commit
to zz327455573/hermes-agent
that referenced
this pull request
Jul 30, 2026
- adapter.py: Add active instance registry (ClassVar singleton) so send_message_tool can reach the running QQAdapter without importing internal gateway state. Move asyncio.Lock() creation from __init__ to connect() to avoid 'no running event loop' errors. - adapter.py: Refactor send() to extract MEDIA: tags and deliver images/audio/video/documents natively via the QQ Bot API before sending remaining text content. - send_message_tool.py: Replace REST-based _send_qqbot() (manual token + httpx + 3 endpoint fallback) with adapter-based approach that delegates to the running QQAdapter singleton via get_active_adapter(). This fixes C2C message routing and eliminates event loop conflicts. - send_message_tool.py: Add QQBot to the media-capable platform list alongside telegram, discord, matrix, weixin, signal, yuanbao, feishu. Closes NousResearch#35153
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the media delivery failure in the QQBot platform and resolves an event loop conflict.
Key Changes:
send_message_tool.pyto injectMEDIA:andVOICE:tags for the QQ channel, delegating the actual upload and delivery to the runningQQAdaptersingleton.asyncio.Lock()inQQAdapterfrom__init__toconnect()to prevent "Task attached to a different loop" errors during gateway reconnects.测试环境 (Test Environment):
中文说明
修复了跨通道发多媒体报错以及 QQBot 异步锁冲突的 Bug。
asyncio.Lock()的创建推迟到connect()中,避免了网关重连时的协程锁崩溃问题。