Merge pull request #1300 from vinodkiran/BUGFIX/caseinsensitive-simple-moderation

Bugfix: Simple Moderation, making the checks case-insensitive
This commit is contained in:
Henry Heng
2023-11-28 16:11:17 +00:00
committed by GitHub
@@ -14,7 +14,7 @@ export class SimplePromptModerationRunner implements Moderation {
async checkForViolations(input: string): Promise<string> {
this.denyList.split('\n').forEach((denyListItem) => {
if (denyListItem && denyListItem !== '' && input.includes(denyListItem)) {
if (denyListItem && denyListItem !== '' && input.toLowerCase().includes(denyListItem.toLowerCase())) {
throw Error(this.moderationErrorMessage)
}
})