/MermaidGPT

A simple ChatGPT and Mermaid.js integration that allows you to generate diagrams using natural language.

Primary LanguagePython

project-logo

MERMAIDGPT

Highlighting the core functionality: Transform Text" conveys the idea of inputting text and getting a visual output.2. Emphasizing the output: into Visual Masterpieces showcases the creative and visually appealing diagrams generated by the application.3. Showcasing the AI-driven technology: with AI Power hints at the use of advanced AI models (GPT-3.5-turbo) and APIs (OpenAI, Mermaid) that make this transformation possible.The slogan is concise, memorable, and engaging, making it perfect for promoting the project and piquing the interest of potential users and contributors.

license last-commit repo-top-language repo-language-count

Developed with the software and tools below.

Python


Table of Contents

Overview

MermaidGPT is an innovative software project that empowers users to generate diagrams from text prompts through a seamless interface. By leveraging OpenAIs GPT-3.5-turbo model and the Mermaid API, MermaidGPT enables the creation of complex graph data visualizations with ease. The application provides a user-friendly interface, complete with a configurable sidebar, to facilitate input, processing, and rendering of diagrams. With MermaidGPT, users can effortlessly transform text into visually stunning diagrams, making it an invaluable tool for a wide range of applications, from technical documentation to data analysis and education.


Features

Feature Description
โš™๏ธ Architecture Monolithic design with 4 main modules: main, mermaid, prompt, and sidebar. Python-based, using OpenAI API and Mermaid API for diagram generation.
๐Ÿ”ฉ Code Quality Well-structured code with clear variable names and modular functions. Could benefit from type hints and docstrings for improved readability.
๐Ÿ“„ Documentation Limited documentation, mostly in the form of inline comments. No README or separate documentation files. Could benefit from a comprehensive README and API documentation.
๐Ÿ”Œ Integrations Integrates with OpenAI API (GPT-3.5-turbo model) and Mermaid API for diagram generation.
๐Ÿงฉ Modularity Modular codebase with separate files for distinct functionality, making it easy to maintain and update individual components.
๐Ÿงช Testing No testing frameworks or tools used. Could benefit from unit testing and integration testing to ensure functionality and catch errors.
โšก๏ธ Performance Performance is dependent on OpenAI API and Mermaid API responses. Could benefit from optimization techniques to improve response times.
๐Ÿ›ก๏ธ Security OpenAI API key is stored in the code, which is a security risk. Should be stored as an environment variable or secure storage.
๐Ÿ“ฆ Dependencies Depends on Python and Py, with external dependencies on OpenAI API and Mermaid API.
๐Ÿš€ Scalability Currently designed for a single-user interface, may require significant changes to handle increased traffic and load.

Repository Structure

โ””โ”€โ”€ MermaidGPT/
    โ”œโ”€โ”€ components
    โ”‚   โ””โ”€โ”€ sidebar.py
    โ”œโ”€โ”€ main.py
    โ”œโ”€โ”€ mermaid.py
    โ””โ”€โ”€ prompt.py

Modules

.
File Summary
main.py Orchestrates the MermaidGPT application, providing a user interface for generating diagrams from text prompts. It sets up the layout, initializes the sidebar, and facilitates the interaction between user input, OpenAI API calls, and diagram rendering, ultimately displaying the generated image and markdown response.
mermaid.py Generates diagrams by encoding graph data and sending it to the Mermaid API, which returns an image that is then opened and returned as a PIL Image object, enabling visual representation of complex graph data within the MermaidGPT application.
prompt.py Transforms user input into a Mermaid.js formatted markdown chart by leveraging OpenAIs GPT-3.5-turbo model. It sets the OpenAI API key, generates a prompt, and sends a chat request to the model, ultimately returning a markdown graph that can be pasted into a Mermaid.js viewer.
components
File Summary
sidebar.py Configures and personalizes the user interface by setting up an OpenAI API key input field and displaying essential information about the MermaidGPT application, including usage instructions, contributor links, and credits, in a conveniently accessible sidebar within the application.

Getting Started

System Requirements:

  • Python: version x.y.z

Installation

From source

  1. Clone the MermaidGPT repository:
$ git clone https://github.com/jgordley/MermaidGPT
  1. Change to the project directory:
$ cd MermaidGPT
  1. Install the dependencies:
$ pip install -r requirements.txt

Usage

From source

Run MermaidGPT using the command below:

$ python main.py

Tests

Run the test suite using the command below:

$ pytest

Project Roadmap

  • โ–บ INSERT-TASK-1
  • โ–บ INSERT-TASK-2
  • โ–บ ...

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your github account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/jgordley/MermaidGPT
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to github: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph


License

This project is protected under the SELECT-A-LICENSE License. For more details, refer to the LICENSE file.


Acknowledgments

  • List any resources, contributors, inspiration, etc. here.

Return