πŸ—ΊοΈ

System Design Diagram

Β 
High-Level System Design Diagram:
notion image
Β 
Β 
Sequence Diagram
Β 
User FastAPI App GitHub ChatGPT Supabase DB β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ POST /run with β”‚ β”‚ β”‚ β”‚ β”‚ githubURL & prompt β”‚ β”‚ β”‚ β”‚ β”‚ ──────────────────────> β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ ── Fetch code ──> β”‚ β”‚ β”‚ β”‚ β”‚ <─ Return code─── β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ ─────────── code + prompt ─────────────> β”‚ β”‚ β”‚ β”‚ <─────────── suggestion ────────────────── β”‚ | | | | | | | | | | | β”‚ ──────── suggestion + prompt ──────────> β”‚ β”‚ β”‚ β”‚ <─────────── reflection ────────────────── β”‚ | | | | | β”‚ β”‚ <────────────────── β”‚ β”‚ β”‚ β”‚ Calculate diff β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Store in DB ──────────────────────────────────────────────> | β”‚ <---- Return diff β”‚ β”‚ β”‚
Β 
Text-Based System Design
Β 
System Components:
  1. FastAPI Server - The core application server that handles web requests.
  1. GitHub Interaction Module - Fetches code from a specified GitHub repository URL.
  1. ChatGPT Interaction Module - Sends prompts to the ChatGPT API and retrieves code suggestions.
  1. Reflection Module - Processes the ChatGPT suggestions further, potentially refining them.
  1. Diff Generator - Calculates the differences between the original code and the suggested code.
  1. Supabase DB - Database for storing information about the operations and their results.
Β 
Workflow:
  1. The User sends a POST request to the FastAPI server with a 'githubURL' and a 'prompt'.
  1. The FastAPI server validates the request and passes the 'githubURL' to the GitHub Interaction Module.
  1. The GitHub Interaction Module fetches the code from the GitHub repository.
  1. The FastAPI server sends the fetched code and 'prompt' to the ChatGPT Interaction Module.
  1. ChatGPT Interaction Module requests a code suggestion from the ChatGPT API based on the prompt.
  1. Once the suggestion is received, it is sent to the Reflection Module for further processing (if needed).
  1. The Reflection Module sends the refined code back to the FastAPI server.
  1. The Diff Generator compares the original code with the suggested code to calculate the diff.
  1. The results, including the original code, the suggestion, and the diff, are stored in the Supabase DB.
  1. The FastAPI server sends the response back to the User with the calculated diff and any other relevant information.
Β 
Endpoints:
  • POST : /run - Accepts 'githubURL' and 'prompt' via body, initiates the workflow, and returns the results via a unified diff.
Β 
Data Storage:
  • Stores in a requests table:
    • id: Unique request identifier int8 .
    • repo_url: text
    • prompt: text
    • original_code: text
    • fixed_code: text
    • diff: Returned unified diff of changes text
    • timestamp: Time/date object of requesttimestamp
Β