From 6bb399c838d75f84ed1aa69dc650465a8ad97945 Mon Sep 17 00:00:00 2001 From: Abhishek Choudhary Date: Wed, 18 Sep 2024 14:32:30 +0545 Subject: [PATCH] fix ci --- Makefile | 4 ++++ apisix/plugins/ai-content-moderation.lua | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 545a21e4f29f..36447611ca79 100644 --- a/Makefile +++ b/Makefile @@ -380,6 +380,10 @@ install: runtime $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ai-proxy/drivers $(ENV_INSTALL) apisix/plugins/ai-proxy/drivers/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ai-proxy/drivers + # ai-content-moderation plugin + $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ai + $(ENV_INSTALL) apisix/plugins/ai/*.lua $(ENV_INST_LUADIR)/apisix/plugins/ai + $(ENV_INSTALL) bin/apisix $(ENV_INST_BINDIR)/apisix diff --git a/apisix/plugins/ai-content-moderation.lua b/apisix/plugins/ai-content-moderation.lua index 41f5478e95c8..62fe8f6e979d 100644 --- a/apisix/plugins/ai-content-moderation.lua +++ b/apisix/plugins/ai-content-moderation.lua @@ -44,6 +44,8 @@ local aws_comprehend_schema = { required = { "access_key_id", "secret_access_key", "region", } } +local moderation_categories_pattern = "^(PROFANITY|HATE_SPEECH|INSULT|".. + "HARASSMENT_OR_ABUSE|SEXUAL|VIOLENCE_OR_THREAT)$" local schema = { type = "object", properties = { @@ -59,7 +61,7 @@ local schema = { type = "object", patternProperties = { -- luacheck: push max code line length 300 - ["^(PROFANITY|HATE_SPEECH|INSULT|HARASSMENT_OR_ABUSE|SEXUAL|VIOLENCE_OR_THREAT)$"] = { + [moderation_categories_pattern] = { -- luacheck: pop type = "number", minimum = 0,