meh.ai is a Chrome extension that empowers users to interact with web pages in a fun and engaging way. Leveraging the power of on-device AI, meh.ai allows you to ask questions about the content of the page, summarize it, and even extract key insights, all within a seamless chat-like interface. This project was developed for the Google Chrome Built-in AI Challenge Hackathon hosted by Devpost.
Check out a demo here: https://www.youtube.com/watch?v=sB2bhBTzYPM
Install the extension (development version):
- Clone this repository.
- Open Chrome and navigate to
chrome://extensions
. - Enable "Developer mode" in the top right corner.
- Click "Load unpacked" and select the dist directory of this repository.
- Content Processing: Extracts text from web pages and indexes it using a vector database, allowing for efficient search and retrieval.
- Question Answering: Ask natural language questions about the page content, and meh.ai will provide relevant answers using Gemini Nano.
- Source Highlighting: Meh.ai highlights relevant sections of the page content, offering transparency and context.
- User-Friendly Interface: A simple, chat-like interface makes interacting with the content easy and enjoyable.
- service_worker.js: The core backend logic of the extension, handling requests from the frontend, managing the LLM, and interacting with the vector database.
- index.html: The main HTML file of the sidepanel, containing the chat interface and user interaction elements.
- index.js: The main JavaScript file for the sidepanel, handling user input, communication with the service worker, and updating the interface.
- extract_content.js: Responsible for extracting readable text content from web pages using the
Readability
library. - text_splitter.js: Implements text splitting logic to prepare content for the language model.
- vector_store.js: Manages the vector database, storing and retrieving embeddings for efficient search.
To use this project, you will need:
- Node.js and npm or yarn package manager installed.
- Acknowledge Google’s Generative AI Prohibited Uses Policy.
- Download Chrome Dev channel (or Canary channel), and confirm that your version is equal or newer than 128.0.6545.0.
- Check that your device meets the requirements.
- Don’t skip this step, in particular make sure that you have at least 22 GB of free storage space.
- If after the download the available storage space falls below 10 GB, the model will be deleted again. Note that some operating systems may report the actual free disk space differently, for example, by including or not disk space that's occupied by the trash bin. On macOS, use Disk Utility to get the representative free disk space.
Follow these steps to enable Gemini Nano and the Prompt API flags for local experimentation:
- Open a new tab in Chrome, go to chrome://flags/#optimization-guide-on-device-model
- Select Enabled BypassPerfRequirement. This bypasses performance checks which might prevent Gemini Nano from being downloaded on your device.
- Go to chrome://flags/#prompt-api-for-gemini-nano.
- Select Enabled.
- Relaunch Chrome.
- Open DevTools and send (await ai.languageModel.capabilities()).available; in the console.
- If this returns "readily", then you are all set.
For more information on how to set up Gemini Nano, see the documentation here: https://docs.google.com/document/d/1VG8HIyz361zGduWgNG7R_R8Xkv0OOJ8b5C9QKeCjU0c/edit?tab=t.0#heading=h.p6ot1jmhcd78
- Install Dependencies:
npm install
oryarn
- Build:
npm run build
oryarn build
(builds the extension for production) - Load the Extension: Follow the instructions for installing the development version in the "Installation" section.
- Test the extension by interacting with various web pages, asking questions, and observing the responses.
- Utilize your browser's developer tools to debug issues.
This project is still in development.