Skip to content

Commit

Permalink
.gitignore and few changes
Browse files Browse the repository at this point in the history
  • Loading branch information
redji committed Mar 26, 2024
1 parent 04da7ce commit 8e29bc5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
36 changes: 36 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions prompt.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import fetch from 'node-fetch';
//import shouldStringBeAllowed from './openAPI/moderation/moderate'
import { config } from 'dotenv';
import { chatCompletion, moderations } from './openAPI/index.js';
import { chatCompletion } from './openAPI/index.js';
import { makeRequestWithDelay } from './utils/makeRequest.js';
import FormData from 'form-data';
import axios from 'axios'


config();
const APIKey = process.env['API_KEY'];

Expand Down Expand Up @@ -152,17 +153,18 @@ fetch('https://tasks.aidevs.pl/token/liar', {
})
.then(async (response) => {
console.log('Response:', response.data);
const answer = response.data.answer
await chatCompletion({
messages: [{ role: 'user', content: 'Return YES or NO, uppercase. Is it true that for question: "' + liarQuestion + '" The answer might be: "' + response.data.answer + '".'}],
model: 'gpt-3.5-turbo',
}).then(async (response) => {
console.log('Response2', response.choices[0].message.content)
const answer = response.choices[0].message.content
const response4 = await makeRequestWithDelay(`https://tasks.aidevs.pl/answer/${token}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({answer: response.choices[0].message.content})
body: JSON.stringify({answer: answer})
}, 10);
console.log('Answer from API', response4)
});
Expand Down

0 comments on commit 8e29bc5

Please sign in to comment.