Action
Ask ChatGPT
UPDATES
6 months ago
Default to new “gpt-4o” model
6 months ago
Default to new “gpt-4o” model
9 months ago
Add options to select model.
Prompt for input to send to ChatGPT, and insert the response to the prompt in the current draft. If there is a text selection in the editor, it will be used as the default prompt text.
Defaults to using the gpt-3.5-turbo
model, but provides option to select gpt-4
.
For more information on using this action, visit our OpenAI integration guide
Steps
-
script
// change variable to alter model used const models = [ "gpt-4o", "gpt-3.5-turbo" ] const initialText = editor.getSelectedText() let f = () => { let p = new Prompt() p.title = "Ask ChatGPT" p.message = "Type your prompt for ChatGPT, 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 } let ai = new OpenAI() ai.model = p.fieldValues["model"] let answer = ai.quickChatResponse(chatPrompt) 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.