commit
This commit is contained in:
parent
81df8879c2
commit
20292262d6
4 changed files with 47 additions and 25 deletions
|
@ -19,9 +19,9 @@ function addUserToDb(id, user) {
|
|||
});
|
||||
}
|
||||
|
||||
function incrementQuota(id) {
|
||||
function incrementQuota(id, value) {
|
||||
return new Promise((resolve, reject) => {
|
||||
connection.query('UPDATE users SET quota = quota + 1 WHERE userid = ' + id, (error, results, fields) => {
|
||||
connection.query('UPDATE users SET quota = quota + '+ value + ' WHERE userid = ' + id, (error, results, fields) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
|
|
|
@ -24,14 +24,13 @@ async function generateImage(query, ctx, bot) {
|
|||
async function answerQuestion(query) {
|
||||
response = await openai.createChatCompletion({
|
||||
model: "gpt-3.5-turbo",
|
||||
messages: [{"role":"system", "content" : "You are a helpful assistant."},{ "role" : "user", "content" : "who is the president of the united states?" }, { "role" : "assistant", "content" : "Joe Biden"}],
|
||||
messages: [{ "role" : "user", "content" : query}],
|
||||
temperature: 0.9,
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
addToLogs("--> error : " + err);
|
||||
})
|
||||
|
||||
console.log(response);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue