Rename rebuild function name and improve relationship logging format
This commit is contained in:
parent
083b163c1f
commit
97a2ee4ef1
2 changed files with 5 additions and 5 deletions
|
|
@ -87,7 +87,7 @@ from lightrag.operate import (
|
||||||
merge_nodes_and_edges,
|
merge_nodes_and_edges,
|
||||||
kg_query,
|
kg_query,
|
||||||
naive_query,
|
naive_query,
|
||||||
_rebuild_knowledge_from_chunks,
|
rebuild_knowledge_from_chunks,
|
||||||
)
|
)
|
||||||
from lightrag.constants import GRAPH_FIELD_SEP
|
from lightrag.constants import GRAPH_FIELD_SEP
|
||||||
from lightrag.utils import (
|
from lightrag.utils import (
|
||||||
|
|
@ -3347,7 +3347,7 @@ class LightRAG:
|
||||||
# 8. Rebuild entities and relationships from remaining chunks
|
# 8. Rebuild entities and relationships from remaining chunks
|
||||||
if entities_to_rebuild or relationships_to_rebuild:
|
if entities_to_rebuild or relationships_to_rebuild:
|
||||||
try:
|
try:
|
||||||
await _rebuild_knowledge_from_chunks(
|
await rebuild_knowledge_from_chunks(
|
||||||
entities_to_rebuild=entities_to_rebuild,
|
entities_to_rebuild=entities_to_rebuild,
|
||||||
relationships_to_rebuild=relationships_to_rebuild,
|
relationships_to_rebuild=relationships_to_rebuild,
|
||||||
knowledge_graph_inst=self.chunk_entity_relation_graph,
|
knowledge_graph_inst=self.chunk_entity_relation_graph,
|
||||||
|
|
|
||||||
|
|
@ -502,7 +502,7 @@ async def _handle_single_relationship_extraction(
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
async def _rebuild_knowledge_from_chunks(
|
async def rebuild_knowledge_from_chunks(
|
||||||
entities_to_rebuild: dict[str, list[str]],
|
entities_to_rebuild: dict[str, list[str]],
|
||||||
relationships_to_rebuild: dict[tuple[str, str], list[str]],
|
relationships_to_rebuild: dict[tuple[str, str], list[str]],
|
||||||
knowledge_graph_inst: BaseGraphStorage,
|
knowledge_graph_inst: BaseGraphStorage,
|
||||||
|
|
@ -723,7 +723,7 @@ async def _rebuild_knowledge_from_chunks(
|
||||||
rebuilt_relationships_count += 1
|
rebuilt_relationships_count += 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
failed_relationships_count += 1
|
failed_relationships_count += 1
|
||||||
status_message = f"Failed to rebuild `{src} - {tgt}`: {e}"
|
status_message = f"Failed to rebuild `{src}`~`{tgt}`: {e}"
|
||||||
logger.info(status_message) # Per requirement, change to info
|
logger.info(status_message) # Per requirement, change to info
|
||||||
if pipeline_status is not None and pipeline_status_lock is not None:
|
if pipeline_status is not None and pipeline_status_lock is not None:
|
||||||
async with pipeline_status_lock:
|
async with pipeline_status_lock:
|
||||||
|
|
@ -1487,7 +1487,7 @@ async def _rebuild_single_relationship(
|
||||||
raise # Re-raise exception
|
raise # Re-raise exception
|
||||||
|
|
||||||
# Log rebuild completion with truncation info
|
# Log rebuild completion with truncation info
|
||||||
status_message = f"Rebuild `{src} - {tgt}` from {len(chunk_ids)} chunks"
|
status_message = f"Rebuild `{src}`~`{tgt}` from {len(chunk_ids)} chunks"
|
||||||
if truncation_info:
|
if truncation_info:
|
||||||
status_message += f" ({truncation_info})"
|
status_message += f" ({truncation_info})"
|
||||||
# Add truncation info from apply_source_ids_limit if truncation occurred
|
# Add truncation info from apply_source_ids_limit if truncation occurred
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue