Commit
•
bcd2d46
1
Parent(s):
7062da0
quick fix
Browse files- src/app/engine/censorship.ts +34 -1
src/app/engine/censorship.ts
CHANGED
@@ -3,4 +3,37 @@
|
|
3 |
// unfortunately due to abuse by some users, I have to add this NSFW filter
|
4 |
const secretSalt = `${process.env.SECRET_CENSORSHIP_KEY || ""}`
|
5 |
|
6 |
-
// TODO the censorship is not implement yet actually
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
// unfortunately due to abuse by some users, I have to add this NSFW filter
|
4 |
const secretSalt = `${process.env.SECRET_CENSORSHIP_KEY || ""}`
|
5 |
|
6 |
+
// TODO the censorship is not implement yet actually
|
7 |
+
|
8 |
+
// I don't want to be banned by Replicate because bad actors are asking
|
9 |
+
// for some naked anime stuff or whatever
|
10 |
+
// I also want to avoid a PR scandal due to some bad user generated content
|
11 |
+
|
12 |
+
const forbiddenWords = [
|
13 |
+
// those keywords have been generated by looking at the logs of the AI Comic Factory
|
14 |
+
// those are real requests some users tried to attempt.. :|
|
15 |
+
"nazi",
|
16 |
+
"hitler",
|
17 |
+
"boob",
|
18 |
+
"boobs",
|
19 |
+
"boobies",
|
20 |
+
"nipple",
|
21 |
+
"nipples",
|
22 |
+
"nude",
|
23 |
+
"nudes",
|
24 |
+
"naked",
|
25 |
+
"pee",
|
26 |
+
"peeing",
|
27 |
+
"erotic",
|
28 |
+
"sexy"
|
29 |
+
]
|
30 |
+
|
31 |
+
// temporary utility to make sure Replicate doesn't ban my account
|
32 |
+
// because of what users do in their prompt
|
33 |
+
export const filterOutBadWords = (sentence: string) => {
|
34 |
+
const words = sentence.split(" ")
|
35 |
+
return words.filter(word => {
|
36 |
+
const lowerCase = word.toLocaleLowerCase()
|
37 |
+
return !forbiddenWords.includes(lowerCase)
|
38 |
+
}).join(" ")
|
39 |
+
}
|