Skip to content

updated moderation API...needs to upgrade to v3.3.0 #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
@@ -58,11 +58,6 @@ function wordWrapResponse(text) {
return formattedText;
}

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





/// OPEN AI API CALL ///

@@ -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
2 changes: 1 addition & 1 deletion codeart_backend/package.json
Original file line number Diff line number Diff line change
@@ -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"