Posted by agiletortoise, Last update 2 months ago


2 months ago

Update model options for Perplexity changes.

Prompt for input to send to, and insert the response to the prompt in the current draft.

This version includes options to select preferred model from a list of some of the available models. See docs for other supported models.

For more information on using this action, visit our OpenAI integration guide


  • script

    // setup Perplexity options
    const models = [
    const host = ""
    const initialText = editor.getSelectedText()
    let f = () => {
    	let p = new Prompt()
    	p.title = "Ask"
    	p.message = "Type your prompt for Perplexity, and continue. The response will be inserted in the current draft."
    	p.addTextView("prompt", "Prompt", initialText)
    	p.addSelect("model", "Model", models, [models[0]], false)
    	if (! {
    		return false
    	const chatPrompt = p.fieldValues["prompt"]
    	if (chatPrompt.length == 0) { return false }
    	let ai = OpenAI.create(null, host)
    	ai.model = p.fieldValues["model"][0]
    	ai.credentialIdentifier = ""
    	let answer = ai.quickChatResponse(chatPrompt)
    	if (!answer || answer.length == 0) {
    		answer = "No reply received"
    	let content = `${chatPrompt}
    	return true
    if (!f()) {


  • 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.