Fix linting
This commit is contained in:
@@ -1028,7 +1028,7 @@ class LightRAG:
|
|||||||
if file_extraction_stage_ok:
|
if file_extraction_stage_ok:
|
||||||
try:
|
try:
|
||||||
# Get chunk_results from entity_relation_task
|
# Get chunk_results from entity_relation_task
|
||||||
chunk_results = await entity_relation_task
|
chunk_results = await entity_relation_task
|
||||||
await merge_nodes_and_edges(
|
await merge_nodes_and_edges(
|
||||||
chunk_results=chunk_results, # result collected from entity_relation_task
|
chunk_results=chunk_results, # result collected from entity_relation_task
|
||||||
knowledge_graph_inst=self.chunk_entity_relation_graph,
|
knowledge_graph_inst=self.chunk_entity_relation_graph,
|
||||||
|
@@ -490,7 +490,7 @@ async def merge_nodes_and_edges(
|
|||||||
file_path: str = "unknown_source",
|
file_path: str = "unknown_source",
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Merge nodes and edges from extraction results
|
"""Merge nodes and edges from extraction results
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
chunk_results: List of tuples (maybe_nodes, maybe_edges) containing extracted entities and relationships
|
chunk_results: List of tuples (maybe_nodes, maybe_edges) containing extracted entities and relationships
|
||||||
knowledge_graph_inst: Knowledge graph storage
|
knowledge_graph_inst: Knowledge graph storage
|
||||||
@@ -503,8 +503,9 @@ async def merge_nodes_and_edges(
|
|||||||
"""
|
"""
|
||||||
# Get lock manager from shared storage
|
# Get lock manager from shared storage
|
||||||
from .kg.shared_storage import get_graph_db_lock
|
from .kg.shared_storage import get_graph_db_lock
|
||||||
|
|
||||||
graph_db_lock = get_graph_db_lock(enable_logging=False)
|
graph_db_lock = get_graph_db_lock(enable_logging=False)
|
||||||
|
|
||||||
# Collect all nodes and edges from all chunks
|
# Collect all nodes and edges from all chunks
|
||||||
all_nodes = defaultdict(list)
|
all_nodes = defaultdict(list)
|
||||||
all_edges = 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
|
# Use graph database lock to ensure atomic merges and updates
|
||||||
async with graph_db_lock:
|
async with graph_db_lock:
|
||||||
async with pipeline_status_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)
|
logger.info(log_message)
|
||||||
pipeline_status["latest_message"] = log_message
|
pipeline_status["latest_message"] = log_message
|
||||||
pipeline_status["history_messages"].append(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)
|
await entity_vdb.upsert(data_for_vdb)
|
||||||
|
|
||||||
log_message = (
|
log_message = f"Updating {total_relations_count} relations {current_file_number}/{total_files}: {file_path}"
|
||||||
f"Updating {total_relations_count} relations {current_file_number}/{total_files}: {file_path}"
|
|
||||||
)
|
|
||||||
logger.info(log_message)
|
logger.info(log_message)
|
||||||
if pipeline_status is not None:
|
if pipeline_status is not None:
|
||||||
async with pipeline_status_lock:
|
async with pipeline_status_lock:
|
||||||
@@ -832,7 +833,7 @@ async def extract_entities(
|
|||||||
|
|
||||||
# If all tasks completed successfully, collect results
|
# If all tasks completed successfully, collect results
|
||||||
chunk_results = [task.result() for task in tasks]
|
chunk_results = [task.result() for task in tasks]
|
||||||
|
|
||||||
# Return the chunk_results for later processing in merge_nodes_and_edges
|
# Return the chunk_results for later processing in merge_nodes_and_edges
|
||||||
return chunk_results
|
return chunk_results
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ class NavigationService {
|
|||||||
if (currentUsername) {
|
if (currentUsername) {
|
||||||
localStorage.setItem('LIGHTRAG-PREVIOUS-USER', currentUsername);
|
localStorage.setItem('LIGHTRAG-PREVIOUS-USER', currentUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset application state but preserve history
|
// Reset application state but preserve history
|
||||||
// History will be cleared on next login if the user changes
|
// History will be cleared on next login if the user changes
|
||||||
this.resetAllApplicationState(true);
|
this.resetAllApplicationState(true);
|
||||||
|
Reference in New Issue
Block a user