AutoBot is a Chrome-compatible browser extension backed by a local FastAPI service. It reads coding problems and multiple-choice questions from the active page, sends them to the appropriate AI engine, and presents the result in the extension popup or an in-page overlay.
The project uses two complementary AI paths:
- TypeSafe Jev AI provides fast, structured intent classification and multiple-choice selection.
- Ollama provides local model inference for code generation, explanations, free-form questions, and optional MCQ solving.
AutoBot is intended for development, learning, and experimentation. Always review generated answers and code before using them.
The project has two branches for choosing how inference is performed:
mainis for local inference. It uses Ollama for generated responses and does not require a Gemini API key.gemini-intgis for running generated responses through the Google Gemini API. Set a Gemini API key before using this branch.
Check out the branch that matches your setup:
git switch main # Local inference with Ollama
git switch gemini-intg # Gemini inference with an API keyOn coding sites such as LeetCode, the extension can extract the problem title, description, selected language, and starter code. The backend sends that context to the configured Ollama model and returns structured results containing intuition, an algorithmic approach, time and space complexity, complete solution code, and edge-case explanations.
The popup can display the solution and copy generated code. The content script also contains editor-insertion logic for supported page editors.
The content script detects options from HTML radio buttons and checkboxes, labels, ARIA quiz roles, common quiz elements, and text formatted like A., B), C:, or D-. AutoBot sends the question and normalized options to Jev AI by default. When a result is returned, the extension can highlight or select the matching option if automatic ticking is enabled.
Free-form text is sent to Ollama for explanations and factual questions. The popup and in-page overlay support coding solving, MCQ detection and solving, free-form questions, model selection, default language selection, MCQ auto-ticking, stealth mode, overlay toggling, and backend URL configuration.
flowchart LR
Page[Active web page] --> Content[content.js]
Content --> Popup[popup.js]
Popup -->|HTTP JSON| API[FastAPI localhost:3000]
API --> Router[router_service.py]
Router -->|intent and MCQ Choice| Jev[TypeSafe Jev AI]
API --> Ollama[ollama_service.py]
Ollama -->|local HTTP| Runtime[Ollama localhost:11434]
Runtime --> Model[Local Ollama model]
Jev --> API
Model --> API
API --> Popup
Popup --> Content
Content --> Page
The extension/ directory is a Manifest V3 extension. popup.js provides the toolbar UI and calls the API; content.js extracts page context, manages the overlay, and interacts with page controls and editors; background.js owns extension messaging and the Alt+S overlay shortcut; and the CSS files style the popup and overlay.
The content script is registered for <all_urls>, but Chrome-restricted pages such as chrome:// pages do not allow normal content-script communication. Use AutoBot on regular http:// or https:// pages.
The backend starts from server.py and launches src.main:app on localhost:3000.
src/main.pydefines request models, CORS configuration, and HTTP routes.src/router_service.pyowns Jev AI classification and Jev AI MCQ solving.src/ollama_service.pyowns local Ollama calls, model discovery, response parsing, and model caching.
Ollama model instances are cached by model name and response format, with a 30-minute keep-alive to reduce repeated model startup cost.
AutoBot uses the typesafe-sdk package and lazily creates one AsyncTypeSafeClient in router_service.py. The client is reused for subsequent requests so the service can benefit from connection pooling.
The backend defines a TypeSafe Choice with three outcomes:
| Intent | Meaning | Next step |
|---|---|---|
mcq |
A question with answer options | Solve with Jev or selected Ollama model |
coding |
A programming or algorithm problem | Generate code with Ollama |
text |
A general or conceptual question | Answer with Ollama |
The /api/ask route passes the query to Jev AI through system_one:
result = await client.system_one(
state=query,
questions={"intent": _ROUTER_CHOICE},
)
intent = result.choices["intent"].choiceThis produces a constrained typed decision instead of an unconstrained text label. The returned intent selects the next solver.
For MCQs, AutoBot builds a state containing the question and every option, then creates criteria mapping each option letter to its text. Jev is asked to select exactly one correct option. The backend returns an answer key, answer text, confidence value, and reasoning, for example:
{
"answer_key": "B",
"answer_text": "Selected option text",
"confidence": 0.98,
"reasoning": "Option B selected by TypeSafe Jev AI engine."
}Jev is used as a fast structured decision engine, not as the code-generation model. Its two jobs are classifying unified queries and selecting a stable MCQ answer key that the extension can use to locate and tick the corresponding page element.
The SDK reads the TypeSafe credential from TYPESAFE_API_KEY. Keep this key in a local environment file and never commit it.
Ollama runs locally at http://localhost:11434 when a task needs generated content rather than a constrained choice. Coding requests use a strict JSON prompt with fields for intuition, approach, complexity, code, and explanation. Text requests use a general assistant prompt and return Markdown-compatible text. MCQs can use Ollama when a non-Jev model is explicitly selected.
The default Ollama model is currently phi4-mini. The extension may store names such as ollama:phi4-mini; the backend removes that prefix before creating a ChatOllama instance.
For /api/ask, the flow is:
- The client sends a query.
- Jev classifies it as
mcq,coding, ortext. - For an MCQ, supplied options are used or
AthroughDoptions are extracted from the query. - Coding goes to Ollama for structured generation.
- Text goes to Ollama for a Markdown answer.
- The backend returns the selected intent and result.
If an MCQ has no detectable options, AutoBot treats it as conceptual text and sends it to Ollama.
| Method | Route | Purpose |
|---|---|---|
GET |
/ |
Health and engine information |
GET |
/api/models |
Jev plus locally available Ollama models |
POST |
/api/ask |
Classify and solve a mixed query |
POST |
/api/solve-coding |
Generate a coding solution with Ollama |
POST |
/api/solve-mcq |
Solve an MCQ with Jev or Ollama |
POST |
/api/solve-text |
Answer free-form text with Ollama |
Interactive API documentation is available at http://localhost:3000/docs.
- Python 3.14 or newer
uvfor backend dependencies- Ollama installed and running locally with a model such as
phi4-mini - A TypeSafe API key for Jev routing or MCQ solving
- Google Chrome or another Chromium-based browser
Create backend/.env for local secrets:
TYPESAFE_API_KEY=your_typesafe_api_keypython-dotenv loads this file when the backend starts. The current Ollama URL is configured as http://localhost:11434 in src/ollama_service.py.
From the repository root:
cd backend
uv sync
uv run python server.pyThe API listens at http://localhost:3000. For development reload mode:
DEV=1 uv run python server.pyVerify the service with:
curl http://localhost:3000/
curl http://localhost:3000/api/modelsAutoBot is loaded as an unpacked developer extension; no Chrome Web Store package is required.
- Start the backend and Ollama.
- Open
chrome://extensionsin Chrome. - Enable Developer mode in the upper-right corner.
- Click Load unpacked.
- Select the repository's
extension/directory, for example/home/onix/Code/auto_bot/extension. - Confirm that the AutoBot extension card appears and is enabled.
- Pin the extension from Chrome's extensions menu if desired.
- Open a normal
http://orhttps://page and click the AutoBot toolbar icon.
In popup settings, confirm the backend is http://localhost:3000, choose jev for Jev routing and MCQs or an Ollama model for local generation, select the page language, and enable auto-ticking if required.
Chrome may show a Reload button on the extension card after source changes. Click it after editing extension files.
The manifest requests activeTab, scripting, storage, and clipboardWrite, plus access to the local backend, Ollama, and supported web pages. Chrome does not permit injection into its own settings, extension, or new-tab pages.
backend/
server.py Backend entry point
pyproject.toml Python dependencies and metadata
src/main.py FastAPI app, models, and routes
src/router_service.py TypeSafe Jev intent and MCQ logic
src/ollama_service.py Ollama clients, prompts, and discovery
tests/ Backend tests
extension/
manifest.json Chrome Manifest V3 configuration
popup.html/js/css Toolbar popup UI
content.js Page extraction and page interaction
overlay.css In-page overlay styling
background.js Service worker and extension messaging
Run tests from backend/:
uv run pytestThe current suite includes model-name normalization coverage. A dependency-free compilation check is:
uv run python -m compileall -q server.py src- Backend connection: Confirm
server.pyis running on port3000and that the popup backend URL matches. - Jev failure: Check
backend/.envfor a validTYPESAFE_API_KEY, then restart the backend. - Ollama failure: Confirm Ollama is running at
http://localhost:11434and that the selected model is installed. - No MCQ detected: The page must expose readable question text and at least two detectable options.
- No extension response: Refresh the page and reload the extension. Restricted Chrome pages cannot run the content script.