Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file modified codeart_backend/.DS_Store
Binary file not shown.
Binary file added codeart_backend/controllers/.DS_Store
Binary file not shown.
19 changes: 3 additions & 16 deletions codeart_backend/controllers/openaiController.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ function wordWrapResponse(text) {
return formattedText;
}

// console.log(wordWrapResponse(exampleText));





/// OPEN AI API CALL ///

Expand All @@ -74,18 +69,10 @@ const openai = new OpenAIApi(configuration);

async function isContentSafe(text){

const contentType = await openai.createCompletion("content-filter-alpha", {
prompt: contentFilter(text),
temperature: 0.0,
max_tokens: 1,
top_p: 0,
frequency_penalty: 0.5,
logprobs: 10,
});
console.log('content check', contentType.data.choices)
const moderation = await openai.createModeration({ input: text });

if(contentType.data.choices[0].text === '0'){
return true
if(moderation.data.results[0].flagged === false){
return true
} else {

base('AI_INPUTS').create({ //AIRTABLE STUFF
Expand Down
2 changes: 1 addition & 1 deletion codeart_backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"node-fetch": "^2.6.7",
"node-schedule": "^2.1.0",
"onoff": "^5.0.1",
"openai": "^2.0.5",
"openai": "^3.3.0",
"socket.io": "^2.3.0",
"splitflapjs": "file:../ext/splitflap/software/js/splitflapjs",
"splitflapjs-proto": "file:../ext/splitflap/software/js/splitflapjs-proto"
Expand Down