feat(api)!: memory single chain — async MemoryService, strict eval closure
Route all memory ingest/retrieve/enrichment/compaction through async MemoryService. Remove legacy sync memory implementations (ingest/retrieve/compaction); Celery and memoir Phase2 call asyncio.run into MemoryService-backed helpers. Memoir Phase1 batch ingest uses MemoryService.ingest_transcripts_batch; drop chapters. evidence_bundle_json mirror (Alembic 0015). Evaluation uses snapshot/link-only bundles; raise EvidenceClosureMissing instead of partial/fallback lineage tiers. Split memoir state into NarrativeCoverageState and InterviewControlState; delete the _interview_meta_store adapter layer. Remove rolling-query and recent-fact fallback settings from config and evidence assembly. Update judges, docs, tests, and PlaygroundPage alignment. Made-with: Cursor
This commit is contained in:
@@ -5,13 +5,18 @@ from __future__ import annotations
|
||||
import re
|
||||
from collections.abc import Iterable
|
||||
|
||||
# 与 `apply_duplicate_question_guard` 中整段替换句一致;用于判定是否需触发二次生成。
|
||||
DUPLICATE_QUESTION_GUARD_FALLBACK_ZH = "这一段我记住了。"
|
||||
|
||||
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
|
||||
from langchain_core.messages import AIMessage, BaseMessage
|
||||
|
||||
from app.agents.stage_constants import STAGE_DISPLAY_ZH, STAGE_SLOT_KEYS
|
||||
from app.agents.state_schema import KnownFact, MemoirStateSchema, PersonaThread
|
||||
from app.agents.state_schema import (
|
||||
KnownFact,
|
||||
MemoirStateSchema,
|
||||
PersonaThread,
|
||||
narrative_coverage_state,
|
||||
)
|
||||
|
||||
# 与 `apply_duplicate_question_guard` 中整段替换句一致;用于判定是否需触发二次生成。
|
||||
DUPLICATE_QUESTION_GUARD_FALLBACK_ZH = "这一段我记住了。"
|
||||
|
||||
_QUESTION_SPLIT_RE = re.compile(r"[??]+")
|
||||
_SENTENCE_SPLIT_RE = re.compile(r"(?<=[。!?!?])")
|
||||
@@ -220,10 +225,11 @@ def build_runtime_interview_state(
|
||||
)
|
||||
|
||||
persona_additions: list[PersonaThread] = []
|
||||
narrative_state = narrative_coverage_state(state)
|
||||
haystack = " ".join(
|
||||
[msg]
|
||||
+ [fact.value for fact in state.known_facts[-8:]]
|
||||
+ list(state.filled_slots_for_stage(active_stage).values())[:4]
|
||||
+ list(narrative_state.filled_slots_for_stage(active_stage).values())[:4]
|
||||
)
|
||||
for trait, markers in _TRAIT_HINTS:
|
||||
for marker in markers:
|
||||
|
||||
Reference in New Issue
Block a user