Action
Ask Gemini
Posted by agiletortoise,
Last update
25 days ago
UPDATES
25 days ago
Use dynamic model list
25 days ago
Use dynamic model list
about 1 year ago
Added newer model options
Ask for a prompt to send to Google Gemini, inserting the result text in the editor.
For more information and examples incorporating Google Gemini, visit the integration guide
Steps
-
script
// change variable to alter model used let ai = new GoogleAI() const response = ai.getModels() const models = response.responseData["models"].map(m => m["name"]) const initialText = editor.getSelectedText() let f = () => { let p = new Prompt() p.title = "Ask Google Gemini" p.message = "Type your prompt for Gemini, and continue. The response will be inserted in the current draft." p.addTextView("prompt", "Prompt", initialText) p.addSelect("model", "Model", models, [models[0]], false) p.addButton("Ask") if (!p.show()) { return false } const chatPrompt = p.fieldValues["prompt"] if (chatPrompt.length == 0) { return false } const model = p.fieldValues["model"][0] let answer = ai.quickPrompt(chatPrompt, model) if (!answer || answer.length == 0) { answer = "No reply received" } let content = `${chatPrompt} === ${answer} === ` editor.setSelectedText(content) return true } if (!f()) { context.cancel() }
Options
-
After Success Default Notification Info Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.