Reduce repetitive drama score mentions in chat replies

Only inject drama score/offense context when values are noteworthy
(score >= 0.2 or offenses > 0). Update personality prompt to avoid
harping on zero scores and vary responses more.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 22:57:25 -05:00
parent b04d3da2bf
commit d41873230d
2 changed files with 10 additions and 8 deletions

View File

@@ -96,20 +96,21 @@ class ChatCog(commands.Cog):
if not content:
content = "(just pinged me)"
# Add drama score context to the user message
# Add drama score context only when noteworthy
drama_score = self.bot.drama_tracker.get_drama_score(message.author.id)
user_data = self.bot.drama_tracker.get_user(message.author.id)
score_context = (
f"[Server context: {message.author.display_name} has a drama score of "
f"{drama_score:.2f}/1.0 and {user_data.offense_count} offenses. "
f"They are talking in #{message.channel.name}.]"
)
context_parts = [f"#{message.channel.name}"]
if drama_score >= 0.2:
context_parts.append(f"drama score {drama_score:.2f}/1.0")
if user_data.offense_count > 0:
context_parts.append(f"{user_data.offense_count} offense(s)")
score_context = f"[Server context: {message.author.display_name}{', '.join(context_parts)}]"
self._chat_history[ch_id].append(
{"role": "user", "content": f"{score_context}\n{message.author.display_name}: {content}"}
)
response = await self.bot.llm_heavy.chat(
response = await self.bot.llm.chat(
list(self._chat_history[ch_id]),
CHAT_PERSONALITY,
on_first_token=start_typing,