Fix linting

This commit is contained in:
yangdx
2025-03-02 17:32:25 +08:00
parent 68bf02abb6
commit 465737efed
3 changed files with 12 additions and 5 deletions

View File

@@ -27,7 +27,12 @@ def create_graph_routes(rag, api_key: Optional[str] = None):
@router.get("/graphs", dependencies=[Depends(optional_api_key)])
async def get_knowledge_graph(label: str, max_depth: int = 3):
"""
Get knowledge graph for a specific label.
Retrieve a connected subgraph of nodes where the label includes the specified label.
Maximum number of nodes is constrained by the environment variable `MAX_GRAPH_NODES` (default: 1000).
When reducing the number of nodes, the prioritization criteria are as follows:
1. Label matching nodes take precedence
2. Followed by nodes directly connected to the matching nodes
3. Finally, the degree of the nodes
Maximum number of nodes is limited to env MAX_GRAPH_NODES(default: 1000)
Args:

View File

@@ -519,7 +519,9 @@ class Neo4JStorage(BaseGraphStorage):
"""
validate_result = await session.run(validate_query)
if not await validate_result.single():
logger.warning(f"No nodes containing '{label}' in their labels found!")
logger.warning(
f"No nodes containing '{label}' in their labels found!"
)
return result
# Main query uses partial matching