AI Errors Reporter is a Lua-based error reporting tool that utilizes AI to diagnose and suggest fixes for code errors. The tool is designed to use errors in gmod and captures stack traces for deeper analysis. It reports these errors and fixes from chatGPT to a specified Discord webhook.
- Error Reporting: Automatically captures and reports errors that occur within designated realms in a game or server.
- User-friendly Diagnosis: Integrates with AI to provide concise diagnostic messages and suggested fixes for the errors reported.
- Repetitive Error Detection: Monitors players for repetitive error reporting, suppressing further reports after a specified threshold.
- Contextual Error Lines: Captures relevant lines of code around the error and sends it to the AI for analysis.
- Discord Integration: Sends a formatted error analysis report to a specified Discord channel via webhook.
To integrate the AI Errors Reporter into your project, follow these steps:
- Garry's Mod Server
- Access to a Discord webhook (you can create your own in Discord settings)
-
Clone the Repository (if applicable):
git clone https://github.com/Yogpod/ai_errors cd ai_errors
-
Add the Code to Your Project: Copy the code provided into your addons folder. Ensure that reqwest or chttp is within lua/bin if you care about discord messages.
-
Set Up Discord Webhook: In the
ai_errors/server/sv_config.lua
folder, set your Discord webhook URL:ai_errors.webhook = "YOUR_DISCORD_WEBHOOK_URL"
This is also available in the GUI, opened by command
ai_errors_config
shown below. In addition, theai_errors
"set" command can be used to set the webhook URL from console. -
Set Up API Key: In the
ai_errors/server/sv_config.lua
folder, set your API key:ai_errors.apikey = "YOUR_AI_API_KEY"
This is also available in the GUI, opened by command
ai_errors_config
shown above. In addition, theai_errors
"set" command can be used to set the webhook URL from console. OpenAI API Key HelpYou can also use anthropic's claude, just set a claude API key in the config file. Claude API Key Help
When errors occur, they are automatically reported using the ai_errors.reportError
function. This function will handle:
- Reporting errors only once.
- Counting repetitive errors per player.
- Fetching relevant code context around the error for better diagnosis.
- Sending a formatted report to the configured Discord channel.
You can customize the number of repeated errors before suppression by modifying the threshold in the provided code.
When an error is reported, the following data is formatted and sent to Discord:
- Error message and realm.
- Player information if applicable.
- Relevant lines of code surrounding the error.
Contributions are welcome! Please feel free to submit a pull request or report issues.
- Fork the repository
- Create your feature branch (
git checkout -b feature/YourFeature
) - Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feature/YourFeature
) - Open a pull request
This project is licensed under the MIT License. See the LICENSE file for more details.
- Thanks to the developers at OpenAI for the AI models used in this project.
- Thanks to the developers at Anthropic for the AI models used in this project.
- Thanks to the Discord team for providing webhook support.
For any questions or feedback, feel free to create an issue.