|
1 | 1 | ---
|
2 |
| -| title | description | sidebar_position | keywords | |
3 |
| -|-------------------------------|-----------------------------------------------------------------------------------------------|------------------|----------------------------------------------------------------| |
4 |
| -| Sonar Chromium Browser | Chromium browser with native Perplexity Sonar API integration: omnibox answers & context-menu summarization | 9 | sonar, chromium, omnibox, context-menu, summarize, hackathon, api | |
5 |
| - |
| 2 | +title: Sonar Chromium Browser | Native Search Omnibox and Context Menu |
| 3 | +description: Chromium browser patch with native Perplexity Sonar API integration providing omnibox answers and context-menu summarization |
| 4 | +sidebar_position: 15 |
| 5 | +keywords: [sonar, chromium, omnibox, context-menu, summarize, hackathon, api, browser, integration] |
6 | 6 | ---
|
7 | 7 |
|
8 |
| -## 🚀 Project: Sonar Chromium Browser |
9 | 8 |
|
10 |
| -**GitHub Repo:** [KoushikBaagh/sonar-chromium-browser](https://github.com/KoushikBaagh/perplexity-hackathon-chromium) |
| 9 | +**Sonar Chromium Browser** is a Chromium browser patch that natively integrates Perplexity's Sonar API to provide AI-powered functionality directly in the browser. Users can type `sonar <query>` in the omnibox for instant AI answers or select text and right-click "Summarize with Sonar" for quick summaries, streamlining research and browsing workflows. |
| 10 | + |
| 11 | +## Features |
| 12 | + |
| 13 | +* **Omnibox AI Answers** with `sonar <query>` syntax for instant responses |
| 14 | +* **Context-menu Summarization** for selected text with one-click access |
| 15 | +* **Native Browser Integration** using Chromium's omnibox and context-menu APIs |
| 16 | +* **Dual Model Support** using Sonar Pro for omnibox and Sonar for summaries |
| 17 | +* **Debounced Input Handling** for efficient API usage |
| 18 | +* **Custom Browser Build** demonstrating AI integration patterns |
11 | 19 |
|
12 |
| -**Chromium Gerrit Repo:** [KoushikBaagh/google-gerrit-repo](https://chromium-review.googlesource.com/c/chromium/src/+/6778540) |
| 20 | +## Prerequisites |
13 | 21 |
|
14 |
| -### 📖 Project Overview |
| 22 | +* Ubuntu 22.04 (WSL2 recommended) |
| 23 | +* Chromium source code checkout |
| 24 | +* Perplexity API key |
| 25 | +* 16GB+ RAM for Chromium build |
| 26 | +* Git and standard build tools |
15 | 27 |
|
16 |
| -This Chrome browser patch integrates Perplexity’s Sonar API directly into Chromium, enabling: |
| 28 | +## Installation |
17 | 29 |
|
18 |
| -- **Omnibox Answers:** Type `sonar your question` in the address bar to get instant AI responses as autocomplete suggestions. |
19 |
| -- **Context-menu Summarization:** Select any text on a page, right-click **Summarize with Sonar**, and view a concise summary in a new tab. |
| 30 | +```bash |
| 31 | +# Clone the repository |
| 32 | +git clone https://github.com/KoushikBaagh/perplexity-hackathon-chromium.git |
| 33 | +cd perplexity-hackathon-chromium |
20 | 34 |
|
21 |
| -### 🎥 Demonstration Video |
| 35 | +# Apply patches to Chromium source |
| 36 | +# Follow the README for detailed Chromium setup instructions |
| 37 | +``` |
22 | 38 |
|
23 |
| -[](https://youtu.be/nFhciodeQ-c) |
| 39 | +## Configuration |
24 | 40 |
|
25 |
| -### 🔍 What This Does |
| 41 | +Update API keys in the modified files: |
| 42 | +```cpp |
| 43 | +// In sonar_autocomplete_provider.cc and render_view_context_menu.cc |
| 44 | +const std::string API_KEY = "your_perplexity_api_key_here"; |
| 45 | +``` |
26 | 46 |
|
27 |
| -1. **Sonar-Powered Omnibox Answers** |
| 47 | +## Usage |
28 | 48 |
|
29 |
| - - Detects the `sonar` keyword in the omnibox |
30 |
| - - Debounces input and queries the Sonar API |
31 |
| - - Renders the AI’s answer inline as a high-relevance suggestion |
| 49 | +1. **Build Chromium** with applied patches following the repository instructions |
| 50 | +2. **Launch the custom browser** with AI integration |
| 51 | +3. **Use Omnibox AI**: Type `sonar what is quantum tunneling?` in address bar |
| 52 | +4. **Use Context Summarization**: Select text, right-click "Summarize with Sonar" |
32 | 53 |
|
33 |
| -2. **Context-menu “Summarize with Sonar”** |
34 |
| - - Activates when text is selected |
35 |
| - - Sends selection to Sonar API with a “Please summarize” prompt |
36 |
| - - Opens a new `data:` URL tab showing original text + summary |
| 54 | +## Code Explanation |
37 | 55 |
|
38 |
| -### 🛠 Key Features & Use Cases |
| 56 | +* **Omnibox Integration**: Custom autocomplete provider hooking into Chromium's omnibox API |
| 57 | +* **Context Menu**: Modified render view context menu for text summarization |
| 58 | +* **API Integration**: Direct Perplexity Sonar API calls with debounced input handling |
| 59 | +* **Model Selection**: Sonar Pro for omnibox queries, Sonar for text summarization |
| 60 | +* **Browser Architecture**: Demonstrates Chromium extension points for AI features |
| 61 | +* **Build Process**: Custom Chromium build with AI patches applied |
39 | 62 |
|
40 |
| -- **Instant Research:** Get definitions, explanations, and summaries without leaving your tab. |
41 |
| -- **Developer Productivity:** Quickly test API integrations inside the browser. |
42 |
| -- **Custom Browser Builds:** See how to hook into Chromium’s omnibox and context menus. |
| 63 | +## Demo Video |
43 | 64 |
|
44 |
| -### ⚙️ How It Uses Perplexity Sonar |
| 65 | +<iframe |
| 66 | + className="w-full aspect-video rounded-xl" |
| 67 | + src="https://www.youtube.com/embed/nFhciodeQ-c" |
| 68 | + title="YouTube video player" |
| 69 | + frameBorder="0" |
| 70 | + allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" |
| 71 | + allowFullScreen |
| 72 | +></iframe> |
45 | 73 |
|
46 |
| -```js |
47 |
| -// Omnibox query (model=sonar-pro) |
48 |
| -await client.chat.completions.create({ |
49 |
| - model: "sonar-pro", |
50 |
| - messages: [ |
51 |
| - { role: "system", content: "Be precise and concise." }, |
52 |
| - { role: "user", content: "What is quantum tunneling?" }, |
53 |
| - ], |
54 |
| -}); |
| 74 | +## Links |
55 | 75 |
|
56 |
| -// Context-menu summarization (model=sonar) |
57 |
| -await client.chat.completions.create({ |
58 |
| - model: "sonar", |
59 |
| - messages: [ |
60 |
| - { role: "system", content: "Summarize the following text concisely." }, |
61 |
| - { role: "user", content: selectedText }, |
62 |
| - ], |
63 |
| -}); |
64 |
| -``` |
| 76 | +- [GitHub Repository](https://github.com/KoushikBaagh/perplexity-hackathon-chromium) |
| 77 | +- [Chromium Gerrit Repository](https://chromium-review.googlesource.com/c/chromium/src/+/6778540) |
0 commit comments