Skip to content

pablo727/promptpilot

Repository files navigation

PromptPilot 🚀

Python Django DRF JWT Ollama scikit-learn Code style: black

A Django-based AI prompt management and chat platform, blending modern APIs, classic templates, and machine learning moderation — built over nearly two months of daily development.


Overview

PromptPilot is a full-stack Django project integrating Django REST Framework for backend APIs with traditional Django templates for essential user flows.
It connects to Ollama’s Mistral model for AI-powered chat, supports both browser and terminal interaction, and includes an scikit-learn-powered comment moderation system.


Features

  • 5 DRF API endpoints for prompt management, message storage, and more.
  • Traditional Django templates for:
    • Login / Logout
    • Signup
    • Home
    • Password Reset
  • JWT Authentication via django-simple-jwt for secure token-based API access.
  • Machine Learning Auto-Moderation with scikit-learn to flag inappropriate comments.
  • Secure Secrets Management with python-dotenv.
  • Integration with Ollama Mistral API:
    • Communicate with Mistral directly from the Bash terminal in VS Code.
    • Store AI responses in a dedicated API endpoint.
  • Token Auto-Refresh Script to keep .env credentials up-to-date.
  • Code Style Enforcement with black formatter and crispy forms.
  • 14 Automated Tests for reliability and regression prevention.

Screenshots

🖥️ Home Page

Home Page

💬 Terminal Chat with Mistral

Mistral Chat

🔌 API Playground

API Playground

🔑 Password Reset Flow

Password Reset

📜 Chat Message History

Chat Messages


Project Structure

promptpilot/
├── prompts/          # Core prompt models, serializers, and views
├── users/            # User authentication & profile management
├── playgrounds/      # AI prompt execution and logging
├── chatmessages/     # Stores AI conversation history
├── scripts/          # Utility scripts (e.g., token refresh)
├── static/           # Static files
├── templates/        # HTML templates
├── utils/            # Helper functions/utilities
├── .dockerignore
├── .gitignore
├── .env.example
├── README.md
├── requirements.txt
├── manage.py
└── ...

Setup & Installation

1. Clone the repository

git clone https://github.com/pablo727/promptpilot
cd promptpilot

2. Create & activate virtual environment

python -m venv .venv
source .venv/bin/activate  # Linux / macOS
.venv\Scripts\activate     # Windows

3. Install dependencies

pip install -r requirements.txt

4. Set up environment variables

cp .env.example .env
# Fill in your secrets and API keys

5. Run migrations

python manage.py migrate

6. Run the server

python manage.py runserver

Ollama Terminal Chat

You can start a real-time chat with the Mistral model directly from your terminal in VS Code. Responses are stored automatically via the DRF API for future retrieval.

Testing

Run all tests:

python manage.py test

There are 14 automated tests covering models, views, serializers, and integration points.

Machine Learning Auto-Moderation

The project includes a flag_classifier.py built with scikit-learn to detect and flag potentially inappropriate comments. You can train the model via:

python manage.py train_flag_model

License

This project is licensed under the MIT License. Collaborations are welcome!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published