From 60c1bf5a1971cb4e4f33932c4cdf6159eea97925 Mon Sep 17 00:00:00 2001 From: Liu An Date: Thu, 12 Jun 2025 09:46:57 +0800 Subject: [PATCH] Fix: duplicate knowledgebase name validation logic (#8199) ### What problem does this PR solve? Change the condition from checking for >1 to >=1 when validating duplicate knowledgebase names to properly catch all duplicates. This ensures no two knowledgebases can have the same name for a tenant. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/kb_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/apps/kb_app.py b/api/apps/kb_app.py index d65766b83..9c37f96b4 100644 --- a/api/apps/kb_app.py +++ b/api/apps/kb_app.py @@ -107,7 +107,7 @@ def update(): if req["name"].lower() != kb.name.lower() \ and len( - KnowledgebaseService.query(name=req["name"], tenant_id=current_user.id, status=StatusEnum.VALID.value)) > 1: + KnowledgebaseService.query(name=req["name"], tenant_id=current_user.id, status=StatusEnum.VALID.value)) >= 1: return get_data_error_result( message="Duplicated knowledgebase name.")