A dual-mode AI assistant with Mentor Mode for interactive learning and Concept Mirror for understanding analysis β powered by Gemini & Groq.
Demo Link:-Concept_mirror
Features β’ Demo β’ Quick Start β’ API Reference β’ Deployment β’ Contributing
Your personal AI tutor that adapts to your learning pace.
- Multi-turn conversations β context-aware follow-ups for deeper understanding
- Syntax-highlighted code β beautiful code examples with language detection
- Topic-scoped sessions β focused learning on Python, DSA, Web Dev, and more
- Smart fallbacks β graceful demo responses when API keys aren't configured
Reflect on what you think you know β and discover what you're missing.
- Understanding analysis β breaks down what you got right, wrong, and missed
- Gap detection β surfaces blind spots in your mental models
- Structured feedback β organized into Understood, Missing, Incorrect, and Assumptions
- Actionable insights β clear summary with next steps for improvement
| Feature | Description |
|---|---|
| π Dual AI Providers | Switch between Google Gemini and Groq (LLaMA/Mixtral) with one env variable |
| π Demo Mode | Full functionality without API keys for testing and development |
| π REST API | Clean Flask API β use it headless or integrate with any frontend |
| π± Responsive UI | Modern React interface that works on desktop and mobile |
Demo mode is built in β just run the app without API keys and it works out of the box with mock responses.
AI-ASSISTANT/
βββ backend/ # Python Flask API server
β βββ api.py # REST endpoints (/mentor, /analyze, /generate)
β βββ ai_client.py # AI provider factory & client
β βββ base.py # Abstract base class for providers
β βββ config.py # Environment configuration loader
β βββ prompts.py # System prompts for each mode
β βββ demo.py # Fallback mock responses
β βββ run.py # Server entry point
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment template
β βββ gemini_provider/ # Google Gemini integration
β βββ groq_provider/ # Groq (LLaMA/Mixtral) integration
β
βββ frontend/ # React + Vite SPA
β βββ src/
β β βββ App.jsx # Main app with mode switching
β β βββ components/
β β β βββ MentorMode.jsx # Interactive tutor chat
β β β βββ ConceptMirrorMode.jsx # Understanding analyzer
β β β βββ ModeSelector.jsx # Mode toggle UI
β β β βββ Header.jsx # App header with settings
β β β βββ ApiKeyModal.jsx # API key configuration
β β βββ services/
β β βββ geminiService.js # Backend API client
β βββ index.html
β βββ package.json
β βββ vite.config.js
β
βββ vercel.json # Vercel deployment config
βββ README.md
- Python 3.10+ and pip
- Node.js 18+ and npm
- API key from Google AI Studio or Groq Console (optional β demo mode works without keys)
git clone https://github.com/tech-akash010/AI-ASSISTANT.git
cd AI-ASSISTANTcd backend
# Create virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate # Linux/macOS
.venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API keys (or leave defaults for demo mode)
# Start the API server
python run.pyThe backend will start at http://localhost:5000.
cd frontend
npm install
npm run devOpen http://localhost:5173 in your browser. π
| Variable | Default | Description |
|---|---|---|
ACTIVE_PROVIDER |
gemini |
AI provider to use (gemini or groq) |
ACTIVE_MODEL |
(auto) | Override model (e.g., gemini-2.0-flash, llama-3.3-70b-versatile) |
GOOGLE_API_KEY |
β | Your Google Gemini API key |
GROQ_API_KEY |
β | Your Groq API key |
FLASK_HOST |
127.0.0.1 |
Server bind address |
FLASK_PORT |
5000 |
Server port |
FLASK_DEBUG |
True |
Enable Flask debug mode |
DEMO_MODE |
False |
Force demo mode (mock responses) |
Google Gemini Models
| Model | Best For |
|---|---|
gemini-2.0-flash |
Fast responses, general use |
gemini-1.5-flash |
Balanced speed & quality |
gemini-1.5-pro |
Complex reasoning tasks |
Groq Models
| Model | Best For |
|---|---|
llama-3.3-70b-versatile |
High quality, versatile |
llama-3.1-8b-instant |
Ultra-fast responses |
mixtral-8x7b-32768 |
Long context, balanced |
Health check endpoint.
{
"status": "healthy",
"provider": "gemini",
"model": "gemini-2.0-flash",
"has_api_key": true,
"demo_mode": false
}Multi-turn Mentor Mode chat.
// Request
{
"messages": [
{ "role": "user", "content": "Explain recursion with an example" }
],
"topic": "Python"
}
// Response
{
"response": "Recursion is when a function calls itself...",
"provider": "gemini",
"model": "gemini-2.0-flash"
}Concept Mirror analysis.
// Request
{
"concept": "Binary Search",
"explanation": "Binary search divides the array in half each time..."
}
// Response
{
"understood": ["Divide and conquer approach", "Halving the search space"],
"missing": ["Sorted array prerequisite", "Time complexity analysis"],
"incorrect": [],
"assumptions": ["Works on any array"],
"summary": "Good grasp of the core idea, but missing key prerequisites..."
}Simple text generation.
// Request
{ "prompt": "Explain DSA in simple terms" }
// Response
{
"response": "Data Structures and Algorithms (DSA)...",
"provider": "gemini"
}Frontend and backend are deployed separately on Vercel (each has its own vercel.json).
- On vercel.com, click Add New β Project
- Import your GitHub repo
- Set Root Directory to
backend - Add Environment Variables in the Vercel dashboard:
Variable Value ACTIVE_PROVIDERgeminiorgroqGOOGLE_API_KEYYour Gemini key GROQ_API_KEYYour Groq key (if using Groq) DEMO_MODEFalse - Deploy β note your backend URL (e.g.,
https://your-backend.vercel.app)
- Create a second Vercel project from the same repo
- Set Root Directory to
frontend - Add Environment Variables:
Variable Value VITE_API_URLYour backend URL from above (e.g., https://your-backend.vercel.app) - Deploy β your frontend will connect to the backend automatically
| Frontend | Backend | AI Providers |
|
React 19 Vite 7 react-markdown react-syntax-highlighter |
Python 3.10+ Flask 3 Flask-CORS python-dotenv |
Google Gemini Groq (LLaMA 3.3, Mixtral) |
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
Made by tech-akash010 Also by Ayon-coder