mirror of
https://github.com/System-End/Discord-Bot.git
synced 2026-04-19 18:35:22 +00:00
Updated to chatgpt-turbo
This commit is contained in:
parent
3a9676e298
commit
f6a110e168
1 changed files with 8 additions and 11 deletions
|
|
@ -229,22 +229,19 @@ module.exports = async (client, message) => {
|
|||
if (message.channel.id !== data.Channel) return;
|
||||
if (process.env.OPENAI) {
|
||||
fetch(
|
||||
`https://api.openai.com/v1/completions`,
|
||||
`https://api.openai.com/v1/chat/completions`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + process.env.OPENAI,
|
||||
},
|
||||
// body: '{\n "model": "text-davinci-003",\n "prompt": "What is your name?",\n "max_tokens": 4000,\n "temperature": 0\n}',
|
||||
body: JSON.stringify({
|
||||
'model': 'text-davinci-003',
|
||||
'prompt': message.content,
|
||||
'temperature': 0,
|
||||
'max_tokens': 256,
|
||||
'top_p': 1,
|
||||
'frequency_penalty': 0,
|
||||
'presence_penalty': 0,
|
||||
'model': 'gpt-3.5-turbo',
|
||||
'messages': [{
|
||||
'role': 'user',
|
||||
'content': message.content
|
||||
}]
|
||||
})
|
||||
}
|
||||
)
|
||||
|
|
@ -252,8 +249,8 @@ module.exports = async (client, message) => {
|
|||
})
|
||||
.then((res) => {
|
||||
res.json().then((data) => {
|
||||
if(data.error) return console.log(data.error);
|
||||
message.reply({ content: data.choices[0].text });
|
||||
if(data.error) return;
|
||||
message.reply({ content: data.choices[0].message.content });
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue