From 982ec24fa7688173f78998b787449413141096b2 Mon Sep 17 00:00:00 2001 From: Syed Shahmeer Ali Date: Thu, 4 Sep 2025 18:14:56 +0500 Subject: [PATCH] Fix kb isolation infinity conn (#9913) ### What problem does this PR solve? This PR fixes a critical bug in the knowledge base isolation feature where chat responses were referencing documents from incorrect knowledge bases. The issue was in the `infinity_conn.py` file where the `equivalent_condition_to_str()` function was incorrectly skipping `kb_id` filtering, causing documents from unintended knowledge bases to be included in search results. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Co-authored-by: Syed Shahmeer Ali Co-authored-by: Kevin Hu --- rag/utils/infinity_conn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rag/utils/infinity_conn.py b/rag/utils/infinity_conn.py index ad76e1ba6..26a98e845 100644 --- a/rag/utils/infinity_conn.py +++ b/rag/utils/infinity_conn.py @@ -67,7 +67,7 @@ def equivalent_condition_to_str(condition: dict, table_instance=None) -> str | N cond = list() for k, v in condition.items(): - if not isinstance(k, str) or k in ["kb_id"] or not v: + if not isinstance(k, str) or not v: continue if field_keyword(k): if isinstance(v, list):