feat(nav): Enhance product API with historical NAV tracking and new charting features

- Updated `ready.py` to include a health check for the new `products_nav_history` endpoint, ensuring system readiness.
- Enhanced the `ProductNavChartPanel` component to visualize historical NAV data with various charting options, including line and column charts.
- Introduced new utility functions for filtering and aggregating NAV data, improving data handling in the frontend.
- Updated tests to verify the inclusion of the new `products_nav_history` check in the API response.
- Improved documentation to reflect recent changes and the new testing baseline of 833 passed tests, indicating enhanced stability.

This update significantly improves the product API by providing access to historical NAV data and enhancing user insights through visualizations.
This commit is contained in:
2026-09-11 21:38:54 +08:00
parent 2b4eaa9725
commit d4a2461ba4
16 changed files with 5975 additions and 5328 deletions
+2 -1
View File
@@ -33,5 +33,6 @@
| 2026-09-11 | **TEST-RISK-001 修复**:`RiskListAccess`/`ThresholdWriteAccess` · service_risk 只读 GET · compliance 进 risk 矩阵 · STAFF-31001 · handled 筛选 · 台账 stats · 前端标签/409/结构化 · SSE ping · **825 pytest** | 沙盘 TEST-LOG v1.1 | `repo_access` · `risk.py` · `deps.py` · web risk pages |
| 2026-09-11 | **问数 N-03/N-07 + 自检**:`GET .../sample` · `POST /escalate` · `GET /api/ready` · DevReadyBanner | Superpowers 批次 | `analyst.py` · `ready.py` · web |
| 2026-09-11 | **TEST-AN-001 RBAC 修复**:sql_guard A/B · `_audit_terminal` · TEST-LOG v1.2 · **820 pytest** | 沙盘测试文档 | `sql_guard` · `analyst_agent` |
| 2026-09-11 | **行情历史种子入库**:`07-seed-nav-history.sql`(5096 行)· `nav/history` API + RBAC · 前端 `/app/market/:productId` · **833 pytest** | 用户要近一年趋势 Demo | `scripts/core` · `products.py` · `core_ro` · web · MEMORY |
| 2026-09-11 | **行情历史种子入库**:`07-seed-nav-history.sql` · `nav/history` API · **833 pytest** | 近一年 Demo | `scripts/core` · MEMORY |
| 2026-09-11 | **行情详情图表**:时间轴 scale · Y domain · 1M~ALL/日周/走势·柱·组合 · **26 Vitest** · ready+restart-dev 防旧后端 | 轴与平台能力 | web · MEMORY |
| 2026-09-10 | **TODO 日终清单 + 优化 TODO 补全**:硬伤盘点落账 · 2026-09-10 已完成/进行中/将要做 | 用户要求 | TODO · ITERATION |
+4 -4
View File
@@ -9,7 +9,7 @@
**项目是什么:** 金融四 Agent(客户财富 / 代理人 / 数据分析 / 风控)共用数据层与合规底座;**不**互调 LLM,跨 Agent 走 L1/L2/L3 画像与预警表。
**当前进度:** 需求与表设计已定 · **风控 TEST-RISK-001(含 F12)** · **833 pytest** · **22 Vitest** · **Redis @ 6380** · **`merger` 未 commit** · **⚠️ 代理人 Agent 未完整接入**(顾问 Chat 骨架在,T-20/A 线未做,答辩勿作主 Demo)
**当前进度:** 需求与表设计已定 · **833 pytest** · **26 Vitest** · **Redis @ 6380** · **`merger` 未 commit** · **⚠️ 代理人 Agent 未完整接入**
**工作分支:** 团队开发在 **`merger`**;历史 `risk-control-agent` 交付冻结。
@@ -62,7 +62,7 @@
| `docs/项目框架设计/接口契约-代销平台API-v0.2-行情扩展草案.md` | **草案(2026-09-09)** | `nav-snapshot` · `sync_market_nav` · 前端产品行情 Phase B |
| `docs/项目框架设计/表设计/` | 已定 | Agent 共用 11 表 + agent 专用 SQL |
| `docs/项目框架设计/Core模拟底座/` | 已定 | 无真实 Core 时的 L0 方案 |
| `web/` | **P0 Demo 齐备 + 行情详情(2026-09-11)** | 四角色 Dashboard/Chat · **`/app/market/:productId` 近一年净值曲线** · ChatPanel 流式 · 清单见 `docs/整体测试/前端整体测试交接.md` |
| `web/` | **P0 + 行情详情图表(2026-09-11)** | **`/app/market/:productId`**:时间区间/日周粒度/走势·涨跌柱·组合图 · 时间轴 scale · **DevReadyBanner 防旧后端假绿** · `restart-dev.ps1` 校验 `nav/history` |
**本地 bootstrap(首次):** 完整步骤与前置说明见 `FLOW.md` §0(权威),速览:
@@ -175,7 +175,7 @@ audit_log 等审计表(只 INSERT)
| **C-07** | 风评查询走 Core;**「重新测评/重做风评」** → 引导 App/网点(Agent 内不做问卷) | `customer_prompts._RISK_KW` |
| **C-08** | 仅 L1 槽位 `investment.allocation_target`(13 槽);**无自动偏离检测/调仓** | `profile_slots.py` |
| **问数 vs 分析对话** | 问数页 + **`/interpret`** · **N-03 抽样溯源** · **N-07 escalate/失败转人工** · 分析对话 URL **重定向问数** | spec `2026-09-11-query-interpret-split-design.md` |
| **客户「趋势/走势」** | **客户 Chat**:仅 **C-05 最新净值快照** + 持仓/流水;**走势预测/实时盘口 reject** · **平台「产品行情」**:列表 + **`GET nav/history` 详情折线**(customer/advisor/analyst/风控可读;compliance 无菜单/API 403)· **无 Chat 内历史曲线 Tool** · 统计类趋势 → **问数** `self` 域 · **D-12 看板钻取未做** | Phase B 外部 sync 未做 |
| **客户「趋势/走势」** | **平台行情详情**:`nav/history` + **区间(1M~ALL)/粒度(日周)/图型(走势/涨跌柱/组合)** · Chat 仍无历史 Tool · Phase B 外部 sync 未做 | 见 `web/src/utils/navChartSeries.ts` |
| **L0 优先** | 抽槽与 L0 撞车**永远听 L0**;L1 只 enrich 措辞 | `profile_slots` D7 |
------
@@ -192,7 +192,7 @@ Core 模拟:scripts/core/reset.ps1 · 文档 docs/项目框架设计/Core模
Redis:`docker compose up -d redis` · `REDIS_URL=redis://127.0.0.1:6380/0` · `scripts/dev/start-redis.ps1`
测试:python -m pytest(**833 绿**;集成需本机 MySQL + AML + 风控演示数据)
风控沙盘:`python scripts/dev/sandbox_risk_test.py`(TEST-RISK-001)
前端:cd web && npm run dev · npm run build/test/lint(**22** Vitest)· 四角色 Demo 见 `docs/frontend/FRONTEND-HANDOFF.md` §8
前端:cd web && npm run dev · npm run build/test/lint(**26** Vitest)· 四角色 Demo 见 **`docs/frontend/FRONTEND-HANDOFF.md` §8** · 本地后端 **`scripts/dev/restart-dev.ps1 -Backend Local`**
问数模板:mysql … < scripts/agent/seed-analyst-query-templates.sql
风控一键灌库:.\scripts\demo\prepare_all.ps1
运维/演示脚本:scripts/demo/subscribe_alerts.py(订阅推送演示)· rebuild_alerts.py TRD-xxx(引擎异常补偿重放)
+1 -1
View File
@@ -60,7 +60,7 @@
| C-02 | 产品规则咨询 | fin_product RAG + 免责 | **已实现** · Wave1~2 | — |
| C-03 | 政策/FAQ | fin_policy / fin_faq RAG | **已实现** · Wave1~2 | — |
| C-04 | 亏损阈值提醒 | `customer_threshold_config` + 持仓查询追加提醒 | **已实现(2026-09-10)** · `threshold_service` | ~~T-40~~ |
| C-05 | 产品净值 | Core 最新净值快照;禁止实时盘口 | **已实现(2026-09-10)** · Chat `nav_query` · **平台 `GET …/nav/history` + 行情详情页近一年曲线(2026-09-11)** · Chat 仍无历史走势 Tool · Phase B 外部 sync 未做 | ~~T-40~~ |
| C-05 | 产品净值 | Core 快照;禁止实时盘口 | **已实现** · Chat `nav_query` · 平台 **`nav/history` 详情**(区间 1M~ALL · 日/周 · 走势/涨跌柱/组合 · 时间轴)· Phase B sync 未做 | ~~T-40~~ |
| C-07 | 风评查询 / 重测引导 | Core L0;重测引导 App/网点 | **部分已实现** · 无 Agent 内问卷 | T-41 |
| C-08 | 配置目标 | L1 槽 `allocation_target` | **部分已实现** · 无偏离检测/调仓 | T-41 |
| C-11 | 适当性匹配说明 | 非营销推荐;联动 R-02 | **部分已实现** · 「我能买什么」→ suitability;「推荐稳赚」仍 reject | T-42 |