Files
group_xinghuo_jinrong/docs/memory/ENVIRONMENT.md
T
zhanghongyu_0626 a0f550646e feat(analyst): Add analyze endpoint and chart specification validation
- Introduced a new `/analyze` endpoint in the analyst API to process analysis requests, allowing users to receive textual interpretations and chart specifications based on provided prompts.
- Enhanced `analyst_schemas.py` with `AnalyzeRequest` and `ChartSpec` models to structure analysis requests and validate chart specifications.
- Implemented chart validation logic in a new `analyst_chart.py` service, ensuring that chart types and fields are correctly specified and conform to allowed values.
- Updated `AnalystAgent` to handle analysis requests, integrating the new logic for generating responses based on user prompts and data availability.
- Added unit tests to verify the functionality of the new endpoint and validation mechanisms, ensuring robustness and reliability.

This update significantly enhances the analytical capabilities of the application, providing users with improved tools for data interpretation and visualization.
2026-09-12 12:33:37 +08:00

3.1 KiB
Raw Blame History

服务对象大环境(现状 / As-Is)

来源:docs/需求拆解/业务场景优先级清单.md、docs/需求拆解/用户故事/
Core 说明: 生产环境应以真实 Core 为 L0 权威;本项目无真实 Core,开发用 jinrong_core 模拟库(见 docs/项目框架设计/Core模拟底座/)。


1. 服务对象与角色(现在)

角色 谁 在环境里干什么
C 端客户 公募投资者 看持仓、查产品、交易;正式 C1~C5 在测评系统
理财代理人 一线理财经理 服务名下客户、多系统查持仓、讲解规则、跟进
内部员工 分析、运营、合规 问数、报表、抽检会话、协同风控
风控 / 合规官 风控专员 监测大额/适当性/AML;人工审核,不自动冻户

L0 权威来源(本项目): MySQL jinrong_core 模拟库 — 客户、C1~C5、持仓、流水、产品、代理人-客户归属。Agent 代码经 CoreReadOnlyRepository 只读 SELECT,不提供 HTTP Core API。


2. 对方现在怎么办事

  • 客户:App/柜台看持仓;亏损无 Agent 式阈值提醒。
  • 代理人:多后台手工汇总;话术自写,合规靠事后检查。
  • 内部分析:SQL 或 IT 导表。
  • 风控:事后/T+1 发现异常;适当性靠交易前规则;AML 批处理或人工。

Agent 尚未上线;后端已在 merger 分支集成:python -m pytest → 861 passed, 1 skipped · web Vitest 27(2026-09-12);问数见 TEST-LOG-2026-09-12-AN-002。


3. 主路径(现状 → 模拟后)

  1. 开户/测评 → Core(模拟:core_customer + core_customer_risk)写 L0
  2. 交易 → Core 流水(模拟:core_trade);交易前适当性 R-02 已实现(模拟网关 app/gateway/ + service/suitability.py,唯一阻断点)
  3. 同步 → sync_advisor_rel.py 写入 agent 库 customer_advisor_rel;sync_neo4j.py 灌关系图
  4. 代理人服务 → 查 Core RO + 口头沟通(L2 画像表待业务实现)
  5. 风控 → 规则/人工台账;合规事后抽检

4. 环境里的关键对象

名称 含义 本项目存储
L0 正式档案 customer_id、C1~C5、年龄、职业、advisor jinrong_core.core_*
持仓/流水 产品、份额、盈亏 core_holding / core_trade
代理人-客户归属 服务关系 Core 种子 → 同步 jinrong_agent.customer_advisor_rel
Agent 会话/画像/审计 平台业务数据 jinrong_agent(11 共用表 + agent 专用表)

5. 痛点与约束

痛点:客户看不清持仓与规则;代理人多系统慢、话术易违规;问数靠 SQL;风控感知滞后
不能动:正式 C1~C5 仅测评/人工变更;事实账以 Core 为准(模拟库亦只读);监管要求审计与适当性
模拟边界:不模拟 TA/清算/报盘;**净值 365 日与模拟宽基同向(beta)** · 交易 05+08 跨月 · 持仓为单日快照 · Neo4j 由同步脚本维护