diff --git a/src/daemon_boyfriend/cogs/ai_chat.py b/src/daemon_boyfriend/cogs/ai_chat.py index 01a27a5..1be2ddf 100644 --- a/src/daemon_boyfriend/cogs/ai_chat.py +++ b/src/daemon_boyfriend/cogs/ai_chat.py @@ -205,9 +205,13 @@ class AIChatCog(commands.Cog): error: The exception that occurred Returns: - A user-friendly error message + A user-friendly error message with error details """ error_str = str(error).lower() + error_details = str(error) + + # Base message asking for tech wizard + tech_wizard_notice = "\n\n🔧 *A tech wizard needs to take a look at this!*" # Check for credit/quota/billing errors credit_keywords = [ @@ -226,25 +230,39 @@ class AIChatCog(commands.Cog): ] if any(keyword in error_str for keyword in credit_keywords): - return "I'm currently out of API credits. Please try again later or contact the bot administrator." + return ( + f"I'm currently out of API credits. Please try again later." + f"{tech_wizard_notice}" + f"\n\n```\nError: {error_details}\n```" + ) # Check for authentication errors auth_keywords = ["invalid api key", "unauthorized", "authentication", "invalid_api_key"] if any(keyword in error_str for keyword in auth_keywords): return ( - "There's an issue with my API configuration. Please contact the bot administrator." + f"There's an issue with my API configuration." + f"{tech_wizard_notice}" + f"\n\n```\nError: {error_details}\n```" ) # Check for model errors if "model" in error_str and ("not found" in error_str or "does not exist" in error_str): - return "The configured AI model is not available. Please contact the bot administrator." + return ( + f"The configured AI model is not available." + f"{tech_wizard_notice}" + f"\n\n```\nError: {error_details}\n```" + ) - # Check for content policy violations + # Check for content policy violations (no tech wizard needed for this) if "content policy" in error_str or "safety" in error_str or "blocked" in error_str: return "I can't respond to that request due to content policy restrictions." # Default error message - return "Sorry, I encountered an error. Please try again." + return ( + f"Sorry, I encountered an error." + f"{tech_wizard_notice}" + f"\n\n```\nError: {error_details}\n```" + ) def _extract_message_content(self, message: discord.Message) -> str: """Extract the actual message content, removing bot mentions."""