Coder Social home page Coder Social logo

ai_errors's Introduction

AI Errors Reporter

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.

Features

  • 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.

Getting Started

To integrate the AI Errors Reporter into your project, follow these steps:

Prerequisites

  • Garry's Mod Server
  • Access to a Discord webhook (you can create your own in Discord settings)

Installation

  1. Clone the Repository (if applicable):

    git clone https://github.com/Yogpod/ai_errors
    cd ai_errors
  2. 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.

  3. 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, the ai_errors "set" command can be used to set the webhook URL from console. gmod_Nn1QPmJxeo

  4. 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, the ai_errors "set" command can be used to set the webhook URL from console. OpenAI API Key Help

    You can also use anthropic's claude, just set a claude API key in the config file. Claude API Key Help

Usage

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.

Example Error Handling

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.
1 2 3

Contributing

Contributions are welcome! Please feel free to submit a pull request or report issues.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/YourFeature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature/YourFeature)
  5. Open a pull request

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Acknowledgments

  • 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.

Contact

For any questions or feedback, feel free to create an issue.

ai_errors's People

Contributors

yogpod avatar noahbg avatar

Stargazers

Kashakov avatar

Watchers

 avatar

Forkers

noahbg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.