fix: sanitize note_updates before storing in sentiment pipeline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -469,13 +469,14 @@ class SentimentCog(commands.Cog):
|
|||||||
|
|
||||||
# Note update — route to memory system
|
# Note update — route to memory system
|
||||||
if note_update:
|
if note_update:
|
||||||
# Still update the legacy notes for backward compat with analysis prompt
|
# Sanitize before storing — strips any quoted toxic language
|
||||||
self.bot.drama_tracker.update_user_notes(user_id, note_update)
|
sanitized = await self.bot.llm.sanitize_notes(note_update)
|
||||||
|
self.bot.drama_tracker.update_user_notes(user_id, sanitized)
|
||||||
self._dirty_users.add(user_id)
|
self._dirty_users.add(user_id)
|
||||||
# Also save as an expiring memory (7d default for passive observations)
|
# Also save as an expiring memory (7d default for passive observations)
|
||||||
asyncio.create_task(self.bot.db.save_memory(
|
asyncio.create_task(self.bot.db.save_memory(
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
memory=note_update[:500],
|
memory=sanitized[:500],
|
||||||
topics=db_topic_category or "general",
|
topics=db_topic_category or "general",
|
||||||
importance="medium",
|
importance="medium",
|
||||||
expires_at=datetime.now(timezone.utc) + timedelta(days=7),
|
expires_at=datetime.now(timezone.utc) + timedelta(days=7),
|
||||||
|
|||||||
Reference in New Issue
Block a user