Files
2026-09-14 11:54:20 +08:00

31 lines
881 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""工作台到投顾 Agent 的客户数据查询代理。"""
from __future__ import annotations
from sqlalchemy.ext.asyncio import AsyncSession
from model.sys_user import SysUser
from schemas.advisor import AdvisorDataQueryReq
from service.advisor.agent_client import get_agent_client
async def query_customer_data(
db: AsyncSession,
user: SysUser,
*,
auth_header: str,
trace_id: str,
req: AdvisorDataQueryReq,
) -> dict:
"""先做工作台归属校验,再透传到 Agent;customer_id 不由 Agent 客户端覆盖。"""
payload = req.model_dump(exclude_none=True)
result = await get_agent_client().data_query(
payload,
auth_header=auth_header,
trace_id=trace_id,
)
data = result["data"] or {}
data.pop("sql", None)
if result["warning"]:
data["warning"] = result["warning"]
return data