feat:客户agent以及记忆模块功能开发

This commit is contained in:
2026-09-11 22:38:15 +08:00
parent 0197ac2ef2
commit 4da4775e8c
39 changed files with 2508 additions and 14 deletions
+34
View File
@@ -0,0 +1,34 @@
"""客服 Agent 记忆上下文组装。"""
from __future__ import annotations
from service.memory.schemas import CustomerMemoryContext, MemoryUnitDTO, ShortTermMessage
def build_customer_memory_context(
*,
customer_id: int,
session_id: str,
short_term_messages: list[ShortTermMessage],
customer_profile: dict | None,
work_orders: list[dict],
long_term_memories: list[MemoryUnitDTO],
customer_relations: list[dict] | None = None,
customer_products: list[dict] | None = None,
warnings: list[str] | None = None,
) -> CustomerMemoryContext:
"""构造稳定的客服记忆上下文结构。"""
return CustomerMemoryContext(
customer_id=customer_id,
session_id=session_id,
short_term_messages=short_term_messages,
customer_profile=customer_profile,
work_orders=work_orders,
long_term_memories=long_term_memories,
customer_relations=customer_relations or [],
customer_products=customer_products or [],
warnings=warnings or [],
)
__all__ = ["build_customer_memory_context"]