Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: 'Chunk not found!' error in team-sharing knowledge base. (#5361)

Zhenglin Dong11e6d84d4637
diff --git a/api/apps/chunk_app.py b/api/apps/chunk_app.py
index bef5eb0539..0de3db7538 100644
--- a/api/apps/chunk_app.py
+++ b/api/apps/chunk_app.py
@@ -93,12 +93,14 @@ def get():
tenants = UserTenantService.query(user_id=current_user.id)
if not tenants:
return get_data_error_result(message="Tenant not found!")
- tenant_id = tenants[0].tenant_id
-
- kb_ids = KnowledgebaseService.get_kb_ids(tenant_id)
- chunk = settings.docStoreConn.get(chunk_id, search.index_name(tenant_id), kb_ids)
+ for tenant in tenants:
+ kb_ids = KnowledgebaseService.get_kb_ids(tenant.tenant_id)
+ chunk = settings.docStoreConn.get(chunk_id, search.index_name(tenant.tenant_id), kb_ids)
+ if chunk:
+ break
if chunk is None:
return server_error_response(Exception("Chunk not found"))
+
k = []
for n in chunk.keys():
if re.search(r"(_vec$|_sm_|_tks|_ltks)", n):