Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: fix the data validation consistency issue in keyword content review (#8908)

zhuhao503561f464c5
diff --git a/api/core/moderation/keywords/keywords.py b/api/core/moderation/keywords/keywords.py
index dc6a7ec5644..4846da8f930 100644
--- a/api/core/moderation/keywords/keywords.py
+++ b/api/core/moderation/keywords/keywords.py
@@ -18,8 +18,12 @@ class KeywordsModeration(Moderation):
if not config.get("keywords"):
raise ValueError("keywords is required")
- if len(config.get("keywords")) > 1000:
- raise ValueError("keywords length must be less than 1000")
+ if len(config.get("keywords")) > 10000:
+ raise ValueError("keywords length must be less than 10000")
+
+ keywords_row_len = config["keywords"].split("\n")
+ if len(keywords_row_len) > 100:
+ raise ValueError("the number of rows for the keywords must be less than 100")
def moderation_for_inputs(self, inputs: dict, query: str = "") -> ModerationInputsResult:
flagged = False