Commit 1a9d946a by sunqi02

refactor(hooks): remove account_mapping from PostReplyHook

bot_id now sourced exclusively from per-request bot_id_mapping
1 parent d31b8273
...@@ -15,14 +15,9 @@ class IMSender(Protocol): ...@@ -15,14 +15,9 @@ class IMSender(Protocol):
class PostReplyHook(Hook): class PostReplyHook(Hook):
"""Hook triggered after agent generates a reply, sends it via IM""" """Hook triggered after agent generates a reply, sends it via IM"""
def __init__( def __init__(self, im_service: IMSender):
self,
im_service: IMSender,
account_mapping: Dict[str, str]
):
super().__init__("post_reply") super().__init__("post_reply")
self.im_service = im_service self.im_service = im_service
self.account_mapping = account_mapping
async def execute( async def execute(
self, self,
...@@ -38,8 +33,7 @@ class PostReplyHook(Hook): ...@@ -38,8 +33,7 @@ class PostReplyHook(Hook):
if not agent_name or not response_content: if not agent_name or not response_content:
return None return None
# bot_id 优先从请求映射中取,兜底用静态配置 bot_id = bot_id_mapping.get(agent_name)
bot_id = bot_id_mapping.get(agent_name) or self.account_mapping.get(agent_name)
if not bot_id: if not bot_id:
return None return None
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!