Terminal Style Chat Interface with Fine-Tuning Capabilities
A minimalistic terminal-style chat UI with React+TypeScript frontend and FastAPI backend for local LLM inference. Features parameter-efficient fine-tuning with LoRA on custom datasets using Google Colab.
Quick Start β’ Features β’ Documentation β’ Issues β’ Contributing
- Features
- Quick Start
- Prerequisites
- Project Structure
- Setup Instructions
- Usage
- Tech Stack
- Dependencies
- API Endpoints
- Fine-Tuning
- Documentation
- Contributing
- License
- Security
- π₯οΈ Clean terminal-style chat interface with #111 background
- π FastAPI backend with local LLM support (GGUF format)
- π Real-time token streaming
- πΎ MongoDB chat history storage
- π¨ Rich and colorful server logs
- β‘ Auto-loads last 20 messages on startup
- π NEW: Fine-tune Phi-2 on custom datasets (Quick Start | Full Guide)
# 1. Clone the repository
git clone https://github.com/H0NEYP0T-466/finetuneLLM.git
cd finetuneLLM
# 2. Place your GGUF model in backend/model/
# 3. Start with Docker Compose (easiest)
docker-compose up -d
# 4. Install frontend dependencies
npm install
# 5. Start frontend development server
npm run dev
# 6. Open http://localhost:5173 in your browser- Node.js 18+
- Python 3.9+
- MongoDB (running locally on port 27017)
- GGUF format LLM model file
finetuneLLM/
βββ src/ # Frontend source
β βββ components/ # React components
β βββ services/ # API services
β βββ types/ # TypeScript types
β βββ styles/ # CSS styles
βββ backend/
β βββ app/
β β βββ main.py # FastAPI application
β βββ model/ # Place .gguf model files here
β βββ requirements.txt # Python dependencies
βββ README.md
This is the easiest way to run both the backend and MongoDB:
-
Place your GGUF model file in
backend/model/directory -
Start all services:
docker-compose up -d- Check logs:
docker-compose logs -f backend- Stop services:
docker-compose downThe backend will run on http://localhost:8002 and MongoDB on localhost:27017.
Note: Using docker-compose ensures:
- β MongoDB is properly connected (no connection refused errors)
- β
Database
finetuneLLMis automatically created - β Messages are persisted across restarts
- β Proper networking between services
- Install Python dependencies:
cd backend
pip install -r requirements.txt- (Optional) Configure environment variables:
cd backend
cp .env.example .env
# Edit .env to customize MongoDB URI and CORS settings-
Place your GGUF model file in
backend/model/directory -
Ensure MongoDB is running:
# On Linux/Mac
sudo systemctl start mongod
# Or with Docker
docker run -d -p 27017:27017 --name mongodb mongo- Start the backend server:
cd backend
./start_server.sh
# Or manually:
# cd app && python main.pyThe backend will run on http://localhost:8000
- Install dependencies:
npm install- (Optional) Configure environment variables:
cp .env.example .env
# Edit .env to customize API URL if needed- Start the development server:
npm run devThe frontend will run on http://localhost:5173
- Start MongoDB
- Start the backend server (it will load the LLM model)
- Start the frontend development server
- Open your browser to
http://localhost:5173 - Start chatting!
Backend
- Loads GGUF models on server startup
- Streams tokens in real-time using Server-Sent Events
- Logs user prompts and model responses with rich formatting
- Tracks and logs response times
- Stores all conversations in MongoDB
Frontend
- Terminal-style UI with green text on black background (#111)
- Token-by-token streaming display
- Loading indicators during model initialization
- Auto-scroll to latest messages
- Loads last 20 messages from database on startup
GET /- Health checkGET /status- Check model and database statusGET /messages?limit=20- Get last N messagesPOST /chat- Send message and stream response
Build for production:
npm run buildPreview production build:
npm run previewLint code:
npm run lintWant to fine-tune the Phi-2 model on your own data? We've got you covered!
- Prepare your dataset as
dataset.xlsx(Excel file with Q&A pairs) - Upload to Google Colab and run
finetuneCollab.py - Get your fine-tuned model in 20-30 minutes!
Read the guides:
- Colab Quick Start - Get started in 5 minutes
- Complete Guide - Full technical documentation
- Feature Overview - What's included
- β Parameter-efficient fine-tuning with LoRA
- β Runs on free Google Colab GPU
- β Automatic training visualizations
- β Complete documentation
- β Example dataset included
finetuneCollab.py- Main training scriptfinetune.md- Technical documentation (25KB)COLAB_QUICKSTART.md- Quick start guiderequirements-finetune.txt- Dependenciesdataset_example.xlsx- Sample data
- README.md - Main documentation (this file)
- COLAB_QUICKSTART.md - Quick start guide for fine-tuning
- FINETUNE_README.md - Fine-tuning feature overview
- QUICKSTART.md - Quick start guide
- finetune.md - Complete fine-tuning documentation
- CONTRIBUTING.md - Contribution guidelines
- SECURITY.md - Security policy and vulnerability reporting
- CODE_OF_CONDUCT.md - Community code of conduct
We welcome contributions! Please see our Contributing Guide for details on:
- How to fork and clone the repository
- Development setup and workflow
- Branch naming conventions
- Commit message format
- Pull request process
- Code style guidelines
Before contributing, please read our Code of Conduct.
Quick Links:
This project is licensed under the MIT License - see the LICENSE file for details.
Security is important to us. If you discover a security vulnerability, please follow our Security Policy.
Do not report security vulnerabilities through public GitHub issues.
- Read our Security Policy
- Report vulnerabilities privately through GitHub Security Advisories
- Response time: Within 48 hours
Made with β€οΈ by H0NEYP0T-466