LeetCode Assistant is a Chrome extension that helps competitive programmers by offering hints, breaking down questions, and providing detailed explanations for LeetCode problems. Additionally, users can interact with the assistant to clarify doubts or ask questions about the code or problem.
-
Hints: The extension provides hints at three levels:
- Subtle: Minimal guidance to encourage problem-solving.
- Guided: More focused hints that steer the user in the right direction.
- Detailed: Full hints or walkthroughs for a problem.
-
Question Breakdown: The extension simplifies complex problems into digestible chunks to make them easier to understand.
-
Chat with Extension: Users can ask the assistant specific questions about the code or LeetCode problem for further clarification.
CodeAssistant
│
├── backend/
│ ├── venv/
│ └── main.py # FastAPI backend for handling AI requests
│
├── Extension/
│ ├── prisma/
│ ├── background.js # Handles background actions for the Chrome extension
│ ├── content.js
│ ├── manifest.json # Chrome extension manifest
│ ├── popup.html # The UI for the popup
│ ├── popup.js # Handles frontend logic for the popup, including button actions
│ ├── styles.css
│
├── .env
├── .gitignore
└── requirements.txt
-
Clone the repository:
git clone [https://github.com/your-repo/leetcode-assistant.git](https://github.com/TNAHOM/CodeAssist-chromeExtension.git) cd CodeAssist-chromeExtension/backend -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.envfile in thebackendfolder and set yourGITHUB_TOKEN:GITHUB_TOKEN=your_github_token_here
- Create a
-
Run the FastAPI server:
uvicorn main:app --reload
- Enable Developer Mode in Chrome.
- Load Unpacked Extension:
- Navigate to
chrome://extensions/ - Click "Load unpacked" and select the
Extensiondirectory from this repository.
- Navigate to
- Set the
GITHUB_TOKEN:- The
.envfile must contain your validGITHUB_TOKENto access the GitHub model marketplace API.
- The
-
Scraping Code and Questions:
- After installing the extension, navigate to a LeetCode problem.
- The extension will scrape the code and the question when you click the relevant buttons on the popup.
-
Hint Generation:
-
Question Breakdown:
-
Chat with the Assistant:
-
Backend:
- FastAPI
- OpenAI SDK
- Uvicorn
- Any additional libraries in
requirements.txt
-
Frontend:
- Chrome Extension APIs
- Prism.js (for code syntax highlighting)
Let me know if you want to make any further adjustments or if anything else is needed!


