TrustBot is a secure, user-friendly web application that integrates modern authentication mechanisms and AI chatbot capabilities using the Hugging Face mistralai/Mixtral-8x7B-Instruct-v0.1
model. It combines Flask, SQLAlchemy, and PyOTP for building a full-stack intelligent system with Two-Factor Authentication (2FA) and a clean, interactive UI.
- Secure User Registration and Login
- Password hashing with Werkzeug for secure storage
- Login validations and CSRF protection
- PyOTP-based Time-Based One-Time Passwords
- QR Code generation using
qrcode
andpyotp
- Users are prompted to enter a TOTP after login
- Integrated with Hugging Face's
Mixtral-8x7B-Instruct-v0.1
- Handles conversational input dynamically via AJAX
- Display chat history between user and TrustBot
- Uses
InferenceClient
for real-time responses - Token-based secure API communication
- Clean and intuitive UI using Bootstrap
- Users see welcome messages and chatbot interface after successful login
Layer | Technology Used |
---|---|
Backend | Flask, SQLAlchemy |
Frontend | HTML5, Bootstrap, JavaScript (AJAX) |
Authentication | Werkzeug, PyOTP, qrcode |
AI/ML | Hugging Face mistralai/Mixtral |
Database | SQLite (for development) |
TrustBot/
├── 🐍 app.py
├── 🗃️ models.py
├── ⚙️ config.py
├── 🛢️ init_db.py
│
├── 📂 templates/ # Frontend templates
│ ├── 🔑 login.html
│ ├── ✏️ register.html
│ └── 🖥️ dashboard.html
│
├── 📂 static/ # Static assets
│ └── 🎨 style.css
│
├── 📜 requirements.txt # Python dependencies
└── 📖 README.md
-
Clone the repository:
git clone https://github.com/your-username/TrustBot.git cd TrustBot
-
Set up a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Create a .env file:
FLASK_APP=app.py FLASK_ENV=development SECRET_KEY=your_secret_key HUGGINGFACE_TOKEN=your_huggingface_api_token
-
Initialize the database:
python init_db.py
-
Run the app:
flask run
Visit http://127.0.0.1:5000 in your browser to use TrustBot!
- Dockerization for portability
- Role-based user access control
- HTTPS with Let's Encrypt
- MongoDB/PostgreSQL migration
- Integration with voice AI assistants
For questions, issues, or contributions:
Author: M Uzai Farooq
Email: m.uzair.farooq.514@gmail.com
Built with ❤️ for Secure Conversational AI!