Fix linting

This commit is contained in:
yangdx
2025-04-28 02:15:25 +08:00
parent d7552a2a87
commit 594e7b751a
3 changed files with 10 additions and 9 deletions

View File

@@ -1028,7 +1028,7 @@ class LightRAG:
if file_extraction_stage_ok:
try:
# Get chunk_results from entity_relation_task
chunk_results = await entity_relation_task
chunk_results = await entity_relation_task
await merge_nodes_and_edges(
chunk_results=chunk_results, # result collected from entity_relation_task
knowledge_graph_inst=self.chunk_entity_relation_graph,

View File

@@ -490,7 +490,7 @@ async def merge_nodes_and_edges(
file_path: str = "unknown_source",
) -> None:
"""Merge nodes and edges from extraction results
Args:
chunk_results: List of tuples (maybe_nodes, maybe_edges) containing extracted entities and relationships
knowledge_graph_inst: Knowledge graph storage
@@ -503,8 +503,9 @@ async def merge_nodes_and_edges(
"""
# Get lock manager from shared storage
from .kg.shared_storage import get_graph_db_lock
graph_db_lock = get_graph_db_lock(enable_logging=False)
# Collect all nodes and edges from all chunks
all_nodes = defaultdict(list)
all_edges = defaultdict(list)
@@ -527,7 +528,9 @@ async def merge_nodes_and_edges(
# Use graph database lock to ensure atomic merges and updates
async with graph_db_lock:
async with pipeline_status_lock:
log_message = f"Merging nodes/edges {current_file_number}/{total_files}: {file_path}"
log_message = (
f"Merging nodes/edges {current_file_number}/{total_files}: {file_path}"
)
logger.info(log_message)
pipeline_status["latest_message"] = log_message
pipeline_status["history_messages"].append(log_message)
@@ -585,9 +588,7 @@ async def merge_nodes_and_edges(
}
await entity_vdb.upsert(data_for_vdb)
log_message = (
f"Updating {total_relations_count} relations {current_file_number}/{total_files}: {file_path}"
)
log_message = f"Updating {total_relations_count} relations {current_file_number}/{total_files}: {file_path}"
logger.info(log_message)
if pipeline_status is not None:
async with pipeline_status_lock:
@@ -832,7 +833,7 @@ async def extract_entities(
# If all tasks completed successfully, collect results
chunk_results = [task.result() for task in tasks]
# Return the chunk_results for later processing in merge_nodes_and_edges
return chunk_results

View File

@@ -63,7 +63,7 @@ class NavigationService {
if (currentUsername) {
localStorage.setItem('LIGHTRAG-PREVIOUS-USER', currentUsername);
}
// Reset application state but preserve history
// History will be cleared on next login if the user changes
this.resetAllApplicationState(true);