diff --git a/extensions/raycast-gemini/CHANGELOG.md b/extensions/raycast-gemini/CHANGELOG.md index 93bedf333f0..a87bf9477ec 100644 --- a/extensions/raycast-gemini/CHANGELOG.md +++ b/extensions/raycast-gemini/CHANGELOG.md @@ -1,5 +1,13 @@ # Google Gemini Changelog +## [Gemini Flash 2.0 and More Customization] - 2025-01-02 + +Features: + +- ๐Ÿ†• Add new Models for Gemini 2.0 Flash Experimental, Gemini Experimental 1206, Gemini 2.0 Flash Thinking Experimental and LearnLM 1.5 Pro Experimental +- ๐Ÿงน Allow prompts to be customizable in Raycast Settings +- ๐Ÿ—ฏ๏ธ Add ability to add a default Translate language, and also ability to override with a parameter + ## [Add Translate Command] - 2024-09-02 More Features: diff --git a/extensions/raycast-gemini/package.json b/extensions/raycast-gemini/package.json index b0e0efec5dc..8ccce6b7710 100644 --- a/extensions/raycast-gemini/package.json +++ b/extensions/raycast-gemini/package.json @@ -6,7 +6,8 @@ "icon": "gemini-icon.png", "author": "EvanZhouDev", "contributors": [ - "ridemountainpig" + "ridemountainpig", + "d0zingcat" ], "categories": [ "Productivity", @@ -49,8 +50,32 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "You may be given a text or a query or a picture as input, please provide a detailed and informative response." } ] }, @@ -97,8 +122,32 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } - ] + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Please analyze this screenshot and describe what you see. Include any relevant details about the content, layout, and any text or important elements visible in the image." } ] }, @@ -137,8 +186,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Given the selected text or my query, please provide a detailed and informative response." } ] }, @@ -168,8 +242,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Summarize the given text." } ] }, @@ -199,8 +298,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Explain the following text as best as you can." } ] }, @@ -230,8 +354,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Add comments to the given code. ONLY return the commented code and nothing else." } ] }, @@ -261,8 +410,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Make the following text seem more friendly. ONLY return the modified text and nothing else." } ] }, @@ -292,8 +466,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "In the following text, change it to use advanced vocabulary but do not overuse it. Make sure to use proper grammar and spell check thoroughly. Show expertise in the subject provided, but do not add any extra information. Try to keep your response at the same length of words as the original. ONLY return the modified text and nothing else." } ] }, @@ -323,8 +522,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Find one synonym for the given word. Only return that the synonym, and add nothing else. Keep the casing of the word the same. Your response should only have ONE WORD" } ] }, @@ -354,8 +578,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Fix the grammar in the following text. Try to keep all of the words from the given text and try to only add punctuation and correct any spelling errors. ONLY return the modified text and nothing else." } ] }, @@ -385,8 +634,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Make the following text longer without providing any extra information than what's given. ONLY return the elongated text and nothing else." } ] }, @@ -416,8 +690,33 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Make the following text shorter while keeping the core idea. ONLY return the shortened text and nothing else." } ] }, @@ -432,7 +731,7 @@ "name": "TranslateLanguage", "placeholder": "Translate Language", "type": "text", - "required": true + "required": false } ], "preferences": [ @@ -455,8 +754,41 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } + ] + }, + { + "name": "prompt", + "title": "System Prompt", + "description": "The prompt to use for this command.", + "type": "textfield", + "required": false, + "default": "Translate the following text to {targetLanguage}. Try to keep all of the words from the given text and maintain the original meaning as closely as possible. ONLY return the translated text and nothing else." + }, + { + "name": "defaultTargetLanguage", + "title": "Default Target Language", + "description": "The default target language to use for this command.", + "type": "textfield", + "required": false, + "default": "en" } ] } @@ -484,6 +816,22 @@ { "title": "Gemini 1.5 Flash", "value": "gemini-1.5-flash-latest" + }, + { + "title": "Gemini 2.0 Flash Experimental", + "value": "gemini-2.0-flash-exp" + }, + { + "title": "Gemini Experimental 1206", + "value": "gemini-exp-1206" + }, + { + "title": "Gemini 2.0 Flash Thinking Experimental", + "value": "gemini-2.0-flash-thinking-exp-1219" + }, + { + "title": "LearnLM 1.5 Pro Experimental", + "value": "learnlm-1.5-pro-experimental" } ] } diff --git a/extensions/raycast-gemini/src/aiChat.jsx b/extensions/raycast-gemini/src/aiChat.jsx index 02806cade39..e6f42a20d85 100644 --- a/extensions/raycast-gemini/src/aiChat.jsx +++ b/extensions/raycast-gemini/src/aiChat.jsx @@ -86,6 +86,13 @@ export default function Chat({ launchContext }) { + + + + ); diff --git a/extensions/raycast-gemini/src/api/gemini.jsx b/extensions/raycast-gemini/src/api/gemini.jsx index b5300a95943..3469fa2e99f 100644 --- a/extensions/raycast-gemini/src/api/gemini.jsx +++ b/extensions/raycast-gemini/src/api/gemini.jsx @@ -89,16 +89,14 @@ export default (props, { context = undefined, allowPaste = false, useSelected = useEffect(() => { (async () => { - if (context || useSelected) { + if (useSelected) { try { let selected = await getSelectedText(); - if (useSelected) { - if (argQuery === "") { - setSelected(selected); - setPage(Pages.Form); - } else { - getResponse(`${argQuery}\n${selected}`); - } + if (argQuery === "") { + setSelected(selected); + setPage(Pages.Form); + } else { + getResponse(`${context}\n${argQuery}\n${selected}`); return; } getResponse(`${context}\n${selected}`); diff --git a/extensions/raycast-gemini/src/askAI.jsx b/extensions/raycast-gemini/src/askAI.jsx index d9d92b479b2..519e809c63c 100644 --- a/extensions/raycast-gemini/src/askAI.jsx +++ b/extensions/raycast-gemini/src/askAI.jsx @@ -1,9 +1,18 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function AskAI(props) { + const { prompt } = getPreferenceValues(); if (props?.launchContext?.buffer) { - return useGemini({ ...props, arguments: props?.launchContext?.args }, { buffer: props?.launchContext?.buffer }); + return useGemini( + { ...props, arguments: props?.launchContext?.args }, + { + buffer: props?.launchContext?.buffer, + context: props?.launchContext?.context, + useSelected: props?.launchContext?.useSelected, + } + ); } else { - return useGemini(props, {}); + return useGemini(props, { context: prompt }); } } diff --git a/extensions/raycast-gemini/src/askAboutScreen.jsx b/extensions/raycast-gemini/src/askAboutScreen.jsx index 0b2d6d98759..f60b01ed80f 100644 --- a/extensions/raycast-gemini/src/askAboutScreen.jsx +++ b/extensions/raycast-gemini/src/askAboutScreen.jsx @@ -2,9 +2,10 @@ import { environment, closeMainWindow, launchCommand, LaunchType } from "@raycas import util from "util"; import { exec } from "child_process"; import fs from "fs"; -import jimp from "jimp"; +import { getPreferenceValues } from "@raycast/api"; export default async function AskAboutScreenContent(props) { + const { prompt } = getPreferenceValues(); await closeMainWindow(); const execPromise = util.promisify(exec); @@ -19,6 +20,7 @@ export default async function AskAboutScreenContent(props) { context: { buffer: [fs.readFileSync(`${environment.assetsPath}/desktopScreenshot.png`)], args: props.arguments, + context: prompt, }, }); } diff --git a/extensions/raycast-gemini/src/askAboutSelectedText.jsx b/extensions/raycast-gemini/src/askAboutSelectedText.jsx index d4a280b2e5a..1ec74a8af24 100644 --- a/extensions/raycast-gemini/src/askAboutSelectedText.jsx +++ b/extensions/raycast-gemini/src/askAboutSelectedText.jsx @@ -1,5 +1,7 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function AskAI(props) { - return useGemini(props, { allowPaste: true, useSelected: true }); + const { prompt } = getPreferenceValues(); + return useGemini(props, { context: prompt, allowPaste: true, useSelected: true }); } diff --git a/extensions/raycast-gemini/src/comment.jsx b/extensions/raycast-gemini/src/comment.jsx index fb9d7e6f169..808b1b3b1ab 100644 --- a/extensions/raycast-gemini/src/comment.jsx +++ b/extensions/raycast-gemini/src/comment.jsx @@ -1,8 +1,11 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Comment(props) { + const { prompt } = getPreferenceValues(); return useGemini(props, { - context: "Add comments to the given code. ONLY return the commented code and nothing else.", + context: prompt, allowPaste: true, + useSelected: true, }); } diff --git a/extensions/raycast-gemini/src/explain.jsx b/extensions/raycast-gemini/src/explain.jsx index 9fd62d061f4..6fbee15c5b4 100644 --- a/extensions/raycast-gemini/src/explain.jsx +++ b/extensions/raycast-gemini/src/explain.jsx @@ -1,5 +1,7 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Explain(props) { - return useGemini(props, { context: "Explain the following text as best as you can." }); + const { prompt } = getPreferenceValues(); + return useGemini(props, { context: prompt, useSelected: true }); } diff --git a/extensions/raycast-gemini/src/friendly.jsx b/extensions/raycast-gemini/src/friendly.jsx index 7c96dd41709..fd5dcf30ec9 100644 --- a/extensions/raycast-gemini/src/friendly.jsx +++ b/extensions/raycast-gemini/src/friendly.jsx @@ -1,8 +1,11 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Friendly(props) { + const { prompt } = getPreferenceValues(); return useGemini(props, { - context: "Make the following text seem more friendly. ONLY return the modified text and nothing else.", + context: prompt, allowPaste: true, + useSelected: true, }); } diff --git a/extensions/raycast-gemini/src/grammar.jsx b/extensions/raycast-gemini/src/grammar.jsx index 8ee4b6e542e..0402b4e7ab4 100644 --- a/extensions/raycast-gemini/src/grammar.jsx +++ b/extensions/raycast-gemini/src/grammar.jsx @@ -1,9 +1,11 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Grammar(props) { + const { prompt } = getPreferenceValues(); return useGemini(props, { - context: - "Fix the grammar in the following text. Try to keep all of the words from the given text and try to only add punctuation and correct any spelling errors. ONLY return the modified text and nothing else.", + context: prompt, allowPaste: true, + useSelected: true, }); } diff --git a/extensions/raycast-gemini/src/longer.jsx b/extensions/raycast-gemini/src/longer.jsx index 7b11b30f662..21c0ff535db 100644 --- a/extensions/raycast-gemini/src/longer.jsx +++ b/extensions/raycast-gemini/src/longer.jsx @@ -1,9 +1,11 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Longer(props) { + const { prompt } = getPreferenceValues(); return useGemini(props, { - context: - "Make the following text longer without providing any extra information than what's given. ONLY return the elongated text and nothing else.", + context: prompt, allowPaste: true, + useSelected: true, }); } diff --git a/extensions/raycast-gemini/src/professional.jsx b/extensions/raycast-gemini/src/professional.jsx index 5ea0afc5572..293b7156350 100644 --- a/extensions/raycast-gemini/src/professional.jsx +++ b/extensions/raycast-gemini/src/professional.jsx @@ -1,9 +1,11 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Professional(props) { + const { prompt } = getPreferenceValues(); return useGemini(props, { - context: - "In the following text, change it to use advanced vocabulary but do not overuse it. Make sure to use proper grammar and spell check thoroughly. Show expertise in the subject provided, but do not add any extra information. Try to keep your response at the same length of words as the original. ONLY return the modified text and nothing else.", + context: prompt, allowPaste: true, + useSelected: true, }); } diff --git a/extensions/raycast-gemini/src/shorter.jsx b/extensions/raycast-gemini/src/shorter.jsx index 09b3102f24b..726d342606e 100644 --- a/extensions/raycast-gemini/src/shorter.jsx +++ b/extensions/raycast-gemini/src/shorter.jsx @@ -1,9 +1,11 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Shorter(props) { + const { prompt } = getPreferenceValues(); return useGemini(props, { - context: - "Make the following text shorter while keeping the core idea. ONLY return the shortened text and nothing else.", + context: prompt, allowPaste: true, + useSelected: true, }); } diff --git a/extensions/raycast-gemini/src/summarize.jsx b/extensions/raycast-gemini/src/summarize.jsx index 9e8f4d475c9..10a18fd6856 100644 --- a/extensions/raycast-gemini/src/summarize.jsx +++ b/extensions/raycast-gemini/src/summarize.jsx @@ -1,5 +1,7 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Summarize(props) { - return useGemini(props, { context: "Summarize the given text." }); + const { prompt } = getPreferenceValues(); + return useGemini(props, { context: prompt, useSelected: true }); } diff --git a/extensions/raycast-gemini/src/synonym.jsx b/extensions/raycast-gemini/src/synonym.jsx index b1a350febba..5add8ec34d7 100644 --- a/extensions/raycast-gemini/src/synonym.jsx +++ b/extensions/raycast-gemini/src/synonym.jsx @@ -1,9 +1,11 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function FindSynonym(props) { + const { prompt } = getPreferenceValues(); return useGemini(props, { - context: - "Find one synonym for the given word. Only return that the synonym, and add nothing else. Keep the casing of the word the same. Your response should only have ONE WORD", + context: prompt, allowPaste: true, + useSelected: true, }); } diff --git a/extensions/raycast-gemini/src/translate.jsx b/extensions/raycast-gemini/src/translate.jsx index 12271bd99dd..88887a10df8 100644 --- a/extensions/raycast-gemini/src/translate.jsx +++ b/extensions/raycast-gemini/src/translate.jsx @@ -1,8 +1,16 @@ import useGemini from "./api/gemini"; +import { getPreferenceValues } from "@raycast/api"; export default function Translate(props) { + // we allow user to override the prompt of translation + const { TranslateLanguage } = props["arguments"]; + let { prompt, defaultTargetLanguage } = getPreferenceValues(); + const targetLanguage = TranslateLanguage || defaultTargetLanguage; + prompt = prompt.replace("{targetLanguage}", targetLanguage); + return useGemini(props, { - context: `Translate the following text to ${props["arguments"]["TranslateLanguage"]}. Try to keep all of the words from the given text and maintain the original meaning as closely as possible. ONLY return the translated text and nothing else.`, + context: prompt, allowPaste: true, + useSelected: true, }); }