Files
life-echo/api/app/features/memory/prompt_adapter.py
Kevin ac436b87a2 feat(api): 收敛对话与记忆流程边界,引入 LLM 网关与专用服务
- MemoryService 异步路径委托 MemoryIngestService / MemoryRetrievalService;富化派发经 MemoryEnrichmentScheduler
- WebSocket pipeline 经 ChatTurnService 与显式 DTO 编排单轮对话;回忆录片段入队由 MemoirIngestScheduler 封装
- 新增 LlmGateway(LlmUseCase),各 agent、任务与适配器对齐 ports
- 补充 memory 提示适配、runtime 类型、memory-retrieval 文档、ai-touchpoints 说明与扫描脚本及配套测试

Made-with: Cursor
2026-04-30 09:17:01 +08:00

27 lines
749 B
Python

"""Memory-to-prompt adapter boundary."""
from __future__ import annotations
from typing import Any, Mapping
from app.features.memory.chat_memory_injection import (
InterviewMemorySlices,
slice_interview_memory,
)
from app.features.memory.runtime_types import MemoryEvidenceBundle
class MemoryPromptAdapter:
"""Converts retrieved evidence into prompt-specific slices."""
def slice_for_interview(
self,
evidence: MemoryEvidenceBundle | Mapping[str, Any] | None,
user_message: str,
) -> InterviewMemorySlices:
raw = evidence.raw if isinstance(evidence, MemoryEvidenceBundle) else evidence
return slice_interview_memory(dict(raw or {}), user_message)
__all__ = ["MemoryPromptAdapter"]