This repository contains a React-based Chrome extension named SidekickAI that injects a right-side AI chat panel into any page. It supports multiple AI providers (OpenAI, Hugging Face, Gemini, custom endpoint) via the background service worker.
SidekickAI is a Chrome extension that:
- Injects a right-side chat panel into any webpage
- Supports multiple AI providers (OpenAI, Hugging Face, Gemini, custom endpoints)
- Can read content from the left side of the page
- Helps with quiz detection and answering
- Provides a React-based UI for chat interactions
sidekickai-chrome-extension/
├── public/ # Static files (HTML, icons, scripts)
│ ├── background.js # Service worker for API calls
│ ├── contentScript.js # Injects sidebar into pages
│ ├── sidebar.html # Main chat UI entry point
│ ├── options.html # Settings/options page
│ └── icons/ # Extension icons
├── src/ # React source code
│ ├── main.jsx # Sidebar React entry
│ ├── options-main.jsx # Options page React entry
│ └── ui/ # React components
├── scripts/ # Build scripts
├── manifest.json # Extension manifest
├── vite.config.js # Vite build configuration
└── package.json # Dependencies and scripts
- Node.js version 16 or higher (Download here)
- npm (comes with Node.js)
- Google Chrome browser
Navigate to the project directory and install dependencies:
cd sidekickai-chrome-extension
npm installThis will install:
- React 18.2.0
- React DOM 18.2.0
- Vite 5.0.0
- @vitejs/plugin-react
Build the extension for production:
npm run buildThis command:
- Compiles React components using Vite
- Bundles all assets into the
dist/folder - Copies
manifest.jsontodist/ - Copies static files (background.js, contentScript.js, icons, etc.)
Output: A dist/ folder containing all extension files ready to load in Chrome.
-
Open Chrome Extensions Page
- Open Google Chrome
- Navigate to
chrome://extensions/ - Or go to: Menu (⋮) → Extensions → Manage Extensions
-
Enable Developer Mode
- Toggle the "Developer mode" switch in the top-right corner
-
Load the Extension
- Click "Load unpacked" button
- Navigate to and select the
dist/folder from this project - Click "Select Folder"
-
Verify Installation
- You should see "SidekickAI — Multi-Model Chat" in your extensions list
- The extension icon should appear in your Chrome toolbar
Before using the extension, you must configure API keys:
-
Open Options Page
- Right-click the SidekickAI extension icon → Options
- Or go to
chrome://extensions/→ Find SidekickAI → Click "Details" → Click "Extension options"
-
Enter API Keys
- Select your preferred AI provider (OpenAI, Hugging Face, Gemini, or Custom)
- Enter the corresponding API key(s)
- Save your settings
Note: API keys are stored locally in Chrome's storage. For production, consider using a proxy backend to store API keys securely.
-
Open any webpage (e.g.,
https://example.com) -
Activate the Sidebar
- Click the SidekickAI extension icon in the Chrome toolbar
- A right-side chat panel should appear (420px wide)
-
Test Chat Functionality
- Type a message in the chat input
- Send the message
- Verify the AI response appears
- The extension can read text from the left side of the page
- Try asking: "What's on the left side of this page?"
- Navigate to a page with quiz questions (radio buttons or checkboxes)
- The extension should detect quiz elements
- Ask: "Help me with this quiz"
- Go to Options page
- Switch between different AI providers
- Test each provider with a simple query
- Verify responses are received
- Extension loads without errors in Chrome
- Extension icon appears in toolbar
- Clicking icon toggles sidebar on/off
- Sidebar appears on the right side (420px wide)
- Options page opens and saves settings
- API keys can be configured
- Chat messages send and receive responses
- Content reading works (left side of page)
- Quiz detection works on quiz pages
- Multiple AI providers can be switched
- Extension works on different websites
For development with hot-reload (note: Chrome extensions require rebuild for changes):
npm run devHowever, since this is a Chrome extension, you'll need to:
- Make changes to source files
- Run
npm run buildto rebuild - Reload the extension in Chrome (
chrome://extensions/→ Click reload icon)
npm run build- Build production bundle todist/npm run dev- Start Vite dev server (for component development)npm run preview- Preview the built filesnpm run zip- Create a zip file of the dist folder (for distribution)
- Ensure you selected the
dist/folder (not the root project folder) - Check that
dist/manifest.jsonexists - Open Chrome DevTools Console for errors
- Verify API keys are correctly entered in Options
- Check browser console for error messages
- Ensure you have internet connectivity
- Verify API key permissions/quotas
- Check if content script is injected (Chrome DevTools → Console)
- Verify the page allows iframe injection
- Try reloading the page after installing extension
- Ensure Node.js version is 16+
- Delete
node_modulesanddistfolders, then runnpm installagain - Check that all dependencies are installed
- API keys are currently stored in Chrome's local storage (client-side)
- This is acceptable for personal use but not recommended for production
- For production deployment, implement a proxy backend to:
- Store API keys server-side
- Handle API calls from the server
- Prevent API key exposure in the extension