Files
group_xinghuo_jinrong/docs/superpowers/specs/2026-09-13-customer-trade-design.md
zhanghongyu_0626 647c07062e feat(trade): Enhance trade processing and context handling in customer service
- Introduced `pending_trade` handling in the chat API to manage trade requests more effectively.
- Updated the `submit_trade_api` to allow advisors to access customer trades based on assigned roles.
- Added new methods in `GatewayRepository` for managing core holdings during trade subscriptions and redemptions.
- Implemented context-aware trade dialogue management in the customer service layer to improve user experience during multi-turn interactions.
- Enhanced the tool service to support trade actions and suitability checks, ensuring accurate processing of user requests.

This update significantly improves the trade interaction flow, providing a more robust and user-friendly experience for customers engaging in trading activities.
2026-09-13 17:45:04 +08:00

1.8 KiB
Raw Permalink Blame History

客户/顾问交易与弹窗确认 · 设计 spec

状态:已拍板(2026-09-13)· 确认流 A:不在聊天框打字确认;意图命中后 SSE 携带 pending_trade,前端 Modal 展示明细,用户点确认后 POST /api/simulate/trade。

目标

  1. 客户 App:交易中心页(申购 / 赎回 / 转换)+ 客户助手意图 → 弹窗确认 → 网关下单。
  2. 顾问助手:同名弹窗流程;HTTP 鉴权扩展为 已归属 advisor 可对绑定客户提交 simulate。
  3. 表域:写 core_trade / convert 受理仍仅经 trade_gateway.submit_trade / accept_convert;对话 Tool 只解析,不 INSERT Core。

后端

单元 职责
trade_action_service.py 从用户句解析 TradeDraft(规则 + 可选 LLM);解析产品 core_ro.find_products;输出 API payload + display
customer_service 新意图 trade_action;节点 trade_prepare 设 pending_trade;回复引导看弹窗
trade_tools.prepare_simulate_trade 顾问线 Tool:同上解析,返回 pending_confirmation
simulate.py 鉴权 + advisor 且 is_advisor_assigned
chat.py SSE meta.pending_trade(客户 prepare_customer_stream;顾问 stream_chat 扩展)

前端

单元 职责
TradeConfirmModal 展示类型/产品/金额或份额/客户;确认调 submitSimulateTrade
parseChatStream / useChatPanel 解析并打开 Modal
CustomerTradePage 菜单 + 三 Tab 表单
simulate.ts subscribe amount / redeem qty / convert 字段

合规

  • 不在聊天内「确认申购」文字即下单;仅 Modal 按钮触发 POST。
  • LLM 回复仍遵守 AI-006;弹窗为 人点击 的明示同意。

不测范围

  • 不改 FR-1 risk_demo 演示账号行为;不新增 /api/orders。