@fsvreddit/bot-bouncer-evaluation 0.7.43 → 0.7.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/userEvaluation/EvaluateBadDisplayname.js +5 -1
- package/dist/userEvaluation/EvaluateBioText.js +5 -1
- package/dist/userEvaluation/EvaluatePostTitle.js +2 -1
- package/dist/userEvaluation/EvaluateRepostBot.js +1 -1
- package/dist/userEvaluation/EvaluateTextInNsfwImages.js +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,11 @@ class EvaluateBadDisplayName extends UserEvaluatorBase_js_1.UserEvaluatorBase {
|
|
|
15
15
|
this.banContentThreshold = 0;
|
|
16
16
|
}
|
|
17
17
|
getBadDisplayNameRegexes() {
|
|
18
|
-
|
|
18
|
+
if (this.badDisplayNameRegexes === undefined) {
|
|
19
|
+
const bannableDisplayNameRegexes = this.getVariable("regexes", []);
|
|
20
|
+
const ignoredDisplayNameRegexes = this.getVariable("ignoredRegexes", []);
|
|
21
|
+
this.badDisplayNameRegexes = bannableDisplayNameRegexes.filter(regex => !ignoredDisplayNameRegexes.includes(regex));
|
|
22
|
+
}
|
|
19
23
|
return this.badDisplayNameRegexes;
|
|
20
24
|
}
|
|
21
25
|
isBadDisplayName(displayName) {
|
|
@@ -14,7 +14,11 @@ class EvaluateBioText extends UserEvaluatorBase_js_1.UserEvaluatorBase {
|
|
|
14
14
|
this.banContentThreshold = 0;
|
|
15
15
|
}
|
|
16
16
|
getBioText() {
|
|
17
|
-
|
|
17
|
+
if (this.bioText === undefined) {
|
|
18
|
+
const bannableBioText = this.getVariable("bantext", []);
|
|
19
|
+
const ignoredBanText = this.getVariable("ignoredBanText", []);
|
|
20
|
+
this.bioText = bannableBioText.filter(bioText => !ignoredBanText.includes(bioText));
|
|
21
|
+
}
|
|
18
22
|
return this.bioText;
|
|
19
23
|
}
|
|
20
24
|
validateVariables() {
|
|
@@ -46,7 +46,8 @@ class EvaluatePostTitle extends UserEvaluatorBase_js_1.UserEvaluatorBase {
|
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
48
48
|
getTitles() {
|
|
49
|
-
|
|
49
|
+
const prefixesToIgnore = this.getVariable("ignoredRegexPrefixes", []);
|
|
50
|
+
return this.getVariable("bantext", []).filter(title => !prefixesToIgnore.some(prefix => title.startsWith(prefix)));
|
|
50
51
|
}
|
|
51
52
|
getTitleRegexes() {
|
|
52
53
|
this.titleRegexes ?? (this.titleRegexes = this.getTitles().map(title => new RegExp(title, "u")));
|
|
@@ -95,7 +95,7 @@ class EvaluateRepostBot extends UserEvaluatorBase_js_1.UserEvaluatorBase {
|
|
|
95
95
|
},
|
|
96
96
|
});
|
|
97
97
|
const result = JSON.parse(response.output_text);
|
|
98
|
-
await redis.set(cacheKey, result.similarity.toString(), { expiration: (0, date_fns_1.
|
|
98
|
+
await redis.set(cacheKey, result.similarity.toString(), { expiration: (0, date_fns_1.addWeeks)(new Date(), 1) });
|
|
99
99
|
console.log(`Repost Checks: Tokens used: ${response.usage?.total_tokens}, Similarity between ${this.postIdToUrl(postA.id)} and ${this.postIdToUrl(postB.id)}: ${result.similarity}`);
|
|
100
100
|
return result.similarity;
|
|
101
101
|
}
|
|
@@ -122,7 +122,7 @@ class EvaluateTextInNsfwImages extends EvaluateBotGroupAdvanced_1.EvaluateBotGro
|
|
|
122
122
|
}
|
|
123
123
|
const result = JSON.parse(response.output_text);
|
|
124
124
|
console.log(`OpenAI Checks: Tokens used: ${response.usage?.total_tokens}, Model: ${model}, Image URL: ${url}, Extracted Text: ${result.extractedText}`);
|
|
125
|
-
await redis.set(resultCacheKey, JSON.stringify(result.extractedText), { expiration: (0, date_fns_1.
|
|
125
|
+
await redis.set(resultCacheKey, JSON.stringify(result.extractedText), { expiration: (0, date_fns_1.addWeeks)(new Date(), 1) });
|
|
126
126
|
if (!result.extractedText) {
|
|
127
127
|
return;
|
|
128
128
|
}
|
package/package.json
CHANGED