refactor(memory): add PilotWritePipeline and enrich extraction schema

- Add dedicated PilotWritePipeline (statement → triplet → graph_build → layer-1 dedup, no Neo4j write)
- Add type_description/predicate_description fields across entity and triplet models, Cypher queries, and graph builders
- Refactor data_pruning with LRU cache and snapshot support; skip assistant chunks in extraction
- Remove strict Predicate enum whitelist; support statement_text alias in legacy extractor
- Wire PipelineSnapshot through preprocessing and emotion extraction for debug tracing
- Add PILOT_RUN_USE_REFACTORED_PIPELINE env toggle for pipeline selection
This commit is contained in:
lanceyq
2026-04-27 18:15:46 +08:00
parent b0ddd12cc6
commit 2355536b44
23 changed files with 806 additions and 1070 deletions

View File

@@ -44,6 +44,7 @@ async def save_entities_and_relationships(
'source_id': edge.source,
'target_id': edge.target,
'predicate': edge.relation_type,
'predicate_description': edge.relation_type_description,
'statement_id': edge.source_statement_id,
'value': edge.relation_value,
'statement': edge.statement,
@@ -297,6 +298,7 @@ async def save_dialog_and_statements_to_neo4j(
'source_id': edge.source,
'target_id': edge.target,
'predicate': edge.relation_type,
'predicate_description': edge.relation_type_description,
'statement_id': edge.source_statement_id,
'value': edge.relation_value,
'statement': edge.statement,