fix: de-anonymize User1/User2 references in notes and reasoning text

The LLM returns note_update, reasoning, and worst_message with
anonymized names. These are now replaced with real display names
before storage, so user profiles no longer contain meaningless
User1/User2 references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 10:51:30 -05:00
parent 88536b4dca
commit 3b2de80cac

View File

@@ -292,6 +292,13 @@ class SentimentCog(commands.Cog):
anon_name = finding.get("username", "")
if anon_name in reverse_map:
finding["username"] = reverse_map[anon_name]
# De-anonymize text fields that may reference other users
for field in ("note_update", "reasoning", "worst_message"):
text = finding.get(field)
if text:
for anon, real in reverse_map.items():
text = text.replace(anon, real)
finding[field] = text
@staticmethod
def _build_conversation(