Skip to content

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

refine file select code (#1021)

KevinHuSh1de31ca9f6be
diff --git a/api/db/init_data.py b/api/db/init_data.py
index 988a953e0c..3017160ccb 100644
--- a/api/db/init_data.py
+++ b/api/db/init_data.py
@@ -385,7 +385,7 @@ def init_llm_factory():
{
"fid": factory_infos[7]["name"],
"llm_name": "maidalun1020/bce-reranker-base_v1",
- "tags": "RE-RANK, 8K",
+ "tags": "RE-RANK, 512",
"max_tokens": 512,
"model_type": LLMType.RERANK.value
},
diff --git a/api/db/services/file_service.py b/api/db/services/file_service.py
index 7b9ecd2c5d..fbad870f38 100644
--- a/api/db/services/file_service.py
+++ b/api/db/services/file_service.py
@@ -164,12 +164,11 @@ class FileService(CommonService):
@classmethod
@DB.connection_context()
def get_kb_folder(cls, tenant_id):
- for root in cls.model.select().where(cls.model.tenant_id == tenant_id and
- cls.model.parent_id == cls.model.id):
- for folder in cls.model.select().where(cls.model.tenant_id == tenant_id and
- cls.model.parent_id == root.id and
- cls.model.name == KNOWLEDGEBASE_FOLDER_NAME
- ):
+ for root in cls.model.select().where(
+ (cls.model.tenant_id == tenant_id), (cls.model.parent_id == cls.model.id)):
+ for folder in cls.model.select().where(
+ (cls.model.tenant_id == tenant_id), (cls.model.parent_id == root.id),
+ (cls.model.name == KNOWLEDGEBASE_FOLDER_NAME)):
return folder.to_dict()
assert False, "Can't find the KB folder. Database init error."