Action
Ask ChatGPT
Posted by agiletortoise,
Last update
27 days ago
Prompt for input to send to ChatGPT, and insert the response to the prompt in the current draft.
For more information on using this action, visit our OpenAI integration guide
Steps
-
script
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", "ChatGPT Prompt", "") p.addButton("Ask") if (!p.show()) { return false } const chatPrompt = p.fieldValues["prompt"] if (chatPrompt.length == 0) { return false } let ai = new OpenAI() 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.