Add AI appeal testcases command

This commit is contained in:
Codex 2025-06-07 03:55:42 +00:00 committed by Slipstream
parent 548f20f0f8
commit cf7b7b8109
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -1091,6 +1091,48 @@ class AIModerationCog(commands.Cog):
)
await interaction.response.send_message(embed=embed, ephemeral=False)
@appeal_subgroup.command(
name="testcases",
description="Run sample appeals through the AI review system (admin only).",
)
async def appeal_testcases(self, interaction: discord.Interaction):
"""Run a few hardcoded appeal scenarios through the AI."""
if not interaction.user.guild_permissions.administrator:
await interaction.response.send_message(
"You must be an administrator to use this command.",
ephemeral=True,
)
return
scenarios = [
("Warn for spam", "I got excited and posted too many messages."),
(
"Mute for harassment",
"I was only teasing my friend and didn't mean to harass anyone.",
),
(
"Ban for posting slurs",
"I'm sorry for what I said and promise it will not happen again.",
),
]
results: list[tuple[str, str]] = []
for action, text in scenarios:
result = await self.run_appeal_ai(
interaction.guild, interaction.user, action, text
)
results.append((action, result))
embed = discord.Embed(
title="Appeal AI Test Results", color=discord.Color.green()
)
for action, result in results:
field_text = result if result else "No response"
if len(field_text) > 1000:
field_text = field_text[:997] + "..."
embed.add_field(name=action, value=field_text, inline=False)
await interaction.response.send_message(embed=embed, ephemeral=True)
@model_subgroup.command(
name="set", description="Change the AI model used for moderation (admin only)."
)