yangdx
commited on
Commit
·
111f35a
1
Parent(s):
7e2344c
Fix linting
Browse files- lightrag/lightrag.py +1 -1
- lightrag/operate.py +8 -7
- lightrag_webui/src/services/navigation.ts +1 -1
lightrag/lightrag.py
CHANGED
@@ -1028,7 +1028,7 @@ class LightRAG:
|
|
1028 |
if file_extraction_stage_ok:
|
1029 |
try:
|
1030 |
# Get chunk_results from entity_relation_task
|
1031 |
-
chunk_results = await entity_relation_task
|
1032 |
await merge_nodes_and_edges(
|
1033 |
chunk_results=chunk_results, # result collected from entity_relation_task
|
1034 |
knowledge_graph_inst=self.chunk_entity_relation_graph,
|
|
|
1028 |
if file_extraction_stage_ok:
|
1029 |
try:
|
1030 |
# Get chunk_results from entity_relation_task
|
1031 |
+
chunk_results = await entity_relation_task
|
1032 |
await merge_nodes_and_edges(
|
1033 |
chunk_results=chunk_results, # result collected from entity_relation_task
|
1034 |
knowledge_graph_inst=self.chunk_entity_relation_graph,
|
lightrag/operate.py
CHANGED
@@ -490,7 +490,7 @@ async def merge_nodes_and_edges(
|
|
490 |
file_path: str = "unknown_source",
|
491 |
) -> None:
|
492 |
"""Merge nodes and edges from extraction results
|
493 |
-
|
494 |
Args:
|
495 |
chunk_results: List of tuples (maybe_nodes, maybe_edges) containing extracted entities and relationships
|
496 |
knowledge_graph_inst: Knowledge graph storage
|
@@ -503,8 +503,9 @@ async def merge_nodes_and_edges(
|
|
503 |
"""
|
504 |
# Get lock manager from shared storage
|
505 |
from .kg.shared_storage import get_graph_db_lock
|
|
|
506 |
graph_db_lock = get_graph_db_lock(enable_logging=False)
|
507 |
-
|
508 |
# Collect all nodes and edges from all chunks
|
509 |
all_nodes = defaultdict(list)
|
510 |
all_edges = defaultdict(list)
|
@@ -527,7 +528,9 @@ async def merge_nodes_and_edges(
|
|
527 |
# Use graph database lock to ensure atomic merges and updates
|
528 |
async with graph_db_lock:
|
529 |
async with pipeline_status_lock:
|
530 |
-
log_message =
|
|
|
|
|
531 |
logger.info(log_message)
|
532 |
pipeline_status["latest_message"] = log_message
|
533 |
pipeline_status["history_messages"].append(log_message)
|
@@ -585,9 +588,7 @@ async def merge_nodes_and_edges(
|
|
585 |
}
|
586 |
await entity_vdb.upsert(data_for_vdb)
|
587 |
|
588 |
-
log_message =
|
589 |
-
f"Updating {total_relations_count} relations {current_file_number}/{total_files}: {file_path}"
|
590 |
-
)
|
591 |
logger.info(log_message)
|
592 |
if pipeline_status is not None:
|
593 |
async with pipeline_status_lock:
|
@@ -832,7 +833,7 @@ async def extract_entities(
|
|
832 |
|
833 |
# If all tasks completed successfully, collect results
|
834 |
chunk_results = [task.result() for task in tasks]
|
835 |
-
|
836 |
# Return the chunk_results for later processing in merge_nodes_and_edges
|
837 |
return chunk_results
|
838 |
|
|
|
490 |
file_path: str = "unknown_source",
|
491 |
) -> None:
|
492 |
"""Merge nodes and edges from extraction results
|
493 |
+
|
494 |
Args:
|
495 |
chunk_results: List of tuples (maybe_nodes, maybe_edges) containing extracted entities and relationships
|
496 |
knowledge_graph_inst: Knowledge graph storage
|
|
|
503 |
"""
|
504 |
# Get lock manager from shared storage
|
505 |
from .kg.shared_storage import get_graph_db_lock
|
506 |
+
|
507 |
graph_db_lock = get_graph_db_lock(enable_logging=False)
|
508 |
+
|
509 |
# Collect all nodes and edges from all chunks
|
510 |
all_nodes = defaultdict(list)
|
511 |
all_edges = defaultdict(list)
|
|
|
528 |
# Use graph database lock to ensure atomic merges and updates
|
529 |
async with graph_db_lock:
|
530 |
async with pipeline_status_lock:
|
531 |
+
log_message = (
|
532 |
+
f"Merging nodes/edges {current_file_number}/{total_files}: {file_path}"
|
533 |
+
)
|
534 |
logger.info(log_message)
|
535 |
pipeline_status["latest_message"] = log_message
|
536 |
pipeline_status["history_messages"].append(log_message)
|
|
|
588 |
}
|
589 |
await entity_vdb.upsert(data_for_vdb)
|
590 |
|
591 |
+
log_message = f"Updating {total_relations_count} relations {current_file_number}/{total_files}: {file_path}"
|
|
|
|
|
592 |
logger.info(log_message)
|
593 |
if pipeline_status is not None:
|
594 |
async with pipeline_status_lock:
|
|
|
833 |
|
834 |
# If all tasks completed successfully, collect results
|
835 |
chunk_results = [task.result() for task in tasks]
|
836 |
+
|
837 |
# Return the chunk_results for later processing in merge_nodes_and_edges
|
838 |
return chunk_results
|
839 |
|
lightrag_webui/src/services/navigation.ts
CHANGED
@@ -63,7 +63,7 @@ class NavigationService {
|
|
63 |
if (currentUsername) {
|
64 |
localStorage.setItem('LIGHTRAG-PREVIOUS-USER', currentUsername);
|
65 |
}
|
66 |
-
|
67 |
// Reset application state but preserve history
|
68 |
// History will be cleared on next login if the user changes
|
69 |
this.resetAllApplicationState(true);
|
|
|
63 |
if (currentUsername) {
|
64 |
localStorage.setItem('LIGHTRAG-PREVIOUS-USER', currentUsername);
|
65 |
}
|
66 |
+
|
67 |
// Reset application state but preserve history
|
68 |
// History will be cleared on next login if the user changes
|
69 |
this.resetAllApplicationState(true);
|