Action
Ask DeepSeek
Posted by agiletortoise,
Last update
about 2 months ago
- Unlisted
Prompt for input to send to DeepSeek, 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
Steps
-
script
// setup DeepSeek options const models = [ "deepseek-chat", "deepseek-reasoner" ] const host = "https://api.deepseek.com" const initialText = editor.getSelectedText() let f = () => { let p = new Prompt() p.title = "Ask DeepSeek" p.message = "Type your prompt for DeepSeek, 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 = OpenAI.create(null, host) ai.model = p.fieldValues["model"][0] ai.credentialIdentifier = "DeepSeek" 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.