From 555aaa3fe01a81bcd7f1758ceea1709bc1f8011f Mon Sep 17 00:00:00 2001 From: Mini256 Date: Tue, 7 Jan 2025 15:19:39 +0800 Subject: [PATCH] feat: graph search api support metadata filter --- backend/app/api/admin_routes/knowledge_base/graph/models.py | 1 + backend/app/api/admin_routes/knowledge_base/graph/routes.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/api/admin_routes/knowledge_base/graph/models.py b/backend/app/api/admin_routes/knowledge_base/graph/models.py index 18156c8a..ca7f45a8 100644 --- a/backend/app/api/admin_routes/knowledge_base/graph/models.py +++ b/backend/app/api/admin_routes/knowledge_base/graph/models.py @@ -33,6 +33,7 @@ class GraphSearchRequest(BaseModel): include_meta: bool = True depth: int = 2 with_degree: bool = True + relationship_meta_filters: dict = {} class KnowledgeRequest(BaseModel): diff --git a/backend/app/api/admin_routes/knowledge_base/graph/routes.py b/backend/app/api/admin_routes/knowledge_base/graph/routes.py index 943681cb..92679d54 100644 --- a/backend/app/api/admin_routes/knowledge_base/graph/routes.py +++ b/backend/app/api/admin_routes/knowledge_base/graph/routes.py @@ -207,7 +207,7 @@ def search_graph(session: SessionDep, kb_id: int, request: GraphSearchRequest): request.include_meta, request.with_degree, False, - {}, + request.relationship_meta_filters, ) return { "entities": entities,