Skip to content

Commit 016fdde

Browse files
committed
feat: support gemini
1 parent a57d818 commit 016fdde

File tree

7 files changed

+59
-5
lines changed

7 files changed

+59
-5
lines changed

apps/chrome-extension/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
The LLM Prompt Templates Chrome Extension is a powerful tool that offers quick access to a collection of reusable prompt templates for various LLMs. With this extension installed, you can easily insert effective and relevant prompts with just a few clicks.
44

5-
| LLM | Status |
6-
| ----------------------------------- | -------- |
7-
| [ChatGPT](https://chat.openai.com/) | 🎉 Done |
8-
| [Bard](https://bard.google.com/) | 🎉 Done |
9-
| Bing | 📝 To-do |
5+
| LLM | Status |
6+
| ------------------------------------------- | -------- |
7+
| [ChatGPT](https://chat.openai.com/) | 🎉 Done |
8+
| [Gemini (Bard)](https://gemini.google.com/) | 🎉 Done |
9+
| Bing | 📝 To-do |
1010

1111
## Installation
1212

apps/chrome-extension/src/manifest.json

+11
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@
2323
"css": ["bard.content.styles.css"],
2424
"run_at": "document_end"
2525
},
26+
{
27+
"matches": ["https://gemini.google.com/*"],
28+
"js": ["geminiContentScript.bundle.js"],
29+
"css": ["gemini.content.styles.css"],
30+
"run_at": "document_end"
31+
},
2632
{
2733
"matches": ["<all_urls>"],
2834
"exclude_matches": [
2935
"https://chat.openai.com/*",
3036
"https://bard.google.com/*",
37+
"https://gemini.google.com/*",
3138
"https://chatgpt.com/*"
3239
],
3340
"js": ["defaultContentScript.bundle.js"]
@@ -49,6 +56,10 @@
4956
{
5057
"resources": ["bard.content.styles.css"],
5158
"matches": ["https://bard.google.com/*"]
59+
},
60+
{
61+
"resources": ["gemini.content.styles.css"],
62+
"matches": ["https://gemini.google.com/*"]
5263
}
5364
],
5465
"permissions": ["storage"]

apps/chrome-extension/src/pages/Content/llms/gemini/.gitkeep

Whitespace-only changes.

apps/chrome-extension/src/pages/Content/llms/gemini/gemini.content.styles.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { IPrompt } from '@rpidanny/llm-prompt-templates';
2+
3+
import { LLMDom } from '../llm.dom';
4+
5+
export class GeminiDom extends LLMDom {
6+
protected name = 'Gemini';
7+
protected textAreaSelector = 'rich-textarea > .ql-editor';
8+
9+
protected usePrompt(prompt: IPrompt) {
10+
const textArea = this.getTextArea();
11+
console.log('Setting text', prompt.content);
12+
textArea.focus();
13+
textArea.textContent = prompt.content;
14+
textArea.style.height = textArea.scrollHeight + 'px';
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { GeminiDom } from './gemini.dom';
2+
3+
function init() {
4+
const geminiDom = new GeminiDom();
5+
6+
setTimeout(geminiDom.init, 1000);
7+
}
8+
9+
init();

apps/chrome-extension/webpack.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ module.exports = composePlugins(withNx(), withReact(), (config) => {
5555
'bard',
5656
'index.ts'
5757
),
58+
geminiContentScript: path.join(
59+
config.context,
60+
'src',
61+
'pages',
62+
'Content',
63+
'llms',
64+
'gemini',
65+
'index.ts'
66+
),
5867
defaultContentScript: path.join(
5968
config.context,
6069
'src',
@@ -198,6 +207,15 @@ module.exports = composePlugins(withNx(), withReact(), (config) => {
198207
},
199208
],
200209
}),
210+
new CopyWebpackPlugin({
211+
patterns: [
212+
{
213+
from: 'src/pages/Content/llms/gemini/gemini.content.styles.css',
214+
to: path.join(config.output.path),
215+
force: true,
216+
},
217+
],
218+
}),
201219
new HtmlWebpackPlugin({
202220
template: path.join(
203221
config.context,

0 commit comments

Comments
 (0)