Files
Mutual_Fund/service/memory/context_builder.py
T

37 lines
1.2 KiB
Python
Raw Normal View History

"""客服 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,
2026-09-14 00:19:31 +08:00
composed_profile: 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,
2026-09-14 00:19:31 +08:00
composed_profile=composed_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"]