Details
Type: Slash Command
DBM Version: 2.1.7
Visibility: Public
Required Mods: Yes
Description
Rawdata for ChatGPT API
Replace PASTE YOUR OPENAI KEY HERE with your Open AI token in Line 1 of Action 1. You can get your token from https://platform.openai.com/account/api-keys :)
Raw Data (JSON)
JSON Data
{
"name": "chatgpt",
"permissions": "NONE",
"permissions2": "NONE",
"restriction": "1",
"_id": "xSnsC",
"actions": [
{
"behavior": "1",
"interpretation": "0",
"code": "const OPENAI_KEY = 'PASTE YOUR OPENAI KEY HERE'\nconst fetch = require('node-fetch')\nfetch('https://api.openai.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: 'Bearer ' + OPENAI_KEY\n },\n body: JSON.stringify({\n model: 'gpt-3.5-turbo',\n messages: [\n {\n role: 'system',\n content: 'You are ChatGPT a very helpful assistant.'\n },\n {\n role: 'user',\n content: slashParams(\"prompt\")\n }\n ]\n })\n}).then(body => body.json()).then(body => {\n Actions.storeValue(body, 1, \"result\", cache);\n Actions.callNextAction(cache);\n})",
"storage": "0",
"varName": "",
"name": "Run Script"
},
{
"channel": "0",
"varName": "",
"message": "${tempVars(\"result\").choices[0].message.content}",
"buttons": [],
"selectMenus": [],
"attachments": [],
"embeds": [],
"reply": true,
"ephemeral": false,
"tts": false,
"overwrite": false,
"dontSend": false,
"editMessage": "0",
"editMessageVarName": "",
"storage": "0",
"varName2": "",
"name": "Send Message"
}
],
"comType": "4",
"parameters": [
{
"name": "prompt",
"description": "Enter prompt here",
"type": "STRING",
"required": true,
"choices": null
}
],
"description": "ChatGPT"
}