feat: Add debug command for testing AI tag transformation

This commit is contained in:
Slipstream 2025-05-29 22:42:16 -06:00
parent 5a618f80a0
commit ed3e564739
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -298,6 +298,25 @@ class Rule34Cog(GelbooruWatcherBaseCog): # Removed name="Rule34"
# No defer needed if _watch_remove_logic handles it or is quick
await self._watch_remove_logic(interaction, subscription_id)
@app_commands.command(name="rule34debug_transform", description="Debug command to test AI tag transformation.")
@app_commands.describe(tags="The tags to test transformation for (e.g., 'hatsune miku')")
async def rule34debug_transform(self, interaction: discord.Interaction, tags: str):
await interaction.response.defer(ephemeral=True, thinking=True)
transformed_tags = await self._transform_tags_ai(tags)
if transformed_tags is None:
response_content = f"AI transformation failed for tags: `{tags}`. Check logs for details."
elif not transformed_tags:
response_content = f"AI returned empty for tags: `{tags}`. Please try rephrasing."
else:
response_content = (
f"Original tags: `{tags}`\n"
f"Transformed tags: `{transformed_tags}`"
)
await interaction.followup.send(response_content, ephemeral=True)
async def setup(bot: commands.Bot):
await bot.add_cog(Rule34Cog(bot))
log.info("Rule34Cog (refactored) added to bot.")