Giter Site home page Giter Site logo

gpbot's Introduction

Great programmers bot

IRC bot for quick testing and comparing of code in different languages.

Currently supported interpreters (see also src/interpreters)

  • hs Haskell (ghci)
  • rs Rust (runner)
  • py Python (python)
  • js JavaScript (bun)
  • ts TypeScript (ts-node)
  • erl Erlang (erlang)
  • ml OCaml (ocaml)
  • ex Elixir (elixir)
  • rb Ruby (ruby)

Run

Run a snippet in a language.

js> 1 + 1

This outputs (ok) 2.

Explain

Run and explain a snippet in a language using OpenAI's API.

js?> 1 + 1

This outputs

(ok) 2
(gpt) This code is a simple mathematical expression that adds 1 and 1 together,
resulting in the answer of 2.

Depending on how you set the temperature (see below) for OpenAI, this answer may vary slightly.

Review

Run a code review using OpenAI's API. Currently supported are dpaste.com, dpaste.org and github.com.

!review https://github.com/terrablue/gpbot/blob/master/package.json

A typical output, depending on the temperature (see below) set for OpenAI, may be

This code appears to be a package.json file for a project called gpbot. It
contains information about the project, such as the author, repository,
description, license, type, and scripts. It also lists the dependencies and
devDependencies that are required for the project.

You may also pass additional comments for OpenAI in order to influence how it analyzes the code. This can come in handy if you want it to look at just one segment of a larger file.

!review https://github.com/terrablue/gpbot/blob/master/package.json license?

A typical output should be

This code is licensed under the MIT license.

React to GitHub webhooks

The bot can react to different webhook events. Currently supported are issue creation, commit pushes, and commenting on commits.

The bot uses the POST / path to receive those webhook events, generate shortened links to GitHub and report the event in the given channels. If you're running your own instance of gpbot, make sure to enter your fully qualified domain under baseuri.

To have the bot receive webhook events, create a webhook in your repository, add a secret, and set the webhook to send any combination of the following events:

  • Issues (issues)
  • Pushes (push)
  • Commit comments (commit_comment)
  • Releases (release)

In your configuration file, add the repository under github (see example) and configure secret and channels to report to. If you have several repositories monitored in the same channel, you can assign them different colors (00 to 15).

If you want to just subscribe to certain branches, add branches and a list of branches. Otherwise pushes from all branches will be reported.

Example configuration

Create a conf.json in root.

{
  "irc": {
    "network": "irc.libera.chat",
    "user": "gpbot",
    "channels": {
      "#gpbot": {
        "review": true,
        "gpt": true
      }
    }
  },
  "openai": {
    "api_key": "sk-your-openai-key",
    "completion": {
      "max_tokens": 100,
      "model": "text-davinci-003",
      "temperature": 0
    },
    "review": {
      "max_tokens": 100,
      "model": "text-davinci-003",
      "temperature": 0
    }
  },
  "baseuri": "https://gpbot.org",
  "github": {
    "terrablue/gpbot": {
      "color": "07",
      "secret": "your-web-hook-secret",
      "channels": ["#gpbot"]
      "branches": ["master"]
    }
  }
}

The openai key is optional. If not present, the reviews and explanations won't work.

gpbot's People

Contributors

phaleth avatar stagas avatar terrablue avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.