Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Add YT assistant chrome extension (#2485)

Vir Kothari8b789adb1557
diff --git a/docs/docs.json b/docs/docs.json
index fcf3764ae..6738a6634 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -203,7 +203,8 @@
"examples/mem0-agentic-tool",
"examples/openai-inbuilt-tools",
"examples/mem0-openai-voice-demo",
- "examples/email_processing"
+ "examples/email_processing",
+ "examples/youtube-assistant"
]
}
]
diff --git a/docs/examples/overview.mdx b/docs/examples/overview.mdx
index dd39e10ad..ce279b08e 100644
--- a/docs/examples/overview.mdx
+++ b/docs/examples/overview.mdx
@@ -47,6 +47,10 @@ Explore how **Mem0** can power real-world applications and bring personalized, i
Add **long-term memory** to ChatGPT, Claude, or Perplexity via the **Mem0 Chrome Extension** — personalize your AI chats anywhere.
</Card>
+ <Card title="YouTube Assistant" icon="puzzle-piece" href="/examples/youtube-assistant">
+ Integrate **Mem0** into **YouTube's** native UI, providing personalized responses with video context.
+ </Card>
+
<Card title="Document Writing Assistant" icon="pen" href="/examples/document-writing">
Create a **Writing Assistant** that understands and adapts to your unique style, improving consistency and productivity.
</Card>
diff --git a/docs/examples/youtube-assistant.mdx b/docs/examples/youtube-assistant.mdx
new file mode 100644
index 000000000..4fbd87b58
--- /dev/null
+++ b/docs/examples/youtube-assistant.mdx
@@ -0,0 +1,56 @@
+---
+title: YouTube Assistant Extension
+---
+
+Enhance your YouTube experience with Mem0's **YouTube Assistant**, a Chrome extension that brings AI-powered chat directly to your YouTube videos. Get instant, personalized answers about video content while leveraging your own knowledge and memories - all without leaving the page.
+
+## Features
+
+- **Contextual AI Chat**: Ask questions about videos you're watching
+- **Seamless Integration**: Chat interface sits alongside YouTube's native UI
+- **Memory Integration**: Personalized responses based on your knowledge through Mem0
+- **Real-Time Memory**: Memories are updated in real-time based on your interactions
+
+## Installation
+
+This extension is not available on the Chrome Web Store yet. You can install it manually using below method:
+
+### Manual Installation (Developer Mode)
+
+1. **Download the Extension**: Clone or download the extension files from the [Mem0 GitHub repository](https://github.com/mem0ai/mem0/tree/main/examples).
+2. **Build**: Run `npm install` followed by `npm run build` to install the dependencies and build the extension.
+3. **Access Chrome Extensions**: Open Google Chrome and navigate to `chrome://extensions`.
+4. **Enable Developer Mode**: Toggle the "Developer mode" switch in the top right corner.
+5. **Load Unpacked Extension**: Click "Load unpacked" and select the directory containing the extension files.
+6. **Confirm Installation**: The Mem0 YouTube Assistant Extension should now appear in your Chrome toolbar.
+
+## Setup
+
+1. **Configure API Settings**: Click the extension icon and enter your OpenAI API key (required to use the extension)
+2. **Customize Settings**: Configure additional settings such as model, temperature, and memory settings
+3. **Navigate to YouTube**: Start using the assistant on any YouTube video
+4. **Memories**: Enter your Mem0 API key to enable personalized responses, and feed initial memories from settings
+
+## Demo Video
+
+<video
+ autoPlay
+ muted
+ loop
+ playsInline
+ width="700"
+ height="400"
+ src="https://github.com/user-attachments/assets/c0334ccd-311b-4dd7-8034-ef88204fc751"
+></video>
+
+## Example Prompts
+
+- "Can you summarize the main points of this video?"
+- "Explain the concept they just mentioned"
+- "How does this relate to what I already know?"
+- "What are some practical applications of this topic related to my work?"
+
+
+## Privacy and Data Security
+
+Your API keys are stored locally in your browser. Your messages are sent to the Mem0 API for extracting and retrieving memories. Mem0 is committed to ensuring your data's privacy and security.
diff --git a/examples/yt-assistant-chrome/.gitignore b/examples/yt-assistant-chrome/.gitignore
new file mode 100644
index 000000000..909359518
--- /dev/null
+++ b/examples/yt-assistant-chrome/.gitignore
@@ -0,0 +1,4 @@
+node_modules
+.env*
+dist
+package-lock.json
\ No newline at end of file
diff --git a/examples/yt-assistant-chrome/README.md b/examples/yt-assistant-chrome/README.md
new file mode 100644
index 000000000..da8f4f1b3
--- /dev/null
+++ b/examples/yt-assistant-chrome/README.md
@@ -0,0 +1,88 @@
+# Mem0 Assistant Chrome Extension
+
+A powerful Chrome extension that combines AI chat with your personal knowledge base through mem0. Get instant, personalized answers about video content while leveraging your own knowledge and memories - all without leaving the page.
+
+## Development
+
+1. Install dependencies:
+ ```bash
+ npm install
+ ```
+
+2. Start development mode:
+ ```bash
+ npm run watch
+ ```
+
+3. Build for production:
+ ```bash
+ npm run build
+ ```
+
+## Features
+
+- AI-powered chat interface directly in YouTube
+- Memory capabilities powered by Mem0
+- Dark mode support
+- Customizable options
+
+## Permissions
+
+- activeTab: For accessing the current tab
+- storage: For saving user preferences
+- scripting: For injecting content scripts
+
+## Host Permissions
+
+- youtube.com
+- openai.com
+- mem0.ai
+
+## Features
+
+- **Contextual AI Chat**: Ask questions about videos you're watching
+- **Seamless Integration**: Chat interface sits alongside YouTube's native UI
+- **OpenAI-Powered**: Uses GPT models for intelligent responses
+- **Customizable**: Configure model settings, appearance, and behavior
+- **Future mem0 Integration**: Personalized responses based on your knowledge (coming soon)
+
+## Installation
+
+### From Source (Developer Mode)
+
+1. Download or clone this repository
+2. Open Chrome and navigate to `chrome://extensions/`
+3. Enable "Developer mode" (toggle in the top-right corner)
+4. Click "Load unpacked" and select the extension directory
+5. The extension should now be installed and visible in your toolbar
+
+### Setup
+
+1. Click the extension icon in your toolbar
+2. Enter your OpenAI API key (required to use the extension)
+3. Configure additional settings if desired
+4. Navigate to YouTube to start using the assistant
+
+## Usage
+
+1. Visit any YouTube video
+2. Click the AI assistant icon in the corner of the page to open the chat interface
+3. Ask questions about the video content
+4. The AI will respond with contextual information
+
+### Example Prompts
+
+- "Can you summarize the main points of this video?"
+- "What is the speaker explaining at 5:23?"
+- "Explain the concept they just mentioned"
+- "How does this relate to [topic I'm learning about]?"
+- "What are some practical applications of what's being discussed?"
+
+- **API Settings**: Change model, adjust tokens, modify temperature
+- **Interface Settings**: Control where and how the chat appears
+- **Behavior Settings**: Configure auto-context extraction
+
+## Privacy & Data
+
+- Your API keys are stored locally in your browser
+- Video context and transcript is processed locally and only sent to OpenAI when you ask questions
diff --git a/examples/yt-assistant-chrome/assets/dark.svg b/examples/yt-assistant-chrome/assets/dark.svg
new file mode 100644
index 000000000..618fa3917
--- /dev/null
+++ b/examples/yt-assistant-chrome/assets/dark.svg
@@ -0,0 +1,8 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="479" height="108" viewBox="0 0 479 108" fill="none">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M56.1537 8.95776C58.6168 8.95776 60.6135 6.96102 60.6135 4.49792C60.6135 2.03482 58.6168 0.0380859 56.1537 0.0380859C53.6906 0.0380859 51.6939 2.03482 51.6939 4.49792C51.6939 6.96102 53.6906 8.95776 56.1537 8.95776ZM38.4182 29.3545C37.2703 27.8706 36.3474 26.0172 36.833 24.205C37.3186 22.3928 39.0445 21.2492 40.7806 20.538C42.9589 19.6458 44.71 17.7824 45.3663 15.3332C46.4819 11.1696 44.0111 6.88999 39.8475 5.77437C35.684 4.65876 31.4044 7.12959 30.2887 11.2931C29.6325 13.7425 30.2173 16.2319 31.6578 18.0938C32.8058 19.5776 33.7287 21.431 33.2431 23.2431C32.7575 25.0553 31.0317 26.1989 29.2955 26.9099C27.1171 27.8021 25.3658 29.6656 24.7096 32.1149C23.5939 36.2785 26.0648 40.5581 30.2283 41.6737C34.3919 42.7893 38.6715 40.3185 39.7871 36.1549C40.4434 33.7057 39.8586 31.2164 38.4182 29.3545ZM86.1482 38.6266C84.3362 38.1411 82.483 39.0639 80.9994 40.2118C79.1375 41.6523 76.6479 42.2373 74.1986 41.5809C70.035 40.4653 67.5642 36.1857 68.6798 32.0222C69.7954 27.8586 74.075 25.3878 78.2386 26.5034C80.6877 27.1597 82.5512 28.9107 83.4434 31.089C84.1546 32.8252 85.2983 34.5512 87.1106 35.0368C88.9228 35.5224 90.7761 34.5996 92.2601 33.4518C94.1219 32.0117 96.6111 31.427 99.0601 32.0832C103.224 33.1989 105.694 37.4785 104.579 41.642C103.463 45.8056 99.1836 48.2764 95.0201 47.1608C92.5706 46.5044 90.707 44.753 89.8148 42.5743C89.1039 40.8381 87.9604 39.1122 86.1482 38.6266ZM103.562 77.1778C100.514 80.2257 95.5723 80.2257 92.5243 77.1778C90.7315 75.385 89.9933 72.937 90.3095 70.6046C90.5616 68.7456 90.434 66.6791 89.1074 65.3526C87.7808 64.026 85.7143 63.8984 83.8553 64.1505C81.5228 64.4668 79.0748 63.7285 77.2819 61.9357C74.234 58.8878 74.234 53.9461 77.2819 50.8982C80.3299 47.8503 85.2715 47.8503 88.3195 50.8982C90.1127 52.6915 90.8509 55.1403 90.534 57.4733C90.2816 59.332 90.4089 61.3981 91.7353 62.7245C93.0617 64.0509 95.1279 64.1782 96.9867 63.9257C99.3197 63.6088 101.769 64.347 103.562 66.1403C106.61 69.1882 106.61 74.1299 103.562 77.1778ZM64.1201 96.0387C63.0045 100.202 65.4753 104.482 69.6389 105.597C73.8024 106.713 78.082 104.242 79.1977 100.079C79.854 97.6293 79.2691 95.1398 77.8285 93.2779C76.6805 91.7942 75.7578 89.941 76.2433 88.129C76.7288 86.3171 78.4545 85.1735 80.1904 84.4626C82.3688 83.5704 84.1201 81.7069 84.7764 79.2576C85.892 75.094 83.4212 70.8144 79.2576 69.6988C75.0941 68.5832 70.8144 71.054 69.6988 75.2176C69.0425 77.667 69.6275 80.1566 71.0681 82.0185C72.2161 83.5022 73.1389 85.3553 72.6534 87.1673C72.1678 88.9792 70.4422 90.1227 68.7063 90.8336C66.5278 91.7258 64.7764 93.5893 64.1201 96.0387ZM28.837 99.7103C26.6818 95.9774 27.9607 91.2041 31.6937 89.0489C33.8898 87.781 36.4459 87.7016 38.6172 88.6113C40.3475 89.3361 42.3764 89.7478 44.0011 88.8099C45.6257 87.8719 46.2836 85.9088 46.521 84.0479C46.8189 81.7126 48.1657 79.5385 50.3618 78.2706C54.0947 76.1154 58.868 77.3944 61.0232 81.1273C63.1784 84.8602 61.8994 89.6335 58.1665 91.7887C55.9707 93.0565 53.4149 93.136 51.2438 92.2267C49.5133 91.502 47.4842 91.0903 45.8595 92.0284C44.2347 92.9665 43.5767 94.9296 43.3391 96.7907C43.041 99.1256 41.6942 101.299 39.4984 102.567C35.7655 104.722 30.9922 103.443 28.837 99.7103ZM28.4865 71.1602C27.0029 72.3082 25.1498 73.231 23.3379 72.7455C21.5259 72.2599 20.3825 70.5342 19.6716 68.7983C18.7795 66.6196 16.9159 64.8681 14.4664 64.2118C10.3028 63.0962 6.02323 65.567 4.90761 69.7305C3.792 73.8941 6.26283 78.1737 10.4264 79.2893C12.8756 79.9456 15.365 79.3608 17.2268 77.9204C18.7106 76.7725 20.5639 75.8498 22.3759 76.3353C24.188 76.8209 25.3316 78.5467 26.0426 80.2827C26.9349 82.461 28.7983 84.2122 31.2476 84.8684C35.4111 85.984 39.6907 83.5132 40.8064 79.3497C41.922 75.1861 39.4511 70.9065 35.2876 69.7909C32.8381 69.1345 30.3484 69.7195 28.4865 71.1602ZM5.92479 34.1947C8.97272 31.1467 13.9144 31.1467 16.9623 34.1947C18.7553 35.9876 19.4935 38.4359 19.177 40.7686C18.9248 42.6273 19.0524 44.6933 20.3787 46.0196C21.7052 47.3461 23.7716 47.4735 25.6305 47.2211C27.9634 46.9044 30.412 47.6426 32.2051 49.4358C35.2531 52.4837 35.2531 57.4254 32.2051 60.4733C29.1572 63.5212 24.2155 63.5212 21.1676 60.4733C19.3746 58.6803 18.6364 56.2319 18.9529 53.8992C19.2052 52.0405 19.0776 49.9745 17.7513 48.6482C16.4248 47.3217 14.3585 47.1943 12.4996 47.4468C10.1667 47.7636 7.71801 47.0254 5.92479 45.2322C2.87686 42.1843 2.87686 37.2426 5.92479 34.1947ZM65.4846 22.5623C63.8601 23.5002 63.2023 25.463 62.965 27.3237C62.6672 29.659 61.3204 31.8332 59.1242 33.1012C55.3912 35.2564 50.618 33.9774 48.4627 30.2444C46.3075 26.5115 47.5865 21.7382 51.3195 19.583C53.5153 18.3152 56.0712 18.2358 58.2424 19.1451C59.9728 19.8699 62.0019 20.2816 63.6267 19.3435C65.2513 18.4055 65.9093 16.4426 66.147 14.5818C66.4451 12.2469 67.7918 10.0734 69.9876 8.80565C73.7205 6.65044 78.4938 7.92944 80.649 11.6624C82.8042 15.3953 81.5252 20.1686 77.7923 22.3238C75.596 23.5918 73.0396 23.6711 70.8681 22.7612C69.138 22.0362 67.1091 21.6244 65.4846 22.5623ZM104.469 60.2458C106.932 60.2458 108.928 58.2491 108.928 55.786C108.928 53.3229 106.932 51.3262 104.469 51.3262C102.006 51.3262 100.009 53.3229 100.009 55.786C100.009 58.2491 102.006 60.2458 104.469 60.2458ZM96.2923 21.594C96.2923 24.0571 94.2955 26.0538 91.8324 26.0538C89.3693 26.0538 87.3726 24.0571 87.3726 21.594C87.3726 19.1309 89.3693 17.1342 91.8324 17.1342C94.2955 17.1342 96.2923 19.1309 96.2923 21.594ZM23.4484 20.1072C23.4484 22.5703 21.4516 24.567 18.9885 24.567C16.5254 24.567 14.5287 22.5703 14.5287 20.1072C14.5287 17.6441 16.5254 15.6473 18.9885 15.6473C21.4516 15.6473 23.4484 17.6441 23.4484 20.1072ZM4.86563 60.2458C7.32873 60.2458 9.32546 58.2491 9.32546 55.786C9.32546 53.3229 7.32873 51.3262 4.86563 51.3262C2.40253 51.3262 0.405792 53.3229 0.405792 55.786C0.405792 58.2491 2.40253 60.2458 4.86563 60.2458ZM22.7052 89.2346C22.7052 91.6977 20.7084 93.6945 18.2453 93.6945C15.7822 93.6945 13.7855 91.6977 13.7855 89.2346C13.7855 86.7715 15.7822 84.7748 18.2453 84.7748C20.7084 84.7748 22.7052 86.7715 22.7052 89.2346ZM52.4373 107.818C54.9004 107.818 56.8971 105.821 56.8971 103.358C56.8971 100.895 54.9004 98.8979 52.4373 98.8979C49.9742 98.8979 47.9774 100.895 47.9774 103.358C47.9774 105.821 49.9742 107.818 52.4373 107.818ZM95.5487 90.7213C95.5487 93.1844 93.552 95.1811 91.0889 95.1811C88.6258 95.1811 86.6291 93.1844 86.6291 90.7213C86.6291 88.2582 88.6258 86.2615 91.0889 86.2615C93.552 86.2615 95.5487 88.2582 95.5487 90.7213ZM54.4752 68.562C61.8667 68.562 67.8587 62.5701 67.8587 55.1785C67.8587 47.787 61.8667 41.795 54.4752 41.795C47.0837 41.795 41.0917 47.787 41.0917 55.1785C41.0917 62.5701 47.0837 68.562 54.4752 68.562Z" fill="white"/>
+<path d="M250.204 68.8528C250.153 73.1951 251.423 77.4504 253.845 81.0546C256.267 84.6589 259.727 87.4421 263.767 89.0354C268.868 91.0804 274.096 91.2203 279.285 89.422C284.529 87.6122 288.097 83.754 291.09 79.1588C292.462 79.8778 293.815 80.5836 295.165 81.2976C296.061 81.7698 296.936 82.2848 297.854 82.7126C298.489 83.0071 298.625 83.2983 298.285 83.9597C295.786 88.8281 291.982 92.3868 287.262 95.0422C282.184 97.9001 276.696 99.0847 270.916 98.9086C263.03 98.6701 256.145 95.8895 250.493 90.3532C245.401 85.368 242.374 79.2674 241.271 72.2223C240.365 66.4294 240.508 60.6676 242.285 55.0622C245.539 44.7924 252.086 37.4891 262.583 34.5342C272.587 31.7175 281.969 33.3216 289.947 40.4094C294.94 44.8516 297.928 50.5015 299.28 57.0266C300.045 60.717 300.022 64.4303 299.537 68.1454C299.47 68.6554 299.302 68.8989 298.775 68.8528C298.53 68.8314 298.282 68.8528 298.035 68.8528H250.204ZM290.434 60.4998C290.225 53.6851 287.285 48.384 281.699 44.8072C274.74 40.3535 267.446 40.4719 260.383 44.6032C254.402 48.1027 251.202 53.5551 250.271 60.4998H290.434Z" fill="white"/>
+<path d="M478.447 53.9189C478.534 61.6747 477.563 69.2742 474.701 76.5446C472.006 83.3939 468.019 89.2922 461.928 93.5929C457.358 96.8209 452.249 98.4942 446.67 98.8413C441.502 99.1704 436.497 98.5353 431.731 96.4458C425.668 93.7871 421.037 89.4666 417.485 83.9418C413.663 77.9892 411.512 71.4196 410.494 64.4503C409.537 57.9083 409.471 51.2667 410.298 44.707C411.356 36.2257 413.964 28.2938 419.183 21.4084C423.577 15.617 429.179 11.438 436.361 9.87173C446.891 7.56835 456.578 9.35511 464.824 16.716C469.503 20.8917 472.657 26.1155 474.888 31.9266C477.068 37.6044 478.134 43.5142 478.427 49.5704C478.508 51.0183 478.447 52.4711 478.447 53.9189ZM469.251 53.9748C469.22 49.7465 468.901 45.5724 468.008 41.4609C466.838 36.0743 464.841 31.0463 461.494 26.6058C454.977 17.9549 444.739 15.9411 436.114 19.383C430.497 21.6255 426.781 25.9641 424.046 31.2043C420.616 37.7854 419.406 44.9045 419.225 52.2358C419.1 56.3191 419.386 60.4047 420.081 64.4305C420.991 69.5473 422.569 74.4272 425.354 78.8398C429.058 84.7035 434.036 88.8348 441.132 89.8253C446.088 90.5179 450.808 89.7545 455.109 87.0744C459.859 84.1129 463.006 79.7924 465.263 74.7743C468.253 68.1571 469.179 61.135 469.251 53.9781V53.9748Z" fill="white"/>
+<path d="M444.229 47.8479H444.227C440.869 47.8479 438.146 50.5704 438.146 53.9288V53.9305C438.146 57.2889 440.869 60.0114 444.227 60.0114H444.229C447.587 60.0114 450.309 57.2889 450.309 53.9305V53.9288C450.309 50.5704 447.587 47.8479 444.229 47.8479Z" fill="white"/>
+<path d="M230.566 56.089C230.544 49.3582 227.902 43.7133 222.91 39.2579C216.811 33.8137 209.623 32.1207 201.716 33.8992C195.923 35.2023 191.272 38.3299 188.225 43.5751C187.971 44.0111 187.731 44.452 187.437 44.9653C187.264 44.7086 187.153 44.5573 187.058 44.3977C185.613 41.9794 183.729 39.8519 181.504 38.1243C181.43 38.0618 181.351 37.9992 181.263 37.9351C180.77 37.5616 180.26 37.2079 179.735 36.8706C175.533 34.123 171.813 33.2362 167.797 33.2362C165.594 33.184 163.393 33.4084 161.245 33.9042C155.981 35.0904 151.645 37.7886 148.613 42.221H146.836V41.2338C146.836 39.3698 146.797 37.504 146.856 35.6399C146.881 34.8173 146.603 34.6034 145.826 34.6396C144.595 34.6988 143.358 34.6922 142.126 34.6396C141.392 34.61 141.139 34.8041 141.139 35.5971C141.173 41.2733 141.157 46.9495 141.157 52.624C141.157 67.2373 141.151 81.8512 141.14 96.4656C141.14 97.229 141.356 97.4527 142.108 97.4346C144.355 97.3902 146.604 97.4198 148.853 97.4181C150.016 97.4181 150.016 97.4182 150.016 96.2434C150.016 84.2626 150.02 72.2812 150.026 60.2992C150.022 59.0125 150.097 57.7268 150.25 56.4493C151.155 49.1854 156.413 42.4546 165.092 42.1667C165.834 42.1418 166.578 42.1594 167.318 42.2194C167.483 42.2342 167.636 42.2473 167.794 42.2671C172.058 42.736 175.576 44.7449 178.234 48.5191C180.615 51.9051 181.407 55.7583 181.413 59.804C181.436 72.0053 181.436 84.2061 181.413 96.4063C181.413 97.196 181.639 97.4478 182.433 97.4313C184.681 97.3852 186.928 97.4165 189.179 97.4149C190.278 97.4149 190.278 97.4149 190.278 96.278C190.278 84.2955 190.263 72.3146 190.298 60.3338C190.31 58.7461 190.45 57.1619 190.719 55.597C191.951 48.2065 197.55 42.4036 205.551 42.1519C210.312 42.0022 214.381 43.5454 217.535 47.1914C220.511 50.6316 221.683 54.7382 221.693 59.2018C221.721 71.5414 221.703 83.8809 221.703 96.2204C221.703 97.4198 221.703 97.4214 222.933 97.4214C225.098 97.4214 227.264 97.4214 229.43 97.4214C230.582 97.4214 230.582 97.4214 230.582 96.2385C230.579 82.8493 230.61 69.4683 230.566 56.089Z" fill="white"/>
+<path d="M399.355 56.089C399.334 49.3582 396.692 43.7133 391.7 39.2579C385.601 33.8137 378.413 32.1207 370.506 33.8992C364.713 35.2023 360.061 38.3299 357.014 43.5751C356.761 44.0111 356.521 44.452 356.226 44.9653C356.054 44.7086 355.943 44.5573 355.848 44.3977C354.404 41.9804 352.522 39.8535 350.298 38.1259C350.224 38.0634 350.145 38.0009 350.058 37.9367C349.565 37.5632 349.055 37.2095 348.53 36.8722C344.328 34.1246 340.608 33.2378 336.592 33.2378C334.389 33.1857 332.188 33.4101 330.04 33.9058C324.767 35.092 320.44 37.7903 317.408 42.2226H315.631V41.2355C315.631 39.3714 315.592 37.5057 315.651 35.6416C315.675 34.8189 315.397 34.605 314.621 34.6412C313.39 34.7005 312.153 34.6939 310.921 34.6412C310.187 34.6116 309.933 34.8058 309.933 35.5988C309.968 41.275 309.952 46.9512 309.952 52.6257C309.952 67.239 309.946 81.8528 309.935 96.4672C309.935 97.2306 310.151 97.4544 310.903 97.4363C313.15 97.3918 315.399 97.4214 317.648 97.4198C318.81 97.4198 318.81 97.4198 318.81 96.2451C318.81 84.2642 318.813 72.2828 318.82 60.3009C318.815 59.0142 318.89 57.7284 319.043 56.4509C319.948 49.1871 325.206 42.4563 333.885 42.1683C334.628 42.1435 335.371 42.1611 336.111 42.221C336.276 42.2358 336.429 42.249 336.587 42.2687C340.851 42.7376 344.369 44.7465 347.028 48.5207C349.41 51.9067 350.2 55.7599 350.206 59.8056C350.229 72.007 350.229 84.2077 350.206 96.408C350.206 97.1977 350.433 97.4494 351.226 97.433C353.474 97.3869 355.723 97.4181 357.972 97.4165C359.071 97.4165 359.071 97.4165 359.073 96.2796C359.073 84.2971 359.056 72.3163 359.091 60.3354C359.103 58.7477 359.244 57.1637 359.512 55.5987C360.744 48.2081 366.343 42.4053 374.344 42.1535C379.105 42.0038 383.174 43.5471 386.328 47.193C389.305 50.6333 390.476 54.7399 390.486 59.2035C390.514 71.543 390.496 83.8825 390.496 96.2221C390.496 97.4215 390.496 97.4231 391.726 97.4231C393.892 97.4231 396.057 97.4231 398.224 97.4231C399.375 97.4231 399.375 97.4231 399.375 96.2401C399.369 82.8493 399.4 69.4683 399.355 56.089Z" fill="white"/>
+</svg>
\ No newline at end of file
diff --git a/examples/yt-assistant-chrome/manifest.json b/examples/yt-assistant-chrome/manifest.json
new file mode 100644
index 000000000..6410300fa
--- /dev/null
+++ b/examples/yt-assistant-chrome/manifest.json
@@ -0,0 +1,45 @@
+{
+ "manifest_version": 3,
+ "name": "YouTube Assistant powered by Mem0",
+ "version": "1.0",
+ "description": "An AI-powered YouTube assistant with memory capabilities from Mem0",
+ "permissions": [
+ "activeTab",
+ "storage",
+ "scripting"
+ ],
+ "host_permissions": [
+ "https://*.youtube.com/*",
+ "https://*.openai.com/*",
+ "https://*.mem0.ai/*"
+ ],
+ "content_security_policy": {
+ "extension_pages": "script-src 'self'; object-src 'self'",
+ "sandbox": "sandbox allow-scripts; script-src 'self' 'unsafe-inline' 'unsafe-eval'; child-src 'self'"
+ },
+ "action": {
+ "default_popup": "public/popup.html"
+ },
+ "options_page": "public/options.html",
+ "content_scripts": [
+ {
+ "matches": ["https://*.youtube.com/*"],
+ "js": ["dist/content.bundle.js"],
+ "css": ["styles/content.css"]
+ }
+ ],
+ "background": {
+ "service_worker": "src/background.js"
+ },
+ "web_accessible_resources": [
+ {
+ "resources": [
+ "assets/*",
+ "dist/*",
+ "styles/*",
+ "node_modules/mem0ai/dist/*"
+ ],
+ "matches": ["https://*.youtube.com/*"]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/examples/yt-assistant-chrome/package.json b/examples/yt-assistant-chrome/package.json
new file mode 100644
index 000000000..abf294008
--- /dev/null
+++ b/examples/yt-assistant-chrome/package.json
@@ -0,0 +1,26 @@
+{
+ "name": "mem0-assistant",
+ "version": "1.0.0",
+ "description": "A Chrome extension that integrates AI chat functionality directly into YouTube and other sites. Get instant answers about video content without leaving the page.",
+ "main": "background.js",
+ "scripts": {
+ "build": "webpack --config webpack.config.js",
+ "watch": "webpack --config webpack.config.js --watch"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "devDependencies": {
+ "@babel/core": "^7.22.0",
+ "@babel/preset-env": "^7.22.0",
+ "babel-loader": "^9.1.2",
+ "css-loader": "^7.1.2",
+ "style-loader": "^4.0.0",
+ "webpack": "^5.85.0",
+ "webpack-cli": "^5.1.1",
+ "youtube-transcript": "^1.0.6"
+ },
+ "dependencies": {
+ "mem0ai": "^2.1.15"
+ }
+}
diff --git a/examples/yt-assistant-chrome/public/options.html b/examples/yt-assistant-chrome/public/options.html
new file mode 100644
index 000000000..1b91aab31
--- /dev/null
+++ b/examples/yt-assistant-chrome/public/options.html
@@ -0,0 +1,196 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>YouTube Assistant powered by Mem0</title>
+ <link rel="stylesheet" href="../styles/options.css">
+ </head>
+ <body>
+ <div class="main-content">
+ <header>
+ <div class="title-container">
+ <h1>YouTube Assistant</h1>
+ <div class="branding-container">
+ <span class="powered-by">powered by</span>
+ <a href="https://mem0.ai" target="_blank">
+ <img src="../assets/dark.svg" alt="Mem0 Logo" class="logo-img">
+ </a>
+ </div>
+ </div>
+ <div class="description">
+ Configure your YouTube Assistant preferences.
+ </div>
+ </header>
+
+ <div id="status-container"></div>
+
+ <div class="section">
+ <h2>Model Settings</h2>
+ <div class="form-group">
+ <label for="model">OpenAI Model</label>
+ <select id="model">
+ <option value="o3">o3</option>
+ <option value="o1">o1</option>
+ <option value="o1-mini">o1-mini</option>
+ <option value="o1-pro">o1-pro</option>
+ <option value="gpt-4o">GPT-4o</option>
+ <option value="gpt-4o-mini">GPT-4o mini</option>
+ </select>
+ <div class="description" style="margin-top: 8px; font-size: 13px">
+ Choose the OpenAI model to use depending on your needs.
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label for="max-tokens">Maximum Response Length</label>
+ <input
+ type="number"
+ id="max-tokens"
+ min="50"
+ max="4000"
+ value="2000"
+ />
+ <div class="description" style="margin-top: 8px; font-size: 13px">
+ Maximum number of tokens in the AI's response. Higher values allow
+ for longer responses but may increase processing time.
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label for="temperature">Response Creativity</label>
+ <input
+ type="range"
+ id="temperature"
+ min="0"
+ max="1"
+ step="0.1"
+ value="0.7"
+ />
+ <div
+ id="temperature-value"
+ style="display: inline-block; margin-left: 10px"
+ >
+ 0.7
+ </div>
+ <div class="description" style="margin-top: 8px; font-size: 13px">
+ Controls response randomness. Lower values (0.1-0.3) are more
+ focused and deterministic, higher values (0.7-0.9) are more creative
+ and diverse.
+ </div>
+ </div>
+ </div>
+
+ <div class="section">
+ <h2>Create Memories</h2>
+ <div class="description">
+ Add information about yourself that you want the AI to remember. This
+ information will be used to provide more personalized responses.
+ </div>
+
+ <div class="form-group">
+ <label for="memory-input">Your Information</label>
+ <textarea
+ id="memory-input"
+ class="memory-input"
+ placeholder="Enter information about yourself that you want the AI to remember..."
+ ></textarea>
+ </div>
+
+ <div class="actions">
+ <button id="add-memory" class="primary">
+ <span class="button-text">Add Memory</span>
+ </button>
+ </div>
+
+ <div id="memory-result" class="memory-result"></div>
+ </div>
+
+ <div class="actions">
+ <button id="reset-defaults" class="secondary-button">
+ Reset to Defaults
+ </button>
+ <button id="save-options">Save Changes</button>
+ </div>
+ </div>
+
+ <!-- Memories Sidebar -->
+ <div class="memories-sidebar" id="memories-sidebar">
+ <div class="memories-header">
+ <h2 class="memories-title">Your Memories</h2>
+ <div class="memories-actions">
+ <button
+ id="refresh-memories"
+ class="memory-action-btn"
+ title="Refresh Memories"
+ >
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M23 4v6h-6"></path>
+ <path d="M1 20v-6h6"></path>
+ <path
+ d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"
+ ></path>
+ </svg>
+ </button>
+ <button
+ id="delete-all-memories"
+ class="memory-action-btn delete"
+ title="Delete All Memories"
+ >
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M3 6h18"></path>
+ <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
+ <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path>
+ </svg>
+ </button>
+ </div>
+ </div>
+ <div class="memories-list" id="memories-list">
+ <!-- Memories will be populated here -->
+ </div>
+ </div>
+
+ <!-- Edit Memory Modal -->
+ <div class="edit-memory-modal" id="edit-memory-modal">
+ <div class="edit-memory-content">
+ <div class="edit-memory-header">
+ <h3 class="edit-memory-title">Edit Memory</h3>
+ <button class="edit-memory-close" id="close-edit-modal">
+ &times;
+ </button>
+ </div>
+ <textarea class="edit-memory-textarea" id="edit-memory-text"></textarea>
+ <div class="edit-memory-actions">
+ <button class="memory-action-btn delete" id="delete-memory">
+ Delete
+ </button>
+ <button class="memory-action-btn" id="save-memory">
+ Save Changes
+ </button>
+ </div>
+ </div>
+ </div>
+
+ <script src="../dist/options.bundle.js"></script>
+ </body>
+</html>
diff --git a/examples/yt-assistant-chrome/public/popup.html b/examples/yt-assistant-chrome/public/popup.html
new file mode 100644
index 000000000..6e8890c1e
--- /dev/null
+++ b/examples/yt-assistant-chrome/public/popup.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>YouTube Assistant powered by Mem0</title>
+ <link rel="stylesheet" href="../styles/popup.css">
+ </head>
+ <body>
+ <header>
+ <h1>YouTube Assistant</h1>
+ <div class="branding-container">
+ <span class="powered-by">powered by</span>
+ <a href="https://mem0.ai" target="_blank">
+ <img src="../assets/dark.svg" alt="Mem0 Logo" class="logo-img">
+ </a>
+ </div>
+ </header>
+
+ <div class="content">
+ <!-- Status area -->
+ <div id="status-container"></div>
+
+ <!-- API key input, only shown if not set -->
+ <div id="api-key-section" class="api-key-section">
+ <label for="api-key">OpenAI API Key</label>
+ <div class="api-key-input-wrapper">
+ <input type="password" id="api-key" placeholder="sk-..." />
+ <button class="toggle-password" id="toggle-openai-key">
+ <svg
+ class="icon"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
+ <circle cx="12" cy="12" r="3"></circle>
+ </svg>
+ </button>
+ </div>
+ <button id="save-api-key" class="save-button">
+ <svg
+ class="icon"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path
+ d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"
+ ></path>
+ <polyline points="17 21 17 13 7 13 7 21"></polyline>
+ <polyline points="7 3 7 8 15 8"></polyline>
+ </svg>
+ Save OpenAI Key
+ </button>
+ </div>
+
+ <!-- mem0 API key input -->
+ <div id="mem0-api-key-section" class="api-key-section">
+ <label for="mem0-api-key">Mem0 API Key</label>
+ <div class="api-key-input-wrapper">
+ <input
+ type="password"
+ id="mem0-api-key"
+ placeholder="Enter your mem0 API key"
+ />
+ <button class="toggle-password" id="toggle-mem0-key">
+ <svg
+ class="icon"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
+ <circle cx="12" cy="12" r="3"></circle>
+ </svg>
+ </button>
+ </div>
+ <div class="api-key-actions">
+ <p>Get your API key from <a href="https://mem0.ai" target="_blank" class="get-key-link">mem0.ai</a> to integrate memory features in the chat.</p>
+ <button id="save-mem0-api-key" class="save-button">
+ <svg
+ class="icon"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path
+ d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"
+ ></path>
+ <polyline points="17 21 17 13 7 13 7 21"></polyline>
+ <polyline points="7 3 7 8 15 8"></polyline>
+ </svg>
+ Save Mem0 Key
+ </button>
+ </div>
+ </div>
+
+ <!-- Action buttons -->
+ <div class="actions">
+ <button id="toggle-chat">
+ <svg
+ class="icon"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path
+ d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"
+ ></path>
+ </svg>
+ Chat
+ </button>
+ <button id="open-options">
+ <svg
+ class="icon"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <circle cx="12" cy="12" r="3"></circle>
+ <path
+ d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
+ ></path>
+ </svg>
+ Settings
+ </button>
+ </div>
+
+ <!-- Future mem0 integration status -->
+ <div class="mem0-status">
+ <p>
+ Mem0 integration:
+ <span id="mem0-status-text">Not configured</span>
+ </p>
+ </div>
+ </div>
+
+ <script src="../src/popup.js"></script>
+ </body>
+</html>
diff --git a/examples/yt-assistant-chrome/src/background.js b/examples/yt-assistant-chrome/src/background.js
new file mode 100644
index 000000000..a27fe95f8
--- /dev/null
+++ b/examples/yt-assistant-chrome/src/background.js
@@ -0,0 +1,255 @@
+// Background script to handle API calls to OpenAI and manage extension state
+
+// Configuration (will be stored in sync storage eventually)
+let config = {
+ apiKey: "", // Will be set by user in options
+ mem0ApiKey: "", // Will be set by user in options
+ model: "gpt-4",
+ maxTokens: 2000,
+ temperature: 0.7,
+ enabledSites: ["youtube.com"],
+};
+
+// Track if config is loaded
+let isConfigLoaded = false;
+
+// Initialize configuration from storage
+chrome.storage.sync.get(
+ ["apiKey", "mem0ApiKey", "model", "maxTokens", "temperature", "enabledSites"],
+ (result) => {
+ if (result.apiKey) config.apiKey = result.apiKey;
+ if (result.mem0ApiKey) config.mem0ApiKey = result.mem0ApiKey;
+ if (result.model) config.model = result.model;
+ if (result.maxTokens) config.maxTokens = result.maxTokens;
+ if (result.temperature) config.temperature = result.temperature;
+ if (result.enabledSites) config.enabledSites = result.enabledSites;
+
+ isConfigLoaded = true;
+ }
+);
+
+// Listen for messages from content script or popup
+chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
+ // Handle different message types
+ switch (request.action) {
+ case "sendChatRequest":
+ sendChatRequest(request.messages, request.model || config.model)
+ .then((response) => sendResponse(response))
+ .catch((error) => sendResponse({ error: error.message }));
+ return true; // Required for async response
+
+ case "saveConfig":
+ saveConfig(request.config)
+ .then(() => sendResponse({ success: true }))
+ .catch((error) => sendResponse({ error: error.message }));
+ return true;
+
+ case "getConfig":
+ // If config isn't loaded yet, load it first
+ if (!isConfigLoaded) {
+ chrome.storage.sync.get(
+ [
+ "apiKey",
+ "mem0ApiKey",
+ "model",
+ "maxTokens",
+ "temperature",
+ "enabledSites",
+ ],
+ (result) => {
+ if (result.apiKey) config.apiKey = result.apiKey;
+ if (result.mem0ApiKey) config.mem0ApiKey = result.mem0ApiKey;
+ if (result.model) config.model = result.model;
+ if (result.maxTokens) config.maxTokens = result.maxTokens;
+ if (result.temperature) config.temperature = result.temperature;
+ if (result.enabledSites) config.enabledSites = result.enabledSites;
+ isConfigLoaded = true;
+ sendResponse({ config });
+ }
+ );
+ return true;
+ }
+ sendResponse({ config });
+ return false;
+
+ case "openOptions":
+ // Open options page
+ chrome.runtime.openOptionsPage(() => {
+ if (chrome.runtime.lastError) {
+ console.error(
+ "Error opening options page:",
+ chrome.runtime.lastError
+ );
+ // Fallback: Try to open directly in a new tab
+ chrome.tabs.create({ url: chrome.runtime.getURL("options.html") });
+ }
+ sendResponse({ success: true });
+ });
+ return true;
+
+ case "toggleChat":
+ // Forward the toggle request to the active tab
+ chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
+ if (tabs[0]) {
+ chrome.tabs
+ .sendMessage(tabs[0].id, { action: "toggleChat" })
+ .then((response) => sendResponse(response))
+ .catch((error) => sendResponse({ error: error.message }));
+ } else {
+ sendResponse({ error: "No active tab found" });
+ }
+ });
+ return true;
+ }
+});
+
+// Handle extension icon click - toggle chat visibility
+chrome.action.onClicked.addListener((tab) => {
+ chrome.tabs
+ .sendMessage(tab.id, { action: "toggleChat" })
+ .catch((error) => console.error("Error toggling chat:", error));
+});
+
+// Save configuration to sync storage
+async function saveConfig(newConfig) {
+ // Validate API key if provided
+ if (newConfig.apiKey) {
+ try {
+ const isValid = await validateApiKey(newConfig.apiKey);
+ if (!isValid) {
+ throw new Error("Invalid API key");
+ }
+ } catch (error) {
+ throw new Error(`API key validation failed: ${error.message}`);
+ }
+ }
+
+ // Update local config
+ config = { ...config, ...newConfig };
+
+ // Save to sync storage
+ return chrome.storage.sync.set(newConfig);
+}
+
+// Validate OpenAI API key with a simple request
+async function validateApiKey(apiKey) {
+ try {
+ const response = await fetch("https://api.openai.com/v1/models", {
+ method: "GET",
+ headers: {
+ Authorization: `Bearer ${apiKey}`,
+ "Content-Type": "application/json",
+ },
+ });
+
+ if (!response.ok) {
+ throw new Error(`API returned ${response.status}`);
+ }
+
+ return true;
+ } catch (error) {
+ console.error("API key validation error:", error);
+ return false;
+ }
+}
+
+// Send a chat request to OpenAI API
+async function sendChatRequest(messages, model) {
+ // Check if API key is set
+ if (!config.apiKey) {
+ return {
+ error:
+ "API key not configured. Please set your OpenAI API key in the extension options.",
+ };
+ }
+
+ try {
+ const response = await fetch("https://api.openai.com/v1/chat/completions", {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${config.apiKey}`,
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ model: model || config.model,
+ messages: messages.map((msg) => ({
+ role: msg.role,
+ content: msg.content,
+ })),
+ max_tokens: config.maxTokens,
+ temperature: config.temperature,
+ stream: true, // Enable streaming
+ }),
+ });
+
+ if (!response.ok) {
+ const errorData = await response.json();
+ throw new Error(
+ errorData.error?.message || `API returned ${response.status}`
+ );
+ }
+
+ // Create a ReadableStream from the response
+ const reader = response.body.getReader();
+ const decoder = new TextDecoder();
+ let buffer = "";
+
+ // Process the stream
+ while (true) {
+ const { done, value } = await reader.read();
+ if (done) break;
+
+ // Decode the chunk and add to buffer
+ buffer += decoder.decode(value, { stream: true });
+
+ // Process complete lines
+ const lines = buffer.split("\n");
+ buffer = lines.pop() || ""; // Keep the last incomplete line in the buffer
+
+ for (const line of lines) {
+ if (line.startsWith("data: ")) {
+ const data = line.slice(6);
+ if (data === "[DONE]") {
+ // Stream complete
+ return { done: true };
+ }
+ try {
+ const parsed = JSON.parse(data);
+ if (parsed.choices[0].delta.content) {
+ // Send the chunk to the content script
+ chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
+ if (tabs[0]) {
+ chrome.tabs.sendMessage(tabs[0].id, {
+ action: "streamChunk",
+ chunk: parsed.choices[0].delta.content,
+ });
+ }
+ });
+ }
+ } catch (e) {
+ console.error("Error parsing chunk:", e);
+ }
+ }
+ }
+ }
+
+ return { done: true };
+ } catch (error) {
+ console.error("Error sending chat request:", error);
+ return { error: error.message };
+ }
+}
+
+// Future: Add mem0 integration functions here
+// When ready, replace with actual implementation
+function mem0Integration() {
+ // Placeholder for future mem0 integration
+ return {
+ getUserMemories: async (userId) => {
+ return { memories: [] };
+ },
+ saveMemory: async (userId, memory) => {
+ return { success: true };
+ },
+ };
+}
diff --git a/examples/yt-assistant-chrome/src/content.js b/examples/yt-assistant-chrome/src/content.js
new file mode 100644
index 000000000..316869ddc
--- /dev/null
+++ b/examples/yt-assistant-chrome/src/content.js
@@ -0,0 +1,657 @@
+// Main content script that injects the AI chat into YouTube
+import { YoutubeTranscript } from "youtube-transcript";
+import { MemoryClient } from "mem0ai";
+
+// Configuration
+const config = {
+ apiEndpoint: "https://api.openai.com/v1/chat/completions",
+ model: "gpt-4o",
+ chatPosition: "right", // Where to display the chat panel
+ autoExtract: true, // Automatically extract video context
+ mem0ApiKey: "", // Will be set through extension options
+};
+
+// Initialize Mem0AI - will be initialized properly when API key is available
+let mem0client = null;
+let mem0Initializing = false;
+
+// Function to initialize Mem0AI with API key from storage
+async function initializeMem0AI() {
+ if (mem0Initializing) return; // Prevent multiple simultaneous initialization attempts
+ mem0Initializing = true;
+
+ try {
+ // Get API key from storage
+ const items = await chrome.storage.sync.get(["mem0ApiKey"]);
+ if (items.mem0ApiKey) {
+ try {
+ // Create new client instance with v2.1.11 configuration
+ mem0client = new MemoryClient({
+ apiKey: items.mem0ApiKey,
+ projectId: "youtube-assistant", // Add a project ID for organization
+ isExtension: true,
+ });
+
+ // Set up custom instructions for the YouTube educational assistant
+ await mem0client.updateProject({
+ custom_instructions: `Your task: Create memories for a YouTube AI assistant. Focus on capturing:
+
+1. User's Knowledge & Experience:
+ - Direct statements about their skills, knowledge, or experience
+ - Their level of expertise in specific areas
+ - Technologies, frameworks, or tools they work with
+ - Their learning journey or background
+
+2. User's Interests & Goals:
+ - What they're trying to learn or understand (user messages may include the video title)
+ - Their specific questions or areas of confusion
+ - Their learning objectives or career goals
+ - Topics they want to explore further
+
+3. Personal Context:
+ - Their current role or position
+ - Their learning style or preferences
+ - Their experience level in the video's topic
+ - Any challenges or difficulties they're facing
+
+4. Video Engagement:
+ - Their reactions to the content
+ - Points they agree or disagree with
+ - Areas they want to discuss further
+ - Connections they make to other topics
+
+For each message:
+- Extract both explicit statements and implicit knowledge
+- Capture both video-related and personal context
+- Note any relationships between user's knowledge and video content
+
+Remember: The goal is to build a comprehensive understanding of both the user's knowledge and their learning journey through YouTube.`,
+ });
+ return true;
+ } catch (error) {
+ console.error("Error initializing Mem0AI:", error);
+ return false;
+ }
+ } else {
+ console.log("No Mem0AI API key found in storage");
+ return false;
+ }
+ } catch (error) {
+ console.error("Error accessing storage:", error);
+ return false;
+ } finally {
+ mem0Initializing = false;
+ }
+}
+
+// Global state
+let chatState = {
+ messages: [],
+ isVisible: false,
+ isLoading: false,
+ videoContext: null,
+ transcript: null, // Add transcript to state
+ userMemories: null, // Will store retrieved memories
+ currentStreamingMessage: null, // Track the current streaming message
+};
+
+// Function to extract video ID from YouTube URL
+function getYouTubeVideoId(url) {
+ const urlObj = new URL(url);
+ const searchParams = new URLSearchParams(urlObj.search);
+ return searchParams.get("v");
+}
+
+// Function to fetch and log transcript
+async function fetchAndLogTranscript() {
+ try {
+ // Check if we're on a YouTube video page
+ if (
+ window.location.hostname.includes("youtube.com") &&
+ window.location.pathname.includes("/watch")
+ ) {
+ const videoId = getYouTubeVideoId(window.location.href);
+
+ if (videoId) {
+ // Fetch transcript using youtube-transcript package
+ const transcript = await YoutubeTranscript.fetchTranscript(videoId);
+
+ // Decode HTML entities in transcript text
+ const decodedTranscript = transcript.map((entry) => ({
+ ...entry,
+ text: entry.text
+ .replace(/&amp;#39;/g, "'")
+ .replace(/&amp;quot;/g, '"')
+ .replace(/&amp;lt;/g, "<")
+ .replace(/&amp;gt;/g, ">")
+ .replace(/&amp;amp;/g, "&"),
+ }));
+
+ // Store transcript in state
+ chatState.transcript = decodedTranscript;
+ } else {
+ return;
+ }
+ }
+ } catch (error) {
+ console.error("Error fetching transcript:", error);
+ chatState.transcript = null;
+ }
+}
+
+// Initialize when the DOM is fully loaded
+document.addEventListener("DOMContentLoaded", async () => {
+ init();
+ fetchAndLogTranscript();
+ await initializeMem0AI(); // Initialize Mem0AI
+});
+
+// Also attempt to initialize on window load to handle YouTube's SPA behavior
+window.addEventListener("load", async () => {
+ init();
+ fetchAndLogTranscript();
+ await initializeMem0AI(); // Initialize Mem0AI
+});
+
+// Add another listener for YouTube's navigation events
+window.addEventListener("yt-navigate-finish", () => {
+ init();
+ fetchAndLogTranscript();
+});
+
+// Main initialization function
+function init() {
+ // Check if we're on a YouTube page
+ if (
+ !window.location.hostname.includes("youtube.com") ||
+ !window.location.pathname.includes("/watch")
+ ) {
+ return;
+ }
+
+ // Give YouTube's DOM a moment to settle
+ setTimeout(() => {
+ // Only inject if not already present
+ if (!document.getElementById("ai-chat-assistant-container")) {
+ injectChatInterface();
+ setupEventListeners();
+ extractVideoContext();
+ }
+ }, 1500);
+}
+
+// Extract context from the current YouTube video
+function extractVideoContext() {
+ if (!config.autoExtract) return;
+
+ try {
+ const videoTitle =
+ document.querySelector(
+ "h1.title.style-scope.ytd-video-primary-info-renderer"
+ )?.textContent ||
+ document.querySelector("h1.title")?.textContent ||
+ "Unknown Video";
+ const channelName =
+ document.querySelector("ytd-channel-name yt-formatted-string")
+ ?.textContent ||
+ document.querySelector("ytd-channel-name")?.textContent ||
+ "Unknown Channel";
+
+ // Video ID from URL
+ const videoId = new URLSearchParams(window.location.search).get("v");
+
+ // Update state with basic video context first
+ chatState.videoContext = {
+ title: videoTitle,
+ channel: channelName,
+ videoId: videoId,
+ url: window.location.href,
+ };
+ } catch (error) {
+ console.error("Error extracting video context:", error);
+ chatState.videoContext = {
+ title: "Error extracting video information",
+ url: window.location.href,
+ };
+ }
+}
+
+// Inject the chat interface into the YouTube page
+function injectChatInterface() {
+ // Create main container
+ const container = document.createElement("div");
+ container.id = "ai-chat-assistant-container";
+ container.className = "ai-chat-container";
+
+ // Set up basic HTML structure
+ container.innerHTML = `
+ <div class="ai-chat-header">
+ <div class="ai-chat-tabs">
+ <button class="ai-chat-tab active" data-tab="chat">Chat</button>
+ <button class="ai-chat-tab" data-tab="memories">Memories</button>
+ </div>
+ <div class="ai-chat-controls">
+ <button id="ai-chat-minimize" class="ai-chat-btn" title="Minimize">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <line x1="5" y1="12" x2="19" y2="12"></line>
+ </svg>
+ </button>
+ <button id="ai-chat-close" class="ai-chat-btn" title="Close">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <line x1="18" y1="6" x2="6" y2="18"></line>
+ <line x1="6" y1="6" x2="18" y2="18"></line>
+ </svg>
+ </button>
+ </div>
+ </div>
+ <div class="ai-chat-body">
+ <div id="ai-chat-content" class="ai-chat-content">
+ <div id="ai-chat-messages" class="ai-chat-messages"></div>
+ <div class="ai-chat-input-container">
+ <textarea id="ai-chat-input" placeholder="Ask about this video..."></textarea>
+ <button id="ai-chat-send" class="ai-chat-send-btn" title="Send message">
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <line x1="22" y1="2" x2="11" y2="13"></line>
+ <polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
+ </svg>
+ </button>
+ </div>
+ </div>
+ <div id="ai-chat-memories" class="ai-chat-memories" style="display: none;">
+ <div class="memories-header">
+ <div class="memories-title">
+ Manage memories <a href="#" id="manage-memories-link" title="Open options page">here <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
+ <polyline points="15 3 21 3 21 9"></polyline>
+ <line x1="10" y1="14" x2="21" y2="3"></line>
+ </svg></a>
+ </div>
+ <button id="refresh-memories" class="ai-chat-btn" title="Refresh memories">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M23 4v6h-6"></path>
+ <path d="M1 20v-6h6"></path>
+ <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
+ </svg>
+ </button>
+ </div>
+ <div id="memories-list" class="memories-list"></div>
+ </div>
+ </div>
+ `;
+
+ // Append to body
+ document.body.appendChild(container);
+
+ // Add welcome message
+ addMessage(
+ "assistant",
+ "Hello! I can help answer questions about this video. What would you like to know?"
+ );
+}
+
+// Set up event listeners for the chat interface
+function setupEventListeners() {
+ // Tab switching
+ const tabs = document.querySelectorAll(".ai-chat-tab");
+ tabs.forEach((tab) => {
+ tab.addEventListener("click", () => {
+ // Update active tab
+ tabs.forEach((t) => t.classList.remove("active"));
+ tab.classList.add("active");
+
+ // Show corresponding content
+ const tabName = tab.dataset.tab;
+ document.getElementById("ai-chat-content").style.display =
+ tabName === "chat" ? "flex" : "none";
+ document.getElementById("ai-chat-memories").style.display =
+ tabName === "memories" ? "flex" : "none";
+
+ // Load memories if switching to memories tab
+ if (tabName === "memories") {
+ loadMemories();
+ }
+ });
+ });
+
+ // Refresh memories button
+ document
+ .getElementById("refresh-memories")
+ ?.addEventListener("click", loadMemories);
+
+ // Toggle chat visibility
+ document.getElementById("ai-chat-toggle")?.addEventListener("click", () => {
+ const container = document.getElementById("ai-chat-assistant-container");
+ chatState.isVisible = !chatState.isVisible;
+
+ if (chatState.isVisible) {
+ container.classList.add("visible");
+ } else {
+ container.classList.remove("visible");
+ }
+ });
+
+ // Close button
+ document.getElementById("ai-chat-close")?.addEventListener("click", () => {
+ const container = document.getElementById("ai-chat-assistant-container");
+ container.classList.remove("visible");
+ chatState.isVisible = false;
+ });
+
+ // Minimize button
+ document.getElementById("ai-chat-minimize")?.addEventListener("click", () => {
+ const container = document.getElementById("ai-chat-assistant-container");
+ container.classList.toggle("minimized");
+ });
+
+ // Send message on button click
+ document
+ .getElementById("ai-chat-send")
+ ?.addEventListener("click", sendMessage);
+
+ // Send message on Enter key (but allow Shift+Enter for new lines)
+ document.getElementById("ai-chat-input")?.addEventListener("keydown", (e) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ sendMessage();
+ }
+ });
+
+ // Add click handler for manage memories link
+ document
+ .getElementById("manage-memories-link")
+ .addEventListener("click", (e) => {
+ e.preventDefault();
+ chrome.runtime.sendMessage({ action: "openOptions" }, (response) => {
+ if (chrome.runtime.lastError) {
+ console.error("Error opening options:", chrome.runtime.lastError);
+ // Fallback: Try to open directly in a new tab
+ chrome.tabs.create({ url: chrome.runtime.getURL("options.html") });
+ }
+ });
+ });
+}
+
+// Add a message to the chat
+function addMessage(role, text, isStreaming = false) {
+ const messagesContainer = document.getElementById("ai-chat-messages");
+ if (!messagesContainer) return;
+
+ const messageElement = document.createElement("div");
+ messageElement.className = `ai-chat-message ${role}`;
+
+ // Enhanced markdown-like formatting
+ let formattedText = text
+ // Code blocks
+ .replace(/```([\s\S]*?)```/g, "<pre><code>$1</code></pre>")
+ // Inline code
+ .replace(/`([^`]+)`/g, "<code>$1</code>")
+ // Links
+ .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank">$1</a>')
+ // Bold text
+ .replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>")
+ // Italic text
+ .replace(/\*([^*]+)\*/g, "<em>$1</em>")
+ // Lists
+ .replace(/^\s*[-*]\s+(.+)$/gm, "<li>$1</li>")
+ .replace(/(<li>.*<\/li>)/s, "<ul>$1</ul>")
+ // Line breaks
+ .replace(/\n/g, "<br>");
+
+ messageElement.innerHTML = formattedText;
+ messagesContainer.appendChild(messageElement);
+
+ // Scroll to bottom
+ messagesContainer.scrollTop = messagesContainer.scrollHeight;
+
+ // Add to messages array if not streaming
+ if (!isStreaming) {
+ chatState.messages.push({ role, content: text });
+ }
+
+ return messageElement;
+}
+
+// Format streaming text with markdown
+function formatStreamingText(text) {
+ return text
+ // Code blocks
+ .replace(/```([\s\S]*?)```/g, "<pre><code>$1</code></pre>")
+ // Inline code
+ .replace(/`([^`]+)`/g, "<code>$1</code>")
+ // Links
+ .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank">$1</a>')
+ // Bold text
+ .replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>")
+ // Italic text
+ .replace(/\*([^*]+)\*/g, "<em>$1</em>")
+ // Lists
+ .replace(/^\s*[-*]\s+(.+)$/gm, "<li>$1</li>")
+ .replace(/(<li>.*<\/li>)/s, "<ul>$1</ul>")
+ // Line breaks
+ .replace(/\n/g, "<br>");
+}
+
+// Send a message to the AI
+async function sendMessage() {
+ const inputElement = document.getElementById("ai-chat-input");
+ if (!inputElement) return;
+
+ const userMessage = inputElement.value.trim();
+ if (!userMessage) return;
+
+ // Clear input
+ inputElement.value = "";
+
+ // Add user message to chat
+ addMessage("user", userMessage);
+
+ // Show loading indicator
+ chatState.isLoading = true;
+ const loadingMessage = document.createElement("div");
+ loadingMessage.className = "ai-chat-message assistant loading";
+ loadingMessage.textContent = "Thinking...";
+ document.getElementById("ai-chat-messages").appendChild(loadingMessage);
+
+ try {
+ // If mem0client is available, store the message as a memory and search for relevant memories
+ if (mem0client) {
+ try {
+ // Store the message as a memory
+ await mem0client.add(
+ [
+ {
+ role: "user",
+ content: `${userMessage}\n\nVideo title: ${chatState.videoContext?.title}`,
+ },
+ ],
+ {
+ user_id: "youtube-assistant-mem0", // Required parameter
+ metadata: {
+ videoId: chatState.videoContext?.videoId || "",
+ videoTitle: chatState.videoContext?.title || "",
+ },
+ }
+ );
+
+ // Search for relevant memories
+ const searchResults = await mem0client.search(userMessage, {
+ user_id: "youtube-assistant-mem0", // Required parameter
+ limit: 5,
+ });
+
+ // Store the retrieved memories
+ chatState.userMemories = searchResults || null;
+ } catch (memoryError) {
+ console.error("Error with Mem0AI operations:", memoryError);
+ // Continue with the chat process even if memory operations fail
+ }
+ }
+
+ // Prepare messages with context (now includes memories if available)
+ const contextualizedMessages = prepareMessagesWithContext();
+
+ // Remove loading message
+ document.getElementById("ai-chat-messages").removeChild(loadingMessage);
+
+ // Create a new message element for streaming
+ chatState.currentStreamingMessage = addMessage("assistant", "", true);
+
+ // Send to background script to handle API call
+ chrome.runtime.sendMessage(
+ {
+ action: "sendChatRequest",
+ messages: contextualizedMessages,
+ model: config.model,
+ },
+ (response) => {
+ chatState.isLoading = false;
+
+ if (response.error) {
+ addMessage("system", `Error: ${response.error}`);
+ }
+ }
+ );
+ } catch (error) {
+ // Remove loading indicator
+ document.getElementById("ai-chat-messages").removeChild(loadingMessage);
+ chatState.isLoading = false;
+
+ // Show error
+ addMessage("system", `Error: ${error.message}`);
+ }
+}
+
+// Prepare messages with added context
+function prepareMessagesWithContext() {
+ const messages = [...chatState.messages];
+
+ // If we have video context, add it as system message at the beginning
+ if (chatState.videoContext) {
+ let transcriptSection = "";
+
+ // Add transcript if available
+ if (chatState.transcript) {
+ // Format transcript into a readable string
+ const formattedTranscript = chatState.transcript
+ .map((entry) => `${entry.text}`)
+ .join("\n");
+
+ transcriptSection = `\n\nTranscript:\n${formattedTranscript}`;
+ }
+
+ // Add user memories if available
+ let userMemoriesSection = "";
+ if (chatState.userMemories && chatState.userMemories.length > 0) {
+ const formattedMemories = chatState.userMemories
+ .map((memory) => `${memory.memory}`)
+ .join("\n");
+
+ userMemoriesSection = `\n\nUser Memories:\n${formattedMemories}\n\n`;
+ }
+
+ const systemContent = `You are an AI assistant helping with a YouTube video. Here's the context:
+ Title: ${chatState.videoContext.title}
+ Channel: ${chatState.videoContext.channel}
+ URL: ${chatState.videoContext.url}
+
+ ${
+ userMemoriesSection
+ ? `Use the user memories below to personalize your response based on their past interactions and interests. These memories represent relevant past conversations and information about the user.
+ ${userMemoriesSection}
+ `
+ : ""
+ }
+
+ Please provide helpful, relevant information based on the video's content.
+ ${
+ transcriptSection
+ ? `"Use the transcript below to provide accurate answers about the video. Ignore if the transcript doesn't make sense."
+ ${transcriptSection}
+ `
+ : "Since the transcript is not available, focus on general questions about the topic and use the video title for context. If asked about specific parts of the video content, politely explain that the video doesn't have a transcript."
+ }
+
+ Be concise and helpful in your responses.
+ `;
+
+ messages.unshift({
+ role: "system",
+ content: systemContent,
+ });
+ }
+
+ return messages;
+}
+
+// Listen for commands from the background script or popup
+chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
+ if (message.action === "toggleChat") {
+ const container = document.getElementById("ai-chat-assistant-container");
+ chatState.isVisible = !chatState.isVisible;
+
+ if (chatState.isVisible) {
+ container.classList.add("visible");
+ } else {
+ container.classList.remove("visible");
+ }
+
+ sendResponse({ success: true });
+ } else if (message.action === "streamChunk") {
+ // Handle streaming chunks
+ if (chatState.currentStreamingMessage) {
+ const currentContent = chatState.currentStreamingMessage.innerHTML;
+ chatState.currentStreamingMessage.innerHTML = formatStreamingText(currentContent + message.chunk);
+
+ // Scroll to bottom
+ const messagesContainer = document.getElementById("ai-chat-messages");
+ messagesContainer.scrollTop = messagesContainer.scrollHeight;
+ }
+ }
+});
+
+// Load memories from mem0
+async function loadMemories() {
+ try {
+ const memoriesContainer = document.getElementById("memories-list");
+ memoriesContainer.innerHTML =
+ '<div class="loading">Loading memories...</div>';
+
+ // If client isn't initialized, try to initialize it
+ if (!mem0client) {
+ const initialized = await initializeMem0AI();
+ if (!initialized) {
+ memoriesContainer.innerHTML =
+ '<div class="error">Please set your Mem0 API key in the extension options.</div>';
+ return;
+ }
+ }
+
+ const response = await mem0client.getAll({
+ user_id: "youtube-assistant-mem0",
+ page: 1,
+ page_size: 50,
+ });
+
+ if (response && response.results) {
+ memoriesContainer.innerHTML = "";
+ response.results.forEach((memory) => {
+ const memoryElement = document.createElement("div");
+ memoryElement.className = "memory-item";
+ memoryElement.textContent = memory.memory;
+ memoriesContainer.appendChild(memoryElement);
+ });
+
+ if (response.results.length === 0) {
+ memoriesContainer.innerHTML =
+ '<div class="no-memories">No memories found</div>';
+ }
+ } else {
+ memoriesContainer.innerHTML =
+ '<div class="no-memories">No memories found</div>';
+ }
+ } catch (error) {
+ console.error("Error loading memories:", error);
+ document.getElementById("memories-list").innerHTML =
+ '<div class="error">Error loading memories. Please try again.</div>';
+ }
+}
diff --git a/examples/yt-assistant-chrome/src/options.js b/examples/yt-assistant-chrome/src/options.js
new file mode 100644
index 000000000..dd347ba8a
--- /dev/null
+++ b/examples/yt-assistant-chrome/src/options.js
@@ -0,0 +1,452 @@
+// Options page functionality for AI Chat Assistant
+import { MemoryClient } from "mem0ai";
+
+// Default configuration
+const defaultConfig = {
+ model: "gpt-4o",
+ maxTokens: 2000,
+ temperature: 0.7,
+ enabledSites: ["youtube.com"],
+};
+
+// Initialize Mem0AI client
+let mem0client = null;
+
+// Initialize when the DOM is fully loaded
+document.addEventListener("DOMContentLoaded", init);
+
+// Initialize options page
+async function init() {
+ // Set up event listeners
+ document
+ .getElementById("save-options")
+ .addEventListener("click", saveOptions);
+ document
+ .getElementById("reset-defaults")
+ .addEventListener("click", resetToDefaults);
+ document.getElementById("add-memory").addEventListener("click", addMemory);
+
+ // Set up slider value display
+ const temperatureSlider = document.getElementById("temperature");
+ const temperatureValue = document.getElementById("temperature-value");
+
+ temperatureSlider.addEventListener("input", () => {
+ temperatureValue.textContent = temperatureSlider.value;
+ });
+
+ // Set up memories sidebar functionality
+ document
+ .getElementById("refresh-memories")
+ .addEventListener("click", fetchMemories);
+ document
+ .getElementById("delete-all-memories")
+ .addEventListener("click", deleteAllMemories);
+ document
+ .getElementById("close-edit-modal")
+ .addEventListener("click", closeEditModal);
+ document.getElementById("save-memory").addEventListener("click", saveMemory);
+ document
+ .getElementById("delete-memory")
+ .addEventListener("click", deleteMemory);
+
+ // Load current configuration
+ await loadConfig();
+ // Initialize Mem0AI and load memories
+ await initializeMem0AI();
+ await fetchMemories();
+}
+
+// Initialize Mem0AI with API key from storage
+async function initializeMem0AI() {
+ try {
+ const response = await chrome.runtime.sendMessage({ action: "getConfig" });
+ const mem0ApiKey = response.config.mem0ApiKey;
+
+ if (!mem0ApiKey) {
+ showMemoriesError("Please configure your Mem0 API key in the popup");
+ return false;
+ }
+
+ mem0client = new MemoryClient({
+ apiKey: mem0ApiKey,
+ projectId: "youtube-assistant",
+ isExtension: true,
+ });
+
+ return true;
+ } catch (error) {
+ console.error("Error initializing Mem0AI:", error);
+ showMemoriesError("Failed to initialize Mem0AI");
+ return false;
+ }
+}
+
+// Load configuration from storage
+async function loadConfig() {
+ try {
+ const response = await chrome.runtime.sendMessage({ action: "getConfig" });
+ const config = response.config;
+
+ // Update form fields with current values
+ if (config.model) {
+ document.getElementById("model").value = config.model;
+ }
+
+ if (config.maxTokens) {
+ document.getElementById("max-tokens").value = config.maxTokens;
+ }
+
+ if (config.temperature !== undefined) {
+ const temperatureSlider = document.getElementById("temperature");
+ temperatureSlider.value = config.temperature;
+ document.getElementById("temperature-value").textContent =
+ config.temperature;
+ }
+ } catch (error) {
+ showStatus(`Error loading configuration: ${error.message}`, "error");
+ }
+}
+
+// Save options to storage
+async function saveOptions() {
+ // Get values from form
+ const model = document.getElementById("model").value;
+ const maxTokens = parseInt(document.getElementById("max-tokens").value);
+ const temperature = parseFloat(document.getElementById("temperature").value);
+
+ // Validate inputs
+ if (maxTokens < 50 || maxTokens > 4000) {
+ showStatus("Maximum tokens must be between 50 and 4000", "error");
+ return;
+ }
+
+ if (temperature < 0 || temperature > 1) {
+ showStatus("Temperature must be between 0 and 1", "error");
+ return;
+ }
+
+ // Prepare config object
+ const config = {
+ model,
+ maxTokens,
+ temperature,
+ };
+
+ // Show loading status
+ showStatus("Saving options...", "warning");
+
+ try {
+ // Send to background script for saving
+ const response = await chrome.runtime.sendMessage({
+ action: "saveConfig",
+ config,
+ });
+
+ if (response.error) {
+ showStatus(`Error: ${response.error}`, "error");
+ } else {
+ showStatus("Options saved successfully", "success");
+ loadConfig(); // Refresh the UI with the latest saved values
+ }
+ } catch (error) {
+ showStatus(`Error: ${error.message}`, "error");
+ }
+}
+
+// Reset options to defaults
+function resetToDefaults() {
+ if (
+ confirm(
+ "Are you sure you want to reset all options to their default values?"
+ )
+ ) {
+ // Set form fields to default values
+ document.getElementById("model").value = defaultConfig.model;
+ document.getElementById("max-tokens").value = defaultConfig.maxTokens;
+
+ const temperatureSlider = document.getElementById("temperature");
+ temperatureSlider.value = defaultConfig.temperature;
+ document.getElementById("temperature-value").textContent =
+ defaultConfig.temperature;
+
+ showStatus("Restored default values. Click Save to apply.", "warning");
+ }
+}
+
+// Memories functionality
+let currentMemory = null;
+
+async function fetchMemories() {
+ try {
+ if (!mem0client) {
+ const initialized = await initializeMem0AI();
+ if (!initialized) return;
+ }
+
+ const memories = await mem0client.getAll({
+ user_id: "youtube-assistant-mem0",
+ page: 1,
+ page_size: 50,
+ });
+ displayMemories(memories.results);
+ } catch (error) {
+ console.error("Error fetching memories:", error);
+ showMemoriesError("Failed to load memories");
+ }
+}
+
+function displayMemories(memories) {
+ const memoriesList = document.getElementById("memories-list");
+ memoriesList.innerHTML = "";
+
+ if (memories.length === 0) {
+ memoriesList.innerHTML = `
+ <div class="memory-item">
+ <div class="memory-content">No memories found. Your memories will appear here.</div>
+ </div>
+ `;
+ return;
+ }
+
+ memories.forEach((memory) => {
+ const memoryElement = document.createElement("div");
+ memoryElement.className = "memory-item";
+ memoryElement.innerHTML = `
+ <div class="memory-content">${memory.memory}</div>
+ <div class="memory-meta">Last updated: ${new Date(
+ memory.updated_at
+ ).toLocaleString()}</div>
+ <div class="memory-actions">
+ <button class="memory-action-btn edit" data-id="${
+ memory.id
+ }">Edit</button>
+ <button class="memory-action-btn delete" data-id="${
+ memory.id
+ }">Delete</button>
+ </div>
+ `;
+
+ // Add event listeners
+ memoryElement
+ .querySelector(".edit")
+ .addEventListener("click", () => editMemory(memory));
+ memoryElement
+ .querySelector(".delete")
+ .addEventListener("click", () => deleteMemory(memory.id));
+
+ memoriesList.appendChild(memoryElement);
+ });
+}
+
+function showMemoriesError(message) {
+ const memoriesList = document.getElementById("memories-list");
+ memoriesList.innerHTML = `
+ <div class="memory-item">
+ <div class="memory-content">${message}</div>
+ </div>
+ `;
+}
+
+async function deleteAllMemories() {
+ if (
+ !confirm(
+ "Are you sure you want to delete all memories? This action cannot be undone."
+ )
+ ) {
+ return;
+ }
+
+ try {
+ if (!mem0client) {
+ const initialized = await initializeMem0AI();
+ if (!initialized) return;
+ }
+
+ await mem0client.deleteAll({
+ user_id: "youtube-assistant-mem0",
+ });
+ showStatus("All memories deleted successfully", "success");
+ await fetchMemories();
+ } catch (error) {
+ console.error("Error deleting memories:", error);
+ showStatus("Failed to delete memories", "error");
+ }
+}
+
+function editMemory(memory) {
+ currentMemory = memory;
+ const modal = document.getElementById("edit-memory-modal");
+ const textarea = document.getElementById("edit-memory-text");
+ textarea.value = memory.memory;
+ modal.classList.add("open");
+}
+
+function closeEditModal() {
+ const modal = document.getElementById("edit-memory-modal");
+ modal.classList.remove("open");
+ currentMemory = null;
+}
+
+async function saveMemory() {
+ if (!currentMemory) return;
+
+ try {
+ if (!mem0client) {
+ const initialized = await initializeMem0AI();
+ if (!initialized) return;
+ }
+
+ const textarea = document.getElementById("edit-memory-text");
+ const updatedMemory = textarea.value.trim();
+
+ if (!updatedMemory) {
+ showStatus("Memory cannot be empty", "error");
+ return;
+ }
+
+ await mem0client.update(currentMemory.id, updatedMemory);
+
+ showStatus("Memory updated successfully", "success");
+ closeEditModal();
+ await fetchMemories();
+ } catch (error) {
+ console.error("Error updating memory:", error);
+ showStatus("Failed to update memory", "error");
+ }
+}
+
+async function deleteMemory(memoryId) {
+ if (
+ !confirm(
+ "Are you sure you want to delete this memory? This action cannot be undone."
+ )
+ ) {
+ return;
+ }
+
+ try {
+ if (!mem0client) {
+ const initialized = await initializeMem0AI();
+ if (!initialized) return;
+ }
+
+ await mem0client.delete(memoryId);
+ showStatus("Memory deleted successfully", "success");
+ await fetchMemories();
+ } catch (error) {
+ console.error("Error deleting memory:", error);
+ showStatus("Failed to delete memory", "error");
+ }
+}
+
+// Show status message
+function showStatus(message, type = "info") {
+ const statusContainer = document.getElementById("status-container");
+
+ // Clear previous status
+ statusContainer.innerHTML = "";
+
+ // Create status element
+ const statusElement = document.createElement("div");
+ statusElement.className = `status ${type}`;
+ statusElement.textContent = message;
+
+ // Add to container
+ statusContainer.appendChild(statusElement);
+
+ // Auto-clear success messages after 3 seconds
+ if (type === "success") {
+ setTimeout(() => {
+ statusElement.style.opacity = "0";
+ setTimeout(() => {
+ if (statusContainer.contains(statusElement)) {
+ statusContainer.removeChild(statusElement);
+ }
+ }, 300);
+ }, 3000);
+ }
+}
+
+// Add memory to Mem0
+async function addMemory() {
+ const memoryInput = document.getElementById("memory-input");
+ const addButton = document.getElementById("add-memory");
+ const memoryResult = document.getElementById("memory-result");
+ const buttonText = addButton.querySelector(".button-text");
+
+ const content = memoryInput.value.trim();
+
+ if (!content) {
+ showMemoryResult(
+ "Please enter some information to add as a memory",
+ "error"
+ );
+ return;
+ }
+
+ // Show loading state
+ addButton.disabled = true;
+ buttonText.textContent = "Adding...";
+ addButton.innerHTML =
+ '<div class="loading-spinner"></div><span class="button-text">Adding...</span>';
+ memoryResult.style.display = "none";
+
+ try {
+ if (!mem0client) {
+ const initialized = await initializeMem0AI();
+ if (!initialized) return;
+ }
+
+ const result = await mem0client.add(
+ [
+ {
+ role: "user",
+ content: content,
+ },
+ ],
+ {
+ user_id: "youtube-assistant-mem0",
+ }
+ );
+
+ // Show success message with number of memories added
+ showMemoryResult(
+ `Added ${result.length || 0} new ${
+ result.length === 1 ? "memory" : "memories"
+ }`,
+ "success"
+ );
+
+ // Clear the input
+ memoryInput.value = "";
+
+ // Refresh the memories list
+ await fetchMemories();
+ } catch (error) {
+ showMemoryResult(`Error adding memory: ${error.message}`, "error");
+ } finally {
+ // Reset button state
+ addButton.disabled = false;
+ buttonText.textContent = "Add Memory";
+ addButton.innerHTML = '<span class="button-text">Add Memory</span>';
+ }
+}
+
+// Show memory result message
+function showMemoryResult(message, type) {
+ const memoryResult = document.getElementById("memory-result");
+ memoryResult.textContent = message;
+ memoryResult.className = `memory-result ${type}`;
+ memoryResult.style.display = "block";
+
+ // Auto-clear success messages after 3 seconds
+ if (type === "success") {
+ setTimeout(() => {
+ memoryResult.style.opacity = "0";
+ setTimeout(() => {
+ memoryResult.style.display = "none";
+ memoryResult.style.opacity = "1";
+ }, 300);
+ }, 3000);
+ }
+}
diff --git a/examples/yt-assistant-chrome/src/popup.js b/examples/yt-assistant-chrome/src/popup.js
new file mode 100644
index 000000000..b487e5907
--- /dev/null
+++ b/examples/yt-assistant-chrome/src/popup.js
@@ -0,0 +1,241 @@
+// Popup functionality for AI Chat Assistant
+
+document.addEventListener("DOMContentLoaded", init);
+
+// Initialize popup
+async function init() {
+ try {
+ // Set up event listeners
+ document
+ .getElementById("toggle-chat")
+ .addEventListener("click", toggleChat);
+ document
+ .getElementById("open-options")
+ .addEventListener("click", openOptions);
+ document
+ .getElementById("save-api-key")
+ .addEventListener("click", saveApiKey);
+ document
+ .getElementById("save-mem0-api-key")
+ .addEventListener("click", saveMem0ApiKey);
+
+ // Set up password toggle listeners
+ document
+ .getElementById("toggle-openai-key")
+ .addEventListener("click", () => togglePasswordVisibility("api-key"));
+ document
+ .getElementById("toggle-mem0-key")
+ .addEventListener("click", () =>
+ togglePasswordVisibility("mem0-api-key")
+ );
+
+ // Load current configuration and wait for it to complete
+ await loadConfig();
+ } catch (error) {
+ console.error("Initialization error:", error);
+ showStatus("Error initializing popup", "error");
+ }
+}
+
+// Toggle chat visibility in the active tab
+function toggleChat() {
+ chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
+ if (tabs[0]) {
+ // First check if we can inject the content script
+ chrome.scripting
+ .executeScript({
+ target: { tabId: tabs[0].id },
+ files: ["dist/content.bundle.js"],
+ })
+ .then(() => {
+ // Now try to toggle the chat
+ chrome.tabs
+ .sendMessage(tabs[0].id, { action: "toggleChat" })
+ .then((response) => {
+ if (response && response.error) {
+ console.error("Error toggling chat:", response.error);
+ showStatus(
+ "Chat interface not available on this page",
+ "warning"
+ );
+ } else {
+ // Close the popup after successful toggle
+ window.close();
+ }
+ })
+ .catch((error) => {
+ console.error("Error toggling chat:", error);
+ showStatus(
+ "Chat interface not available on this page",
+ "warning"
+ );
+ });
+ })
+ .catch((error) => {
+ console.error("Error injecting content script:", error);
+ showStatus("Cannot inject chat interface on this page", "error");
+ });
+ }
+ });
+}
+
+// Open options page
+function openOptions() {
+ // Send message to background script to handle opening options
+ chrome.runtime.sendMessage({ action: "openOptions" }, (response) => {
+ if (chrome.runtime.lastError) {
+ console.error("Error opening options:", chrome.runtime.lastError);
+
+ // Direct fallback if communication with background script fails
+ try {
+ chrome.tabs.create({ url: chrome.runtime.getURL("options.html") });
+ } catch (err) {
+ console.error("Fallback failed:", err);
+ // Last resort
+ window.open(chrome.runtime.getURL("options.html"), "_blank");
+ }
+ }
+ });
+}
+
+// Toggle password visibility
+function togglePasswordVisibility(inputId) {
+ const input = document.getElementById(inputId);
+ const type = input.type === "password" ? "text" : "password";
+ input.type = type;
+
+ // Update the eye icon
+ const button = input.nextElementSibling;
+ const icon = button.querySelector(".icon");
+ if (type === "text") {
+ icon.innerHTML =
+ '<path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"></path>';
+ } else {
+ icon.innerHTML =
+ '<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle>';
+ }
+}
+
+// Save API key to storage
+async function saveApiKey() {
+ const apiKeyInput = document.getElementById("api-key");
+ const apiKey = apiKeyInput.value.trim();
+
+ // Show loading status
+ showStatus("Saving API key...", "warning");
+
+ try {
+ // Send to background script for validation and saving
+ const response = await chrome.runtime.sendMessage({
+ action: "saveConfig",
+ config: { apiKey },
+ });
+
+ if (response.error) {
+ showStatus(`Error: ${response.error}`, "error");
+ } else {
+ showStatus("API key saved successfully", "success");
+ loadConfig(); // Refresh the UI
+ }
+ } catch (error) {
+ showStatus(`Error: ${error.message}`, "error");
+ }
+}
+
+// Save mem0 API key to storage
+async function saveMem0ApiKey() {
+ const apiKeyInput = document.getElementById("mem0-api-key");
+ const apiKey = apiKeyInput.value.trim();
+
+ // Show loading status
+ showStatus("Saving Mem0 API key...", "warning");
+
+ try {
+ // Send to background script for saving
+ const response = await chrome.runtime.sendMessage({
+ action: "saveConfig",
+ config: { mem0ApiKey: apiKey },
+ });
+
+ if (response.error) {
+ showStatus(`Error: ${response.error}`, "error");
+ } else {
+ showStatus("Mem0 API key saved successfully", "success");
+ loadConfig(); // Refresh the UI
+ }
+ } catch (error) {
+ showStatus(`Error: ${error.message}`, "error");
+ }
+}
+
+// Load configuration from storage
+async function loadConfig() {
+ try {
+ // Add a small delay to ensure background script is ready
+ await new Promise((resolve) => setTimeout(resolve, 100));
+
+ const response = await chrome.runtime.sendMessage({ action: "getConfig" });
+ const config = response.config || {};
+
+ // Update OpenAI API key field
+ const apiKeyInput = document.getElementById("api-key");
+ if (config.apiKey) {
+ apiKeyInput.value = config.apiKey;
+ apiKeyInput.type = "password"; // Ensure it's hidden by default
+ document.getElementById("api-key-section").style.display = "block";
+ } else {
+ apiKeyInput.value = "";
+ document.getElementById("api-key-section").style.display = "block";
+ showStatus("Please set your OpenAI API key", "warning");
+ }
+
+ // Update mem0 API key field
+ const mem0ApiKeyInput = document.getElementById("mem0-api-key");
+ if (config.mem0ApiKey) {
+ mem0ApiKeyInput.value = config.mem0ApiKey;
+ mem0ApiKeyInput.type = "password"; // Ensure it's hidden by default
+ document.getElementById("mem0-api-key-section").style.display = "block";
+ document.getElementById("mem0-status-text").textContent = "Connected";
+ document.getElementById("mem0-status-text").style.color =
+ "var(--success-color)";
+ } else {
+ mem0ApiKeyInput.value = "";
+ document.getElementById("mem0-api-key-section").style.display = "block";
+ document.getElementById("mem0-status-text").textContent =
+ "Not configured";
+ document.getElementById("mem0-status-text").style.color =
+ "var(--warning-color)";
+ }
+ } catch (error) {
+ console.error("Error loading configuration:", error);
+ showStatus(`Error loading configuration: ${error.message}`, "error");
+ }
+}
+
+// Show status message
+function showStatus(message, type = "info") {
+ const statusContainer = document.getElementById("status-container");
+
+ // Clear previous status
+ statusContainer.innerHTML = "";
+
+ // Create status element
+ const statusElement = document.createElement("div");
+ statusElement.className = `status ${type}`;
+ statusElement.textContent = message;
+
+ // Add to container
+ statusContainer.appendChild(statusElement);
+
+ // Auto-clear success messages after 3 seconds
+ if (type === "success") {
+ setTimeout(() => {
+ statusElement.style.opacity = "0";
+ setTimeout(() => {
+ if (statusContainer.contains(statusElement)) {
+ statusContainer.removeChild(statusElement);
+ }
+ }, 300);
+ }, 3000);
+ }
+}
diff --git a/examples/yt-assistant-chrome/styles/content.css b/examples/yt-assistant-chrome/styles/content.css
new file mode 100644
index 000000000..26dfcdfd3
--- /dev/null
+++ b/examples/yt-assistant-chrome/styles/content.css
@@ -0,0 +1,492 @@
+/* Styles for the AI Chat Assistant */
+/* Modern Dark Theme with Blue Accents */
+
+:root {
+ --chat-dark-bg: #1a1a1a;
+ --chat-darker-bg: #121212;
+ --chat-light-text: #f1f1f1;
+ --chat-blue-accent: #3d84f7;
+ --chat-blue-hover: #2d74e7;
+ --chat-blue-light: rgba(61, 132, 247, 0.15);
+ --chat-error: #ff4a4a;
+ --chat-border-radius: 12px;
+ --chat-message-radius: 12px;
+ --chat-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+/* Main container */
+#ai-chat-assistant-container {
+ position: fixed;
+ right: 20px;
+ bottom: 20px;
+ width: 380px;
+ height: 550px;
+ background-color: var(--chat-dark-bg);
+ border-radius: var(--chat-border-radius);
+ box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
+ display: flex;
+ flex-direction: column;
+ z-index: 9999;
+ overflow: hidden;
+ transition: var(--chat-transition);
+ opacity: 0;
+ transform: translateY(20px) scale(0.98);
+ pointer-events: none;
+ font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
+ border: 1px solid rgba(255, 255, 255, 0.08);
+}
+
+/* When visible */
+#ai-chat-assistant-container.visible {
+ opacity: 1;
+ transform: translateY(0) scale(1);
+ pointer-events: all;
+}
+
+/* When minimized */
+#ai-chat-assistant-container.minimized {
+ height: 50px;
+}
+
+#ai-chat-assistant-container.minimized .ai-chat-body {
+ display: none;
+}
+
+/* Header */
+.ai-chat-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 12px 16px;
+ background-color: var(--chat-darker-bg);
+ color: var(--chat-light-text);
+ border-top-left-radius: var(--chat-border-radius);
+ border-top-right-radius: var(--chat-border-radius);
+ cursor: move;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
+}
+
+.ai-chat-title {
+ font-weight: 500;
+ font-size: 15px;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+
+.ai-chat-title::before {
+ content: '';
+ display: inline-block;
+ width: 8px;
+ height: 8px;
+ background-color: var(--chat-blue-accent);
+ border-radius: 50%;
+ box-shadow: 0 0 10px var(--chat-blue-accent);
+}
+
+.ai-chat-controls {
+ display: flex;
+ gap: 8px;
+}
+
+.ai-chat-btn {
+ background: none;
+ border: none;
+ color: var(--chat-light-text);
+ font-size: 18px;
+ cursor: pointer;
+ width: 28px;
+ height: 28px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 50%;
+ transition: var(--chat-transition);
+}
+
+.ai-chat-btn:hover {
+ background-color: rgba(255, 255, 255, 0.08);
+}
+
+/* Body */
+.ai-chat-body {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ overflow: hidden;
+ background-color: var(--chat-dark-bg);
+}
+
+/* Messages container */
+.ai-chat-messages {
+ flex: 1;
+ overflow-y: auto;
+ padding: 15px;
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ scrollbar-width: thin;
+ scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
+}
+
+.ai-chat-messages::-webkit-scrollbar {
+ width: 5px;
+}
+
+.ai-chat-messages::-webkit-scrollbar-track {
+ background: transparent;
+}
+
+.ai-chat-messages::-webkit-scrollbar-thumb {
+ background-color: rgba(255, 255, 255, 0.1);
+ border-radius: 10px;
+}
+
+/* Individual message */
+.ai-chat-message {
+ max-width: 85%;
+ padding: 12px 16px;
+ border-radius: var(--chat-message-radius);
+ line-height: 1.5;
+ position: relative;
+ font-size: 14px;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
+ animation: message-fade-in 0.3s ease;
+ word-break: break-word;
+}
+
+@keyframes message-fade-in {
+ from {
+ opacity: 0;
+ transform: translateY(10px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+/* User message */
+.ai-chat-message.user {
+ align-self: flex-end;
+ background-color: var(--chat-blue-accent);
+ color: white;
+ border-bottom-right-radius: 4px;
+}
+
+/* Assistant message */
+.ai-chat-message.assistant {
+ align-self: flex-start;
+ background-color: rgba(255, 255, 255, 0.08);
+ color: var(--chat-light-text);
+ border-bottom-left-radius: 4px;
+}
+
+/* System message */
+.ai-chat-message.system {
+ align-self: center;
+ background-color: rgba(255, 76, 76, 0.1);
+ color: var(--chat-error);
+ max-width: 90%;
+ font-size: 13px;
+ border-radius: 8px;
+ border: 1px solid rgba(255, 76, 76, 0.2);
+}
+
+/* Loading animation */
+.ai-chat-message.loading {
+ background-color: rgba(255, 255, 255, 0.05);
+ color: rgba(255, 255, 255, 0.7);
+}
+
+.ai-chat-message.loading:after {
+ content: "...";
+ animation: thinking 1.5s infinite;
+}
+
+@keyframes thinking {
+ 0% { content: "."; }
+ 33% { content: ".."; }
+ 66% { content: "..."; }
+}
+
+/* Input area */
+.ai-chat-input-container {
+ display: flex;
+ padding: 12px 16px;
+ border-top: 1px solid rgba(255, 255, 255, 0.05);
+ background-color: var(--chat-darker-bg);
+}
+
+#ai-chat-input {
+ flex: 1;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ background-color: rgba(255, 255, 255, 0.05);
+ color: var(--chat-light-text);
+ border-radius: 20px;
+ padding: 10px 16px;
+ font-size: 14px;
+ resize: none;
+ max-height: 100px;
+ outline: none;
+ font-family: inherit;
+ transition: var(--chat-transition);
+}
+
+#ai-chat-input::placeholder {
+ color: rgba(255, 255, 255, 0.4);
+}
+
+#ai-chat-input:focus {
+ border-color: var(--chat-blue-accent);
+ background-color: rgba(255, 255, 255, 0.07);
+ box-shadow: 0 0 0 1px rgba(61, 132, 247, 0.1);
+}
+
+.ai-chat-send-btn {
+ background: none;
+ border: none;
+ color: var(--chat-blue-accent);
+ cursor: pointer;
+ padding: 8px;
+ margin-left: 8px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 50%;
+ transition: var(--chat-transition);
+}
+
+.ai-chat-send-btn:hover {
+ background-color: var(--chat-blue-light);
+ transform: scale(1.05);
+}
+
+/* Toggle button */
+.ai-chat-toggle {
+ position: fixed;
+ right: 20px;
+ bottom: 20px;
+ width: 56px;
+ height: 56px;
+ border-radius: 50%;
+ background-color: var(--chat-blue-accent);
+ color: white;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ box-shadow: 0 4px 15px rgba(61, 132, 247, 0.35);
+ z-index: 9998;
+ transition: var(--chat-transition);
+ border: none;
+}
+
+.ai-chat-toggle:hover {
+ transform: scale(1.05);
+ box-shadow: 0 6px 20px rgba(61, 132, 247, 0.45);
+}
+
+#ai-chat-assistant-container.visible + .ai-chat-toggle {
+ transform: scale(0);
+ opacity: 0;
+}
+
+/* Code formatting */
+.ai-chat-message pre {
+ background-color: rgba(0, 0, 0, 0.3);
+ padding: 10px;
+ border-radius: 6px;
+ overflow-x: auto;
+ margin: 10px 0;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+}
+
+.ai-chat-message code {
+ font-family: 'Cascadia Code', 'Fira Code', 'Source Code Pro', monospace;
+ font-size: 12px;
+}
+
+.ai-chat-message.user code {
+ background-color: rgba(255, 255, 255, 0.2);
+ padding: 2px 5px;
+ border-radius: 3px;
+}
+
+.ai-chat-message.assistant code {
+ background-color: rgba(0, 0, 0, 0.3);
+ padding: 2px 5px;
+ border-radius: 3px;
+ color: #e2e2e2;
+}
+
+/* Links */
+.ai-chat-message a {
+ color: var(--chat-blue-accent);
+ text-decoration: none;
+ border-bottom: 1px dotted rgba(61, 132, 247, 0.5);
+ transition: var(--chat-transition);
+}
+
+.ai-chat-message a:hover {
+ border-bottom: 1px solid var(--chat-blue-accent);
+}
+
+.ai-chat-message.user a {
+ color: white;
+ border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
+}
+
+.ai-chat-message.user a:hover {
+ border-bottom: 1px solid white;
+}
+
+/* Responsive adjustments */
+@media (max-width: 768px) {
+ #ai-chat-assistant-container {
+ width: calc(100% - 20px);
+ height: 60vh;
+ right: 10px;
+ bottom: 10px;
+ }
+
+ .ai-chat-toggle {
+ right: 10px;
+ bottom: 10px;
+ }
+}
+
+/* Tab styles */
+.ai-chat-tabs {
+ display: flex;
+ gap: 10px;
+ margin-right: 10px;
+}
+
+.ai-chat-tab {
+ background: none;
+ border: none;
+ color: var(--chat-light-text);
+ padding: 5px 10px;
+ cursor: pointer;
+ font-size: 14px;
+ border-radius: 4px;
+ transition: var(--chat-transition);
+}
+
+.ai-chat-tab:hover {
+ background-color: rgba(255, 255, 255, 0.08);
+}
+
+.ai-chat-tab.active {
+ background-color: var(--chat-blue-accent);
+ color: white;
+}
+
+/* Content area */
+.ai-chat-content {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
+
+/* Memories tab styles */
+.ai-chat-memories {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ background-color: var(--chat-dark-bg);
+}
+
+.memories-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 10px;
+ padding-left: 16px;
+ padding-right: 16px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
+}
+
+.memories-title {
+ display: inline;
+ align-items: center;
+ font-size: 14px;
+ color: var(--chat-light-text);
+}
+
+.memories-title a {
+ color: var(--chat-blue-accent);
+ text-decoration: none;
+ font-weight: 500;
+ transition: var(--chat-transition);
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+}
+
+.memories-title a:hover {
+ color: var(--chat-blue-hover);
+ text-decoration: underline;
+}
+
+.memories-title a svg {
+ vertical-align: middle;
+}
+
+.memories-title svg {
+ vertical-align: middle;
+ margin-left: 4px;
+}
+
+.memories-list {
+ flex: 1;
+ overflow-y: auto;
+ padding: 10px;
+ scrollbar-width: thin;
+ scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
+}
+
+.memories-list::-webkit-scrollbar {
+ width: 5px;
+}
+
+.memories-list::-webkit-scrollbar-track {
+ background: transparent;
+}
+
+.memories-list::-webkit-scrollbar-thumb {
+ background-color: rgba(255, 255, 255, 0.1);
+ border-radius: 10px;
+}
+
+.memory-item {
+ background-color: rgba(255, 255, 255, 0.08);
+ border: 1px solid rgba(255, 255, 255, 0.05);
+ border-radius: var(--chat-message-radius);
+ padding: 12px 16px;
+ margin-bottom: 10px;
+ font-size: 14px;
+ line-height: 1.4;
+ color: var(--chat-light-text);
+}
+
+.memory-item:last-child {
+ margin-bottom: 0;
+}
+
+.loading, .no-memories, .error, .info {
+ text-align: center;
+ padding: 20px;
+ font-size: 14px;
+ color: var(--chat-light-text);
+}
+
+.error {
+ color: var(--chat-error);
+ font-size: 14px;
+}
+
+.info {
+ color: var(--chat-blue-accent);
+}
diff --git a/examples/yt-assistant-chrome/styles/options.css b/examples/yt-assistant-chrome/styles/options.css
new file mode 100644
index 000000000..ab94ea68b
--- /dev/null
+++ b/examples/yt-assistant-chrome/styles/options.css
@@ -0,0 +1,587 @@
+:root {
+ --dark-bg: #1a1a1a;
+ --darker-bg: #121212;
+ --section-bg: #202020;
+ --light-text: #f1f1f1;
+ --dim-text: rgba(255, 255, 255, 0.7);
+ --dim-text-2: rgba(255, 255, 255, 0.5);
+ --blue-accent: #3d84f7;
+ --blue-hover: #2d74e7;
+ --blue-light: rgba(61, 132, 247, 0.15);
+ --error-color: #ff4a4a;
+ --warning-color: #ffaa33;
+ --success-color: #4caf50;
+ --border-radius: 8px;
+ --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+body {
+ font-family: "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
+ margin: 0;
+ padding: 20px 20px 40px;
+ color: var(--light-text);
+ background-color: var(--dark-bg);
+ max-width: 1200px;
+ margin: 0 auto;
+}
+
+header {
+ max-width: 800px;
+ padding-left: 28px;
+ padding-top: 10px;
+ color: #f1f1f1;
+}
+
+h1 {
+ font-size: 32px;
+ margin: 0 0 12px 0;
+ font-weight: 500;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.title-container {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+
+.logo-img {
+ height: 20px;
+ width: auto;
+ margin-left: 8px;
+ position: relative;
+ top: 1px;
+}
+
+.powered-by {
+ font-size: 12px;
+ font-weight: normal;
+ color: rgba(255, 255, 255, 0.6);
+ line-height: 1;
+}
+
+.branding-container {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.description {
+ color: var(--dim-text);
+ margin-bottom: 20px;
+ font-size: 15px;
+ line-height: 1.5;
+}
+
+.section {
+ margin-bottom: 30px;
+ background: var(--section-bg);
+ padding: 28px;
+ border-radius: var(--border-radius);
+ border: 1px solid rgba(255, 255, 255, 0.05);
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
+}
+
+h2 {
+ font-size: 18px;
+ margin-top: 0;
+ margin-bottom: 15px;
+ color: var(--light-text);
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+h2::before {
+ content: "";
+ display: inline-block;
+ width: 5px;
+ height: 20px;
+ background-color: var(--blue-accent);
+ border-radius: 3px;
+}
+
+.form-group {
+ margin-bottom: 20px;
+}
+
+label {
+ display: block;
+ margin-bottom: 8px;
+ font-weight: 500;
+ color: var(--light-text);
+}
+
+input[type="text"],
+input[type="password"],
+input[type="number"],
+select {
+ width: 100%;
+ padding: 12px;
+ background-color: rgba(255, 255, 255, 0.05);
+ color: var(--light-text);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: var(--border-radius);
+ font-size: 14px;
+ box-sizing: border-box;
+ transition: var(--transition);
+}
+
+input[type="text"]:focus,
+input[type="password"]:focus,
+input[type="number"]:focus,
+select:focus {
+ border-color: var(--blue-accent);
+ outline: none;
+ box-shadow: 0 0 0 1px rgba(61, 132, 247, 0.2);
+}
+
+select {
+ appearance: none;
+ background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%207l5%205%205-5%22%20stroke%3D%22%23fff%22%20stroke-width%3D%221.5%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");
+ background-repeat: no-repeat;
+ background-position: right 12px center;
+}
+
+input[type="number"] {
+ width: 120px;
+}
+
+input[type="checkbox"] {
+ margin-right: 10px;
+ position: relative;
+ width: 18px;
+ height: 18px;
+ -webkit-appearance: none;
+ appearance: none;
+ background-color: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ border-radius: 4px;
+ cursor: pointer;
+ transition: var(--transition);
+}
+
+input[type="checkbox"]:checked {
+ background-color: var(--blue-accent);
+ border-color: var(--blue-accent);
+}
+
+input[type="checkbox"]:checked::after {
+ content: "";
+ position: absolute;
+ left: 5px;
+ top: 2px;
+ width: 6px;
+ height: 10px;
+ border: solid white;
+ border-width: 0 2px 2px 0;
+ transform: rotate(45deg);
+}
+
+input[type="checkbox"]:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
+.checkbox-label {
+ display: flex;
+ align-items: center;
+ margin-bottom: 12px;
+ font-size: 14px;
+ color: var(--light-text);
+}
+
+.checkbox-label label {
+ margin-bottom: 0;
+ margin-left: 8px;
+}
+
+button {
+ background-color: var(--blue-accent);
+ color: white;
+ border: none;
+ padding: 12px 20px;
+ border-radius: var(--border-radius);
+ cursor: pointer;
+ font-size: 14px;
+ font-weight: 500;
+ transition: var(--transition);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+}
+
+button:hover {
+ background-color: var(--blue-hover);
+ transform: translateY(-1px);
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
+}
+
+button:active {
+ transform: translateY(1px);
+ box-shadow: none;
+}
+
+button:disabled {
+ background-color: rgba(255, 255, 255, 0.1);
+ color: var(--dim-text-2);
+ cursor: not-allowed;
+ transform: none;
+ box-shadow: none;
+}
+
+.status {
+ padding: 15px;
+ border-radius: var(--border-radius);
+ margin-top: 20px;
+ font-size: 14px;
+ animation: fade-in 0.3s ease;
+}
+
+@keyframes fade-in {
+ from {
+ opacity: 0;
+ transform: translateY(-5px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+.status.error {
+ background-color: rgba(255, 74, 74, 0.1);
+ color: var(--error-color);
+ border: 1px solid rgba(255, 74, 74, 0.2);
+}
+
+.status.success {
+ background-color: rgba(76, 175, 80, 0.1);
+ color: var(--success-color);
+ border: 1px solid rgba(76, 175, 80, 0.2);
+}
+
+.status.warning {
+ background-color: rgba(255, 170, 51, 0.1);
+ color: var(--warning-color);
+ border: 1px solid rgba(255, 170, 51, 0.2);
+}
+
+.actions {
+ display: flex;
+ gap: 10px;
+}
+
+.secondary-button {
+ background-color: rgba(255, 255, 255, 0.08);
+ color: var(--light-text);
+}
+
+.secondary-button:hover {
+ background-color: rgba(255, 255, 255, 0.12);
+}
+
+.api-key-container {
+ display: flex;
+ gap: 10px;
+}
+
+.api-key-container input {
+ flex: 1;
+}
+
+/* Slider styles */
+.slider-container {
+ margin-top: 12px;
+ display: flex;
+ align-items: center;
+}
+
+.slider {
+ -webkit-appearance: none;
+ flex: 1;
+ height: 4px;
+ border-radius: 10px;
+ background: rgba(255, 255, 255, 0.1);
+ outline: none;
+}
+
+.slider::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ background: var(--blue-accent);
+ cursor: pointer;
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
+ transition: var(--transition);
+}
+
+.slider::-webkit-slider-thumb:hover {
+ transform: scale(1.1);
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
+}
+
+.slider::-moz-range-thumb {
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ background: var(--blue-accent);
+ cursor: pointer;
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
+ transition: var(--transition);
+ border: none;
+}
+
+.slider::-moz-range-thumb:hover {
+ transform: scale(1.1);
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
+}
+
+/* Add styles for memory creation section */
+.memory-input {
+ width: 100%;
+ min-height: 150px;
+ padding: 12px;
+ background-color: rgba(255, 255, 255, 0.05);
+ color: var(--light-text);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: var(--border-radius);
+ font-size: 14px;
+ box-sizing: border-box;
+ transition: var(--transition);
+ resize: vertical;
+ font-family: inherit;
+}
+
+.memory-input:focus {
+ border-color: var(--blue-accent);
+ outline: none;
+ box-shadow: 0 0 0 1px rgba(61, 132, 247, 0.2);
+}
+
+.memory-result {
+ margin-top: 15px;
+ padding: 12px;
+ border-radius: var(--border-radius);
+ font-size: 14px;
+ display: none;
+}
+
+.memory-result.success {
+ background-color: rgba(76, 175, 80, 0.1);
+ color: var(--success-color);
+ border: 1px solid rgba(76, 175, 80, 0.2);
+ display: block;
+}
+
+.memory-result.error {
+ background-color: rgba(255, 74, 74, 0.1);
+ color: var(--error-color);
+ border: 1px solid rgba(255, 74, 74, 0.2);
+ display: block;
+}
+
+.loading-spinner {
+ display: inline-block;
+ width: 20px;
+ height: 20px;
+ border: 2px solid rgba(255, 255, 255, 0.3);
+ border-radius: 50%;
+ border-top-color: var(--light-text);
+ animation: spin 1s linear infinite;
+ margin-right: 8px;
+}
+
+@keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+}
+
+/* Add new styles for the memories sidebar */
+.memories-sidebar {
+ position: fixed;
+ top: 0;
+ right: 0;
+ width: 384px;
+ height: 100vh;
+ background: var(--section-bg);
+ border-left: 1px solid rgba(255, 255, 255, 0.05);
+ transition: transform 0.3s ease;
+ z-index: 1000;
+ display: flex;
+ flex-direction: column;
+}
+
+.memories-sidebar.collapsed {
+ transform: translateX(384px);
+}
+
+.memories-header {
+ padding: 16px;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.memories-title {
+ font-size: 16px;
+ font-weight: 500;
+ color: var(--light-text);
+}
+
+.memories-actions {
+ display: flex;
+ gap: 8px;
+}
+
+.memories-list {
+ flex: 1;
+ overflow-y: auto;
+ padding: 16px;
+}
+
+.memory-item {
+ padding: 12px;
+ border: 1px solid rgba(255, 255, 255, 0.05);
+ border-radius: var(--border-radius);
+ margin-bottom: 12px;
+ cursor: pointer;
+ transition: var(--transition);
+}
+
+.memory-item:hover {
+ background: rgba(255, 255, 255, 0.05);
+}
+
+.memory-content {
+ font-size: 14px;
+ color: var(--light-text);
+ margin-bottom: 8px;
+ text-align: center;
+ text-wrap-style: pretty;
+}
+
+.memory-item .memory-content {
+ text-align: left;
+}
+
+.memory-meta {
+ font-size: 12px;
+ color: var(--dim-text);
+}
+
+.memory-actions {
+ display: flex;
+ gap: 8px;
+ margin-top: 8px;
+}
+
+.memory-action-btn {
+ padding: 8px;
+ font-size: 12px;
+ border-radius: 6px;
+ background: rgba(255, 255, 255, 0.05);
+ color: var(--light-text);
+ border: none;
+ cursor: pointer;
+ transition: var(--transition);
+}
+
+.memory-action-btn:hover {
+ background: rgba(255, 255, 255, 0.1);
+}
+
+.memory-action-btn.delete:hover {
+ background-color: var(--error-color);
+}
+
+.edit-memory-modal {
+ display: none;
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.5);
+ z-index: 1100;
+ align-items: center;
+ justify-content: center;
+}
+
+.edit-memory-modal.open {
+ display: flex;
+}
+
+.edit-memory-content {
+ display: flex;
+ flex-direction: column;
+ background: var(--section-bg);
+ padding: 24px;
+ border-radius: var(--border-radius);
+ width: 90%;
+ max-width: 600px;
+ max-height: 80vh;
+ overflow-y: auto;
+}
+
+.edit-memory-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.edit-memory-title {
+ font-size: 18px;
+ font-weight: 500;
+ color: var(--light-text);
+}
+
+.edit-memory-close {
+ background: none;
+ border: none;
+ color: var(--dim-text);
+ cursor: pointer;
+ padding: 4px;
+ font-size: 20px;
+ width: 30px;
+}
+
+.edit-memory-textarea {
+ min-height: 20px;
+ max-height: 70px;
+ padding: 12px;
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: var(--border-radius);
+ color: var(--light-text);
+ font-family: inherit;
+ margin-bottom: 16px;
+ resize: vertical;
+}
+
+.edit-memory-actions {
+ display: flex;
+ justify-content: flex-end;
+ gap: 8px;
+}
+
+.main-content {
+ margin-right: 400px;
+ transition: margin-right 0.3s ease;
+ max-width: 800px;
+}
+
+.main-content.sidebar-collapsed {
+ margin-right: 0;
+}
+
+#status-container {
+ margin-bottom: 12px;
+}
diff --git a/examples/yt-assistant-chrome/styles/popup.css b/examples/yt-assistant-chrome/styles/popup.css
new file mode 100644
index 000000000..2f3fc6967
--- /dev/null
+++ b/examples/yt-assistant-chrome/styles/popup.css
@@ -0,0 +1,259 @@
+:root {
+ --dark-bg: #1a1a1a;
+ --darker-bg: #121212;
+ --light-text: #f1f1f1;
+ --blue-accent: #3d84f7;
+ --blue-hover: #2d74e7;
+ --blue-light: rgba(61, 132, 247, 0.15);
+ --error-color: #ff4a4a;
+ --warning-color: #ffaa33;
+ --success-color: #4caf50;
+ --border-radius: 8px;
+ --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+body {
+ font-family: "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
+ width: 320px;
+ margin: 0;
+ padding: 0;
+ color: var(--light-text);
+ background-color: var(--dark-bg);
+}
+
+header {
+ background-color: var(--darker-bg);
+ color: var(--light-text);
+ padding: 16px;
+ text-align: center;
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
+}
+
+h1 {
+ font-size: 18px;
+ margin: 0 0 8px 0;
+ font-weight: 500;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.logo-img {
+ height: 16px;
+ width: auto;
+ margin-left: 8px;
+ position: relative;
+ top: 1px;
+}
+
+.powered-by {
+ font-size: 12px;
+ font-weight: normal;
+ color: rgba(255, 255, 255, 0.6);
+ line-height: 1;
+}
+
+.branding-container {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ margin-top: 4px;
+}
+
+.content {
+ padding: 16px;
+}
+
+.status {
+ padding: 12px;
+ border-radius: var(--border-radius);
+ margin-bottom: 16px;
+ font-size: 14px;
+ animation: fade-in 0.3s ease;
+}
+
+@keyframes fade-in {
+ from {
+ opacity: 0;
+ transform: translateY(-5px);
+ }
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+.status.error {
+ background-color: rgba(255, 74, 74, 0.1);
+ color: var(--error-color);
+ border: 1px solid rgba(255, 74, 74, 0.2);
+}
+
+.status.success {
+ background-color: rgba(76, 175, 80, 0.1);
+ color: var(--success-color);
+ border: 1px solid rgba(76, 175, 80, 0.2);
+}
+
+.status.warning {
+ background-color: rgba(255, 170, 51, 0.1);
+ color: var(--warning-color);
+ border: 1px solid rgba(255, 170, 51, 0.2);
+}
+
+button {
+ background-color: var(--blue-accent);
+ color: white;
+ border: none;
+ padding: 12px 16px;
+ border-radius: 6px;
+ cursor: pointer;
+ width: 100%;
+ font-size: 14px;
+ font-weight: 500;
+ transition: var(--transition);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+}
+
+button:hover {
+ background-color: var(--blue-hover);
+ transform: translateY(-1px);
+}
+
+button:active {
+ transform: translateY(1px);
+}
+
+button:disabled {
+ background-color: rgba(255, 255, 255, 0.1);
+ color: rgba(255, 255, 255, 0.4);
+ cursor: not-allowed;
+ transform: none;
+}
+
+.actions {
+ display: flex;
+ flex-direction: row;
+ gap: 12px;
+}
+
+.api-key-section {
+ margin-bottom: 20px;
+ position: relative;
+}
+
+.api-key-input-wrapper {
+ position: relative;
+ display: flex;
+ align-items: center;
+}
+
+.toggle-password {
+ position: absolute;
+ right: 12px;
+ top: 50%;
+ transform: translateY(-50%);
+ background: none;
+ border: none;
+ padding: 4px;
+ cursor: pointer;
+ color: rgba(255, 255, 255, 0.5);
+ width: auto;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.toggle-password:hover {
+ color: rgba(255, 255, 255, 0.8);
+ background: none;
+ transform: translateY(-50%);
+}
+
+.toggle-password .icon {
+ width: 16px;
+ height: 16px;
+}
+
+input[type="text"],
+input[type="password"] {
+ width: 100%;
+ padding: 12px;
+ padding-right: 40px;
+ background-color: rgba(255, 255, 255, 0.05);
+ color: var(--light-text);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: var(--border-radius);
+ margin-top: 6px;
+ box-sizing: border-box;
+ transition: var(--transition);
+ font-size: 14px;
+}
+
+input[type="text"]:focus,
+input[type="password"]:focus {
+ border-color: var(--blue-accent);
+ outline: none;
+ box-shadow: 0 0 0 1px rgba(61, 132, 247, 0.2);
+}
+
+input::placeholder {
+ color: rgba(255, 255, 255, 0.3);
+}
+
+label {
+ font-size: 14px;
+ font-weight: 500;
+ color: rgba(255, 255, 255, 0.9);
+ display: block;
+ margin-bottom: 4px;
+}
+
+.save-button {
+ margin-top: 10px;
+}
+
+.mem0-status {
+ margin-top: 20px;
+ padding: 12px;
+ background-color: rgba(255, 255, 255, 0.03);
+ border-radius: var(--border-radius);
+ font-size: 13px;
+ color: rgba(255, 255, 255, 0.7);
+}
+
+.mem0-status p {
+ margin: 0;
+}
+
+#mem0-status-text {
+ color: var(--blue-accent);
+ font-weight: 500;
+}
+
+/* Icons */
+.icon {
+ display: inline-block;
+ width: 18px;
+ height: 18px;
+ fill: currentColor;
+}
+
+.get-key-link {
+ color: var(--blue-accent);
+ text-decoration: none;
+ font-size: 13px;
+ transition: color 0.2s ease;
+}
+
+.get-key-link:hover {
+ color: var(--blue-accent-hover);
+ text-decoration: underline;
+}
+
+.get-key-link:visited {
+ color: var(--blue-accent);
+}
diff --git a/examples/yt-assistant-chrome/webpack.config.js b/examples/yt-assistant-chrome/webpack.config.js
new file mode 100644
index 000000000..3e8cf1b74
--- /dev/null
+++ b/examples/yt-assistant-chrome/webpack.config.js
@@ -0,0 +1,40 @@
+const path = require('path');
+
+module.exports = {
+ mode: 'production',
+ entry: {
+ content: './src/content.js',
+ options: './src/options.js',
+ popup: './src/popup.js',
+ background: './src/background.js'
+ },
+ output: {
+ filename: '[name].bundle.js',
+ path: path.resolve(__dirname, 'dist')
+ },
+ devtool: 'source-map',
+ optimization: {
+ minimize: false
+ },
+ module: {
+ rules: [
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ use: {
+ loader: 'babel-loader',
+ options: {
+ presets: ['@babel/preset-env']
+ }
+ }
+ },
+ {
+ test: /\.css$/,
+ use: ['style-loader', 'css-loader']
+ }
+ ]
+ },
+ resolve: {
+ extensions: ['.js']
+ }
+};
\ No newline at end of file