Skip to content

Latest commit

 

History

History
123 lines (87 loc) · 4.96 KB

README.md

File metadata and controls

123 lines (87 loc) · 4.96 KB

pBot

Version 0.1.31

Warning: This project is pre version 1!

Development

Application Structure

pBot is broken into 3 services.

  • Admin - web UI for bot administration and experimentation (see sandbox).
  • Listener - handles interactions with discord. Collects incoming messages, sends any responses.
  • Bot - the bot proper. Evaluates messages. Conditionally makes calls to AI.
                             ┌──────────┐
                             │ Discord  │
                             └──────────┘
                                   ▲
               ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
                Docker             ▼
               │              ┌────────┐               │
                              │Listener│
               │              │Service │               │
                              └────────┘
               │                   ▲                   │
┌──────────┐                       │
│  OpenAI  │◀─┐│  ┌────────┐       ▼       ┌────────┐  │
└──────────┘  │   │  Bot   │    ┌─────┐    │ Admin  │
              ├┼─▶│Service │◀──▶│Redis│◀──▶│Service │  │
┌──────────┐  │   └────────┘    └─────┘    └────────┘
│Midjourney│◀─┘│                                       │
└──────────┘    ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─

Model Structure

.

Dependencies

Python

Dependency Admin Service Bot Service Listener Service
discord
Flask
openai
pylint
pytest
python-dotenv
ratelimit
tiktoken
redis-py

Front-End

Dependency Admin Service Bot Service Listener Service
Bootstrap 5

Contributing

Fork & submit a pull request. I'll try to reply quickly. 🙏

Design Philosophy

While there is stil much to do, pBot is meant to be a simple bot framework on which you can experiment and build. Dependencies and patterns have been chosen to this end. Always keep the novice developer in mind. As tempting as it might be to write clever code, doing so probably wont do newer developers any favors.

Code Quality

  • Write code for humans first, machines second.
  • Comments should explain why, not how.
  • Code should be written as self-documenting as possible.
  • Code should have tests behind it and those tests must pass!
  • Pylint should pass 100%. You can ignore a rule if there is a good reason (dependency causes ignorable issue) but document why.

Helpful Third Party Documentation

OpenAI

Discord

Midjourney

Future Bard Stuff

Misc.

TODO:

  • Handle a monthly token allotment. Ration AI responses for both openai and midjourney.
  • Image "mirroring"
  • More robust multi-call decision making?
  • rate limiting
  • Incite chaos!
  • document invoke usage