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
This commit is contained in:
Kevin
2026-04-30 09:17:01 +08:00
parent eddb2c3078
commit ac436b87a2
37 changed files with 1400 additions and 199 deletions

View File

@@ -6,6 +6,7 @@ import json
from typing import Any
from app.core.langchain_llm import ainvoke_json_object, invoke_json_object
from app.core.llm_gateway import LlmGateway, LlmUseCase
from app.core.logging import get_logger
from app.features.memory.llm_schemas import (
TimelineEventsPayload,
@@ -70,7 +71,7 @@ async def build_timeline_events_from_facts_async(
async def build_timeline_events(facts: list[dict]) -> list[dict]:
"""兼容旧接口。"""
from app.core.dependencies import get_llm_provider_fast
llm = get_llm_provider_fast().langchain_llm
llm = LlmGateway().langchain_llm_for(
LlmUseCase("memory.timeline_events.compat", fast=True)
)
return await build_timeline_events_from_facts_async(llm, facts)