AI-powered study companion that explains, answers, and illustrates any text you select — right inside your browser.
- Overview
- Features
- Architecture
- File Structure
- API & Backend
- Installation & Setup
- Usage Guide
- Configuration Reference
- Troubleshooting
- Testing
IntelliSelect is a Chrome Extension (Manifest V3) that supercharges your learning sessions. Highlight any text on any webpage and instantly receive either a concise answer or a rich, in-depth explanation — complete with educational diagrams and illustrations.
The extension is powered by a local Node.js + Express backend that intelligently routes requests across multiple AI providers using a racing strategy — always returning the fastest available response.
| Feature | Answer Mode | Learning Mode |
|---|---|---|
| UI | Floating Toast Popup | Persistent Right Sidebar |
| Best For | MCQs, True/False, Quick facts | Concepts, Theories, Definitions |
| AI Provider | Groq (ultra-fast) | OpenRouter / Gemini (detailed) |
| Images | ❌ No | ✅ Yes — Educational Visuals |
| Activation | Toggle → A |
Toggle → L |
When you highlight text in Learning Mode, the extension:
- Generates AI-driven queries — The AI creates 3 specific search terms (e.g., "DNA replication flowchart", "Helicase enzyme illustration") instead of using raw text.
- Fetches educational visuals via SerpAPI (Google Images) targeting diagrams, flowcharts, and scientific illustrations.
- Displays a responsive gallery in the sidebar below the explanation — click any image to open a full-screen Lightbox Modal.
- AI Racing Strategy: All available providers (Groq, Gemini, OpenRouter) are queried simultaneously. The first successful response wins. This eliminates single-provider latency and adds automatic failover.
- Asynchronous Image Loading: Text explanations appear instantly. Images load in the background and "pop in" once ready — a loading spinner keeps the user informed.
- In-Memory Caching: The backend caches results for 1 hour. Repeated queries are served in milliseconds with zero API cost.
- Cross-Frame Support: Selections inside embedded iframes (e.g., quiz platforms) are correctly routed to the top-level sidebar.
- Green Text Selection Highlight: When you release a selection, it turns green to confirm the API has received your query.
- Live Status Bar: A floating pill at the top of the screen shows
Selecting...→Sentas the request progresses. - Markdown Rendering: AI responses with
**bold**text are properly rendered as bold in both the sidebar and toast. Newlines are also preserved. - Glassmorphism UI: Dark, frosted-glass design with smooth
cubic-bezieranimations on all panels and modals.
User selects text
│
▼
[content.js] ──────────────────────────────────────────────────────┐
Detects mouseup/keyup │
Sets green selection highlight │
Shows "Selecting..." status bar │
│ │
▼ │
[background.js] (MV3 Service Worker) │
Routes AI_REQUEST to backend /api/ai │
Routes IMAGE_REQUEST to backend /api/images │
BROADCAST_UI handler relays events across frames │
│ │ │
▼ ▼ │
[/api/ai] [/api/images] │
Race: Groq vs Gemini AI generates 3 search queries │
vs OpenRouter SerpAPI fetches top 5 images │
Returns: { result } Returns: { images: [...urls] } │
│ │ │
└──────────────┬───────────────┘ │
▼ │
[content.js] ◄─────────────────────────────────────┘
Renders text immediately
Images pop in asynchronously
│
┌────────┴────────┐
▼ ▼
[sidebar.js] [toast.js]
(Learning Mode) (Answer Mode)
Extension/
│
├── manifest.json # Chrome Extension manifest (MV3)
├── content.js # Injected into every page; handles text selection,
│ # status bar, green highlight, and sidebar orchestration
├── background.js # Service worker; routes messages between content
│ # scripts and backend; handles cross-frame broadcast
├── api.js # Content-side helper; wraps chrome.runtime.sendMessage
│ # into clean async functions (requestAi, requestImages)
├── sidebar.js # Builds & manages the Learning Mode right sidebar,
│ # image grid, lightbox modal, and Markdown parser
├── toast.js # Builds & manages the Answer Mode floating toast
│ # notification with copy button and auto-dismiss
├── styles.css # All injected styles: sidebar, toast, image grid,
│ # lightbox modal, status bar, loading spinner
├── popup.html # Extension toolbar popup (settings UI)
├── popup.js # Popup logic: saves backend URL and mode preference
├── popup.css # Popup styles
│
└── backend/
├── server.js # Express server: /api/ai, /api/images, /health
│ # AI racing logic, image query gen, SerpAPI, caching
├── package.json
├── .env # Your actual API keys (git-ignored)
├── .env.example # Template for required environment variables
└── test_serpapi.js # One-shot SerpAPI connectivity test script
The backend exposes three endpoints:
Returns the server status and which AI providers are currently configured.
{ "ok": true, "providersConfigured": ["groq", "gemini", "openrouter"] }Generates an AI explanation or answer for selected text.
Request Body:
{
"mode": "learn" | "answer",
"text": "The selected text from the webpage"
}Response:
{
"result": "The AI-generated explanation..."
}Logic:
answermode: Short, direct. Best for MCQs. Format:Option [X]: [One-line explanation].learnmode: Friendly teacher format with headings, bullets, analogies, and summary.- Uses
Promise.any()to race all configured providers simultaneously. - Results are cached for 1 hour per unique
mode:textkey.
Generates educational image search queries and fetches visuals via SerpAPI.
Request Body:
{
"text": "The selected text to find visuals for"
}Response:
{
"images": [
"https://example.com/dna-diagram.jpg",
"https://example.com/replication-flowchart.png"
]
}Logic:
- Races all AI providers to generate 3 optimized search queries.
- Falls back to the raw selected text if AI query generation fails.
- Calls SerpAPI's
google_imagesengine with the first query. - Returns up to 5 unique, medium-sized image URLs.
- Node.js v18 or higher
- Google Chrome browser
- At least one AI provider API key (see below)
git clone https://github.com/zainabraza06/AI_study_assistant.git
cd AI_study_assistantcd backend
npm installCreate a .env file in the backend/ directory:
# Server
PORT=3000
# AI Providers (set at least one; more = faster racing fallback)
GROQ_API_KEY=gsk_... # https://console.groq.com/
GEMINI_API_KEY=AIza... # https://aistudio.google.com/
OPENROUTER_API_KEY=sk-or-... # https://openrouter.ai/
# Optional model overrides
GROQ_MODEL=llama-3.1-70b-versatile
GEMINI_MODEL=gemini-1.5-flash
OPENROUTER_MODEL=meta-llama/llama-3.1-70b-instruct
# Image Search — Required for Educational Visuals
SERPAPI_API_KEY=... # https://serpapi.com/Start the backend:
npm start
# → IntelliSelect backend listening on https://intelliselect.onrender.com- Open Chrome and navigate to
chrome://extensions/ - Enable Developer Mode (top-right toggle)
- Click Load unpacked
- Select the root of this project (the folder containing
manifest.json)
- Click the extension icon in the Chrome toolbar
- Set Backend URL to
https://intelliselect.onrender.com - Save settings
Click the circular badge at the bottom-left of any webpage:
- Badge shows
A= Answer Mode is active - Badge shows
L= Learning Mode is active - Badge is grey = Disabled
Clicking the badge when disabled opens a Mode Selection popup where you choose your mode and activate.
- Enable the assistant (badge =
A) - Select any text on the page
- A floating toast appears with:
- A concise answer or
Option [X]: reasonfor MCQs - A Copy button to copy the answer
- Auto-dismisses after 8 seconds
- A concise answer or
- Enable the assistant (badge =
L) - Select any text — the sidebar slides in from the right
- Phase 1 (Instant): AI explanation appears with full Markdown formatting
- Phase 2 (Background): A loading spinner appears, then educational images pop in below
- Click any image to expand it in a full-screen Lightbox Modal
| Indicator | Meaning |
|---|---|
| Text turns green | Selection received, sending to AI |
| "Selecting..." pill at top | Request is being processed |
| "Sent" pill (fades out) | Request successfully delivered |
| Sidebar loading spinner | AI images being fetched |
| Variable | Required | Description |
|---|---|---|
PORT |
No | Backend port (default: 3000) |
GROQ_API_KEY |
Recommended | Best for Answer Mode (fastest) |
GEMINI_API_KEY |
Optional | Good for Learning Mode explanations |
OPENROUTER_API_KEY |
Optional | Fallback provider |
GROQ_MODEL |
No | Override Groq model name |
GEMINI_MODEL |
No | Override Gemini model name |
OPENROUTER_MODEL |
No | Override OpenRouter model name |
SERPAPI_API_KEY |
For Images | Required to show educational visuals |
Tip: Configure all three AI providers for the best racing performance and highest reliability.
The content scripts haven't loaded yet. Try refreshing the page.
Reload the extension from chrome://extensions/ and refresh the tab. This occurs after extension updates.
- Check your
SERPAPI_API_KEYis set correctly in.env - Restart the backend:
npm start - Run
node test_serpapi.jsin thebackend/folder to verify the key works
- Ensure at least Groq is configured (it's the fastest provider)
- Check that the backend is running: visit
https://intelliselect.onrender.com/health - The first query after starting the server may be slower (cold start)
- Some sites with heavy CSP policies may block injected scripts
- Try reloading the page after enabling the extension
curl https://intelliselect.onrender.com/healthExpected: {"ok":true,"providersConfigured":["groq","gemini","openrouter"]}
cd backend
node test_serpapi.jsExpected:
Testing SerpAPI with key: Present
Successfully fetched 100 images.
First image URL: https://...
TEST PASSED ✅
curl -X POST https://intelliselect.onrender.com/api/ai \
-H "Content-Type: application/json" \
-d '{"mode":"learn","text":"What is photosynthesis?"}'Built with ❤️ for students who want to learn smarter, not harder.