mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-02 05:47:31 +08:00
Feature: GET /datasets to support ids array (#17606)
This commit is contained in:
@@ -463,7 +463,7 @@ class KnowledgebaseService(CommonService):
|
||||
|
||||
@classmethod
|
||||
@DB.connection_context()
|
||||
def get_list(cls, joined_tenant_ids, user_id, page_number, items_per_page, orderby, desc, id, name, keywords, parser_id=None):
|
||||
def get_list(cls, joined_tenant_ids, user_id, page_number, items_per_page, orderby, desc, id, name, keywords, parser_id=None, ids=None):
|
||||
# Get list of knowledge bases with filtering and pagination
|
||||
# Args:
|
||||
# joined_tenant_ids: List of tenant IDs
|
||||
@@ -482,6 +482,8 @@ class KnowledgebaseService(CommonService):
|
||||
kbs = cls.model.select()
|
||||
if id:
|
||||
kbs = kbs.where(cls.model.id == id)
|
||||
if ids:
|
||||
kbs = kbs.where(cls.model.id.in_(ids))
|
||||
if name:
|
||||
kbs = kbs.where(cls.model.name == name)
|
||||
if keywords:
|
||||
@@ -501,6 +503,12 @@ class KnowledgebaseService(CommonService):
|
||||
|
||||
return list(kbs.dicts()), total
|
||||
|
||||
@classmethod
|
||||
@DB.connection_context()
|
||||
def get_accessible_ids(cls, joined_tenant_ids, user_id, ids):
|
||||
kbs = cls.model.select(cls.model.id).where(cls.model.id.in_(ids), cls._visibility_and_status_filter(joined_tenant_ids, user_id))
|
||||
return {kb.id for kb in kbs}
|
||||
|
||||
@classmethod
|
||||
@DB.connection_context()
|
||||
def get_owner_filter(cls, joined_tenant_ids, user_id):
|
||||
|
||||
Reference in New Issue
Block a user