fix: skip LLM call for group messages without @bot
Only forward group chat messages to OpenClaw LLM when the bot is @-mentioned. Non-@ messages are still saved to history but no longer consume API calls or tokens.
This commit is contained in:
@ -385,6 +385,13 @@ class OpenClawBridge(BasePlugin):
|
||||
return "ok"
|
||||
|
||||
# ===== 所有用户正常对话(整合后的统一流程)=====
|
||||
# 群聊消息没有@机器人时,不调LLM
|
||||
if self.ctx.group is not None:
|
||||
at_me = f"[CQ:at,qq={self.ctx.rebot_id}]" in self.ctx.raw_message
|
||||
if not at_me:
|
||||
logger.info(f"Group chat without @bot from {sender_id}, skipped LLM call")
|
||||
return
|
||||
|
||||
session_key = self._build_session_key()
|
||||
context_msg = self._build_context_with_history(raw_message, identity_tag)
|
||||
reply = self._send_to_openclaw(context_msg, session_key)
|
||||
|
||||
Reference in New Issue
Block a user