feat(analyst): Enhance dashboard metrics and customer service interactions
- Updated the `dashboard` function in `analyst.py` to include additional metrics for different user roles, improving data visibility for analysts, customers, advisors, and risk officers. - Introduced a new `prepare_customer_stream` function in `customer_service.py` to facilitate streaming responses for customer interactions, enhancing the chat experience. - Added new API endpoints in `analyst.ts` for fetching dashboard metrics and managing analyst assets, streamlining data handling and user interactions. - Updated frontend components to support new dashboard features and asset management, ensuring a cohesive user experience across the application. This update significantly improves the functionality and usability of the analyst and customer service features, providing users with enhanced tools for data analysis and interaction.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
-- 数据分析 Agent · 口径字典演示种子(P2)
|
||||
-- 执行:jinrong_agent 库 · migrate-analyst-d07-d11.sql 已跑后
|
||||
USE jinrong_agent;
|
||||
|
||||
INSERT INTO analytics_metric_dict
|
||||
(metric_key, metric_name, aliases, definition, formula, applicable_tables, default_time_window, unit, status, version, created_by, published_by)
|
||||
VALUES
|
||||
(
|
||||
'holding_scale',
|
||||
'持仓规模',
|
||||
JSON_ARRAY('规模', '市值', '总资产'),
|
||||
'客户当前持仓市值合计(Core 模拟库 core_holding.market_value 求和)',
|
||||
'SUM(market_value)',
|
||||
JSON_ARRAY('core_holding'),
|
||||
'as_of 最新',
|
||||
'元',
|
||||
'published',
|
||||
1,
|
||||
'STAFF-20001',
|
||||
'STAFF-20001'
|
||||
),
|
||||
(
|
||||
'trade_count_30d',
|
||||
'近30日交易笔数',
|
||||
JSON_ARRAY('交易笔数', '流水笔数'),
|
||||
'近 30 个自然日内 core_trade 记录数(按 trade_date)',
|
||||
'COUNT(*) WHERE trade_date >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)',
|
||||
JSON_ARRAY('core_trade'),
|
||||
'近30天',
|
||||
'笔',
|
||||
'published',
|
||||
1,
|
||||
'STAFF-20001',
|
||||
'STAFF-20001'
|
||||
),
|
||||
(
|
||||
'pending_alerts',
|
||||
'待处理预警数',
|
||||
JSON_ARRAY('待审预警', 'pending'),
|
||||
'risk_alert 表中 status=pending_review 的记录数',
|
||||
'COUNT(*) WHERE status=''pending_review''',
|
||||
JSON_ARRAY('jinrong_agent.risk_alert'),
|
||||
'实时',
|
||||
'条',
|
||||
'published',
|
||||
1,
|
||||
'STAFF-20001',
|
||||
'STAFF-20001'
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
metric_name = VALUES(metric_name),
|
||||
status = VALUES(status),
|
||||
updated_at = CURRENT_TIMESTAMP(3);
|
||||
@@ -15,8 +15,8 @@
|
||||
| STAFF-10091 | advisor, compliance | 双角色权限并集 |
|
||||
| STAFF-20001 | analyst | 分析 Agent |
|
||||
| STAFF-20002 | analyst | 分析 Agent |
|
||||
| STAFF-30001 | risk_officer | 风控 Agent |
|
||||
| STAFF-30002 | risk_officer | 风控 Agent |
|
||||
| STAFF-30001 | risk_officer, **risk_demo** | 风控 Agent · 模拟交易演示 |
|
||||
| STAFF-30002 | risk_officer, **risk_demo** | 风控 Agent |
|
||||
| STAFF-40001 | compliance | 合规审计台 |
|
||||
| STAFF-40002 | compliance | 合规审计台 |
|
||||
| STAFF-50001 | ops | 运营统计 A-08 |
|
||||
|
||||
Reference in New Issue
Block a user