A Chrome extension that uses Chrome's built-in AI APIs to analyze webpage content and generate visual relationship diagrams using Excalidraw.
Chrome's built-in AI features are currently only available in Chrome Canary (or Dev channel). Here's how to set it up:
-
Download Chrome Canary:
- Windows: Download Chrome Canary
- macOS: Download Chrome Canary
- Linux: Use Chrome Dev channel instead, as Canary isn't available for Linux
-
Verify your version is 128.0.6545.0 or newer:
- Open Chrome Canary
- Go to
chrome://version
- Check the version number in the first line
Your system must meet these requirements to run Chrome's AI features:
-
Operating System:
- Windows 10/11, or
- macOS 13 (Ventura) or newer
- Linux (specific requirements TBD)
-
Storage:
- At least 22 GB free space on the volume containing your Chrome profile
- Note: The model will be deleted if available space falls below 10 GB
-
GPU:
- Integrated GPU or discrete GPU
- Minimum 4 GB Video RAM
-
Network:
- Non-metered internet connection for model download
-
In Chrome Canary, go to
chrome://flags/#optimization-guide-on-device-model
- Set to "Enabled BypassPerfRequirement"
-
Go to
chrome://flags/#prompt-api-for-gemini-nano
- Set to "Enabled"
-
Restart Chrome Canary
-
Verify AI features are available:
- Open DevTools Console (F12)
- Run:
(await ai.languageModel.capabilities()).available
- Should return "readily"
-
If needed, force model download:
- Run in Console:
await ai.languageModel.create()
- Restart Chrome
- Go to
chrome://components
- Check that "Optimization Guide On Device Model" shows version ≥ 2024.5.21.1031
- If no version listed, click "Check for update"
- Run in Console:
- Clone the repository:
git clone https://github.com/yourusername/relationmap-ai.git
cd relationmap-ai
- Install dependencies:
# If you're using npm
npm install
# If you're using yarn
yarn install
- Load the extension in Chrome Canary:
- Go to
chrome://extensions
- Enable "Developer mode" (top right)
- Click "Load unpacked"
- Select the extension directory
- Go to
relationmap-ai/
├── manifest.json # Extension manifest
├── popup.html # Extension popup UI
├── popup.js # Popup logic and AI integration
└── content.js # Content script for page analysis
- Click the extension icon in Chrome's toolbar
- Click "Analyze Page & Create Diagram"
- Wait for the AI to analyze the page content
- The generated relationship diagram will appear in Excalidraw
- Check AI availability:
const capabilities = await self.ai.languageModel.capabilities();
console.log(capabilities);
- Test basic prompting:
const session = await self.ai.languageModel.create();
const response = await session.prompt("Hello, what's the weather?");
console.log(response);
- Monitor token usage:
console.log(`Tokens remaining: ${session.tokensLeft}/${session.maxTokens}`);
-
"AI Not Available" Error:
- Verify Chrome version is correct
- Check that flags are enabled
- Ensure system meets requirements
- Try restarting Chrome
-
Model Download Issues:
- Check
chrome://components
for model status - Ensure sufficient disk space
- Verify network connection is not metered
- Check
-
Token Limits:
- Max 1024 tokens per prompt
- Session can retain last 4096 tokens
- Monitor token usage via session stats
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter issues:
- Check the Console (F12) for error messages
- Verify your Chrome version and flags
- Look for model status in
chrome://components
- Check system requirements
- Try restarting Chrome
- Clear browser data and reload extension
For persistent issues:
- File a bug report with:
- Chrome version
- System specs
- Error messages
- Steps to reproduce