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

@@ -17,7 +17,7 @@ from app.features.auth import repo as auth_repo
from app.features.conversation.models import Conversation
from app.features.conversation.service import ConversationService
from app.features.conversation.ws.pipeline import (
background_runner,
memoir_ingest_scheduler,
process_user_message,
)
from app.features.evaluation.errors import (
@@ -160,10 +160,11 @@ class ReplayConversationService:
segment_ids.append(segment.id)
ts = segment.created_at or conv.last_message_at
if not skip_memoir:
await background_runner.queue_message(
await memoir_ingest_scheduler.queue_segment(
conv.user_id,
segment.id,
text_char_count=len(text),
trigger="evaluation_replay",
)
await process_user_message(
conversation_id=cid,
@@ -178,7 +179,10 @@ class ReplayConversationService:
count += 1
if flush_memoir_after and conv.user_id and (not skip_memoir):
await background_runner.flush_pending(conv.user_id)
await memoir_ingest_scheduler.flush_pending(
conv.user_id,
trigger="evaluation_replay",
)
logger.info(
"eval replay done conversation_id={} turns={} flush={} skip_memoir={} skip_tts={}",