Untitled

 avatar
unknown
javascript
2 years ago
1.1 kB
9
Indexable
else if(input.startsWith("Kevin")) {
						if(chatbot == off) {
							api.sendMessage("Chatbot has been disabled by the creator", event.threadID)
						} else {
							if(chatbot == on) {
								var {
									mentions,
									senderID,
									threadID,
									messageID
								} = event;
								if(input.split(" ").length < 2) {
									api.sendMessage("Is There Anything I Can Help?", threadID, messageID)
								} else {
									var text = input.substring(6)
									const configuration = new Configuration({
										apiKey: "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",
									});
									const openai = new OpenAIApi(configuration);
									const {
										data
									} = await openai.createCompletion({
									    model: "text-davinci-003",
										prompt: text,
										temperature: 0.5,
										max_tokens: 4000,
										top_p: 0.3,
										frequency_penalty: 0.5,
										presence_penalty: 0.0,
									});
									api.sendMessage(data.choices[0].text, threadID, messageID)
								}
							}
						}
					}
Editor is loading...