discord-chat-gpt
Advanced tools
Comparing version 1.1.2 to 2.0.0
23
index.js
@@ -9,6 +9,4 @@ import { Configuration, OpenAIApi } from "openai"; | ||
constructor(options) { | ||
this.orgKey = options.authId; | ||
this.apiKey = options.apiKey; | ||
this.configuration = new Configuration({ | ||
organization: this.orgKey, | ||
apiKey: this.apiKey, | ||
@@ -25,13 +23,14 @@ }); | ||
try { | ||
let response = await this.openai.createCompletion({ | ||
model: "davinci", | ||
prompt: `ChatGPT is a friendly chatbot. \n\ | ||
ChatGPT : Hello, how are you?\n\ | ||
${requester}: ${content}\n\ | ||
ChatGPT:`, | ||
temperature: 0.9, | ||
max_tokens: 100, | ||
stop: ["ChatGPT:", "Kabir Jaipal:"], | ||
let response = await this.openai.createChatCompletion({ | ||
model: "gpt-3.5-turbo-0301", | ||
messages: [ | ||
{ | ||
role: "user", | ||
content: content, | ||
name: requester, | ||
}, | ||
], | ||
}); | ||
return response.data.choices.at(0).text; | ||
let message = response.data.choices.at(0).message.content; | ||
return message; | ||
} catch (error) { | ||
@@ -38,0 +37,0 @@ throw new Error(`Failed to complete API call: ${error.message}`); |
{ | ||
"name": "discord-chat-gpt", | ||
"version": "1.1.2", | ||
"version": "2.0.0", | ||
"description": "Chat-GPT Chat Bot For Discord", | ||
@@ -37,4 +37,4 @@ "main": "index.js", | ||
"discord.js": "^14.7.1", | ||
"openai": "^3.1.0" | ||
"openai": "^3.2.1" | ||
} | ||
} |
3887
40
+ Added@types/node@20.14.2(transitive)
+ Addedws@8.17.0(transitive)
- Removed@types/node@20.14.7(transitive)
- Removedws@8.17.1(transitive)
Updatedopenai@^3.2.1