Skip to content

Conversation

@bakayu
Copy link
Owner

@bakayu bakayu commented Apr 7, 2025

Demo Overview

Note

This PR aims to showcase a prototype/working demo of Devr.AI. Below are some of the implemented features:

Demo Video : link

Architecture

This architecture will be followed for this demo (full architecture can be found here: link):

flowchart TB
    subgraph "External Platforms"
        GH["GitHub"]
        DS["Discord"]
    end

    subgraph "Core Processing Engine"
        EB["Event Bus"]
        HR["Handler Registry"]
    end

    subgraph "AI Services"
        LLM["LLM Service"]
        KR["Knowledge Retrieval"]
    end

    subgraph "Storage"
        VDB["Vector Database"]
        DB["Relational Database"]
    end

    GH --> EB
    DS --> EB

    EB <--> HR
    HR <--> LLM
    HR <--> KR

    LLM <--> VDB
    KR <--> VDB
    HR <--> DB
Loading

Features Implemented

Installation

For installing the project locally refer to the Installation Guide.

1. Event Bus

What it does:

  • Creates a centralized event processing system that handles events from GitHub and Discord.
  • Implements an extensible handler registry for routing events to appropriate handlers.
  • Provides a standardized way to process events asynchronously using asyncio.

Implementation details:

  • Core event bus system with handler registration and dispatching.
  • Support for platform-specific (GitHub, Discord).
  • Global event handlers for cross-platform notifications.

2. GitHub Event Integration

What it does:

  • Captures GitHub events via the webhook (issues and PRs).
  • Processes these events through the event bus.
  • Responds to events with the GitHub bot integration.

Implementation details:

  • FastAPI endpoint for receiving GitHub webhook payloads.
  • Event handlers for issue and PR creation.
  • Automatic welcome comments for new issues and PRs.

Testing:
To test the GitHub integration:

  1. Set up a GitHub App with webhook capabilities.
  2. Use ngrok to expose your local server:
ngrok http 8000
  1. Configure your GitHub App webhook URL to point to your ngrok URL + /github/webhook
  2. Set the webhook secret in your backend/.env file
  3. Run the backend server:
python backend/main.py
  1. Create an issue or PR in your connected repository to trigger the webhook

github-feat-ss1
github-feat-ss2

3. Discord Bot Integration

What it does:

  • Welcomes new-comers with a welcome message.
  • Provides real-time notifications in Discord for GitHub events.
  • Implements a slash command querying the vector DB via the discord bot.
  • Manages maintainer roles and notification channels.

Implementation details:

  • Discord bot with slash commands for configuration.
  • Event-based notification system.
  • RAG query system for querying the vector database through the bot.

Note

config.json and pending_notification.json files are being used to store config data and the queue system. This is for demo purposes only, in actual implementation there will be a more solid queue system and config data to be stored in Supabase.

Testing:
To test the Discord integration:

  1. Create a Discord bot in the Discord Developer Portal.
  2. Add the bot token to your backend/.env file.
  3. Invite the bot to your server with appropriate permissions.
  4. Run the Discord bot:
python backend/bots/discord_bot/run_bot.py
  1. Use the /help command to see available commands.
  2. Configure a notification channel with /devr configure_channel.
  3. Register maintainers with /devr register_maintainer.
  4. Trigger a GitHub event to see notifications in Discord.

discord-feat-ss1
discord-feat-ss2
discord-feat-ss3

4. RAG-Based Q&A System

What it does:

  • Implements Retrieval-Augmented Generation for answering project-specific questions.
  • Indexes project documentation in a vector database.

Implementation details:

  • Supabase vector database integration for storing embeddings.
  • FastEmbedEmbeddings for generating document embeddings.
  • Groq LLM integration for generating high-quality responses.
  • Discord /ask command for querying the knowledge base.

Note

Right now, *.md files stored in a local docs directory are being used to create embeddings. In actual implementation we will have a more solid system to generate embeddings.

Testing:
To test the RAG Q&A system:

  1. Set up a Supabase account and create a project
  2. Set up the vector database using the provided SQL
  3. Add your Supabase URL and key to your backend/.env file
  4. Get a Groq API key and add it to your backend/.env file
  5. Build the embeddings from your documentation:
python backend/app/services/rag/build_embeddings.py
  1. Run the Discord bot and use the /ask command to query your project documentation

rag-feat-ss1
rag-feat-ss2
rag-feat-ss3

5. Documentation System

What it does:

  • Provides comprehensive documentation for the project.
  • Hosted on github pages, automated deployment via GitHub actions.

Implementation details:

  • MkDocs-based documentation.
  • GitHub workflow for automating deployment to github pages.

Testing:
To view the documentation locally:

mkdocs serve

screenshot1
screenshot2

Environment Variables

The following environment variables need to be set in your backend/.env file:

# Supabase (for vector database)
SUPABASE_URL=
SUPABASE_SERVICE_ROLE_KEY=

# GitHub
GITHUB_WEBHOOK_SECRET=
GITHUB_APP_ID=
GITHUB_APP_PRIVATE_KEY_PATH=
GITHUB_APP_INSTALLATION_ID=
GITHUB_TOKEN=

# Discord Bot
DISCORD_BOT_TOKEN=

# RAG
GROQ_API_KEY=
LLM_MODEL=llama3-8b-8192

# FastAPI
PORT=8000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants