feat: classify mention intent before running expensive scan
Adds LLM triage on bot @mentions to determine if the user is chatting or reporting bad behavior. Only 'report' intents trigger the 30-message scan; 'chat' intents skip the scan and let ChatCog handle it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -103,9 +103,18 @@ class SentimentCog(commands.Cog):
|
||||
or f"<@!{self.bot.user.id}>" in (message.content or "")
|
||||
)
|
||||
if bot_mentioned_in_text:
|
||||
mention_config = config.get("mention_scan", {})
|
||||
if mention_config.get("enabled", True):
|
||||
await self._maybe_start_mention_scan(message, mention_config)
|
||||
# Classify intent: only run expensive mention scan for reports,
|
||||
# let ChatCog handle casual chat/questions
|
||||
intent = await self.bot.llm.classify_mention_intent(
|
||||
message.content or ""
|
||||
)
|
||||
logger.info(
|
||||
"Mention intent for %s: %s", message.author, intent
|
||||
)
|
||||
if intent == "report":
|
||||
mention_config = config.get("mention_scan", {})
|
||||
if mention_config.get("enabled", True):
|
||||
await self._maybe_start_mention_scan(message, mention_config)
|
||||
return
|
||||
|
||||
# Skip if empty
|
||||
|
||||
Reference in New Issue
Block a user