GithubHelp home page GithubHelp logo

regulad / discordnpc Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 1.0 164 KB

DiscordNPC lets you interact with ChatGPT through a Discord voice channel, enabling a natural conversation.

License: GNU General Public License v3.0

Python 100.00%
assemblyai chatgpt chatgpt-api chatgpt-python discord-chatbot py-cord speech-to-text text-to-speech

discordnpc's Introduction

DiscordNPC

Project Status: Concept โ€“ Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept.

wakatime

DiscordNPC lets you interact with ChatGPT through a Discord voice channel, enabling a natural conversation.

Entirely stateless, and the bot will start a new conversation when it is removed from the call and placed back in.

It also includes a simple Discord command for asking questions.

Powered by google-speech, acheong08/ChatGPT, and py-cord.

Video Demo

YouTube Link

Issues

There are many sources of latency, mainly the ChatGPT "API" and the AssemblyAI real-time transcription API. This leads to some long waiting times, but it works.

Additionally, ChatGPT has very low rate limits and will return a 429 error if you send too many requests. This is not handled by the bot, so you will have to wait for the rate limit to reset.

I implemented a rate limiter in the bot, but it is not very effective. It just says "I lost my train of thought. Give me a minute to get back on track..." right now.

Installation

All manual baby! This project is a proof of content and does not currently include a Dockerfile.

Install with poetry install --no-root --without dev and you will be good to go.

Some project dependencies have native dependencies:

  • SoX
  • SoX MP3 Support
    • Debian package: libsox-fmt-mp3
    • MacOS brew: brew install sox --with-lame
    • It is hard to find Windows DLLs, so I included a /bin folder in the repository with the DLLs I found to work.
  • ffmpeg

Configuration

Environment Variables

  • CHATGPT_*: Configuration for acheong08/ChatGPT. Arguments are analogous to the config.json format defined in this wiki page for the ChatGPT python wrapper.
    • i.e.: CHATGPT_SESSION_TOKEN is analogous to session_token in the config.json file.
  • DNPC_TOKEN: Discord bot token. Can be created in the Discord Developer Portal.
  • DNPC_WEBHOOK: Discord webhook to log with. Designed for "production" use, not required.
  • DNPC_ASSEMBLY_TOKEN: AssemblyAI token for speech-to-text. Required for speech-to-text functionality. Can be obtained on the app dashboard.
    • You'll need to have a paid account to use the real-time transcription.
    • If you know an alternative to AssemblyAI that is free, tell me on Discord: @regulad#7959

Execution

After setting the required environment variables, run poetry run python -m discordnpc to start the bot.

Usage

DiscordNPC provides 2 Discord slash commands:

  • /ask: Ask a simple question to ChatGPT.
  • /join: Start a conversation in the voice channel you are currently connected to.

discordnpc's People

Contributors

regulad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

annias

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.