Skip to content

Latest commit

Β 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

React 19 Vite 7 Flask 3 Python MIT License

πŸ€– AI Assistant

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


✨ Features

πŸŽ“ Mentor Mode

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

πŸͺž Concept Mirror

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

⚑ Additional Highlights

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

Demo mode is built in β€” just run the app without API keys and it works out of the box with mock responses.


πŸ“ Project Structure

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

πŸš€ Quick Start

Prerequisites

1. Clone the Repository

git clone https://github.com/tech-akash010/AI-ASSISTANT.git
cd AI-ASSISTANT

2. Backend Setup

cd 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.py

The backend will start at http://localhost:5000.

3. Frontend Setup

cd frontend
npm install
npm run dev

Open http://localhost:5173 in your browser. πŸŽ‰


πŸ”‘ API Configuration

Environment Variables

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)

Supported Models

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

πŸ“‘ API Reference

GET /health

Health check endpoint.

{
  "status": "healthy",
  "provider": "gemini",
  "model": "gemini-2.0-flash",
  "has_api_key": true,
  "demo_mode": false
}

POST /mentor

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"
}

POST /analyze

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..."
}

POST /generate

Simple text generation.

// Request
{ "prompt": "Explain DSA in simple terms" }

// Response
{
  "response": "Data Structures and Algorithms (DSA)...",
  "provider": "gemini"
}

🚒 Deployment

Frontend and backend are deployed separately on Vercel (each has its own vercel.json).

Deploy Backend

  1. On vercel.com, click Add New β†’ Project
  2. Import your GitHub repo
  3. Set Root Directory to backend
  4. Add Environment Variables in the Vercel dashboard:
    Variable Value
    ACTIVE_PROVIDER gemini or groq
    GOOGLE_API_KEY Your Gemini key
    GROQ_API_KEY Your Groq key (if using Groq)
    DEMO_MODE False
  5. Deploy β€” note your backend URL (e.g., https://your-backend.vercel.app)

Deploy Frontend

  1. Create a second Vercel project from the same repo
  2. Set Root Directory to frontend
  3. Add Environment Variables:
    Variable Value
    VITE_API_URL Your backend URL from above (e.g., https://your-backend.vercel.app)
  4. Deploy β€” your frontend will connect to the backend automatically

πŸ› οΈ Tech Stack

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)

🀝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Made by tech-akash010 Also by Ayon-coder

About

#Fixfield

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages