Here’s the https://perchance.org/prompt-hunter , a gallery tag searching gen.
if (formatTagName !== "no filter, currently showing all tags" && dataMatch) {
// Modify the 'bannedPromptPhrases' array
dataObj.bannedPromptPhrases = [`/^(?!.*(\\b${formatTagName}\\b)).*$/i`];
localStorage.setItem("lookForThis", formatTagName);
} else {
localStorage.removeItem("lookForThis");
}
if (formatBadTags !== "no bad words to filter") {
dataObj.bannedPromptPhrases.push(...formatBadTags);
let badTagsJoin = formatBadTags.join(', ')
localStorage.setItem("dontLookForThis", badTagsJoin);
} else {
localStorage.removeItem("dontLookForThis")
}
I want to add my own banned list [jail.bannedPromptPhrases] and import jail, added after that as
if (Array.isArray(jail?.bannedPromptPhrases)) {
dataObj.bannedPromptPhrases.push(...jail.bannedPromptPhrases);
}
}
Now the problem is that’s giving unstable results, sometimes it works and sometimes not. I have no idea how or why. In this forked gen https://perchance.org/prompt-hunter#sharedlink=gen%3Aai-furry-generator&galleryname%3Atest3=&tag%3A=&bannedword=: Apple should be banned in PG-13 because it has a PG-13 banned tag “ContentLabel”. But sometimes it just won’t work!(what’s tricky is sometimes it also work) Help!
The problem is the condition, that list is not an array, I’m pretty sure it is an object. An object is something like "BannedPromptPhrases = {banWord1: “banWord1”, banWord2: “banWord2”}; They are values stored inside the var. So the commands below (join() split() map() filter()) converts it to an array, the condition should be AFTER. But i think you don’t need that condition, and if you are lazy just change it to something that’s always true like 2===2.