feat: 接入运维真实数据与三角色权限链路

- 新增 model_deploy 与 model_operations 双库查询,支持模型列表、模型详情、单月监控结果和运维工作台真实接口。

- 关闭运维模块生产 Mock 数据,补充缺表/空数据降级、工作台空状态和首条纵向链路测试。

- 按业务团队、模型团队、管理员权限矩阵接入菜单、页面、操作按钮和后端接口权限校验,支持 business_team 角色。

- 更新工作台布局、深色欢迎卡片、全宽页面适配、顶部回退,以及权限分组展示。

- 新增架构实现基线、周目标完成情况和角色权限矩阵初始化 SQL 文档。
This commit is contained in:
郑龙捷
2026-09-02 15:02:47 +08:00
parent 6d044784ec
commit 74dd97428f
51 changed files with 2142 additions and 1062 deletions
@@ -37,65 +37,17 @@ export const CATEGORY_THRESHOLDS: Record<ModelCategoryId, ThresholdConfig | null
afd: null,
};
export const MONITORING_RULES: MonitoringRule[] = [
{ id: 1, ranking: "不符", ksBand: "<40%", psiBand: ">10%", dropBand: "无条件", abnormal: "三级", grade: "C", reason: "排序性不符 + KS 偏低 + PSI 偏移", action: "诊断报告,评估模型微调或重构必要性" },
{ id: 2, ranking: "相符", ksBand: "<40%", psiBand: ">25%", dropBand: "无条件", abnormal: "三级", grade: "C", reason: "KS 偏低 + PSI 明显偏移", action: "诊断报告,评估模型微调或重构必要性" },
{ id: 3, ranking: "不符", ksBand: ">=40%", psiBand: ">25%", dropBand: "无条件", abnormal: "二级", grade: "B", reason: "排序性不符、PSI 高", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 4, ranking: "不符", ksBand: ">=40%", psiBand: "10%-25%", dropBand: ">20%", abnormal: "二级", grade: "B", reason: "排序性不符、PSI 中、KS 环比降幅高", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 5, ranking: "不符", ksBand: "<40%", psiBand: "<=10%", dropBand: "无条件", abnormal: "二级", grade: "B", reason: "排序性不符、KS 低", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 6, ranking: "相符", ksBand: "<40%", psiBand: "<=25%", dropBand: "无条件", abnormal: "二级", grade: "B", reason: "KS 低", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 7, ranking: "相符", ksBand: ">=40%", psiBand: ">25%", dropBand: ">20%", abnormal: "二级", grade: "B", reason: "PSI 高、KS 环比降幅高", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 8, ranking: "不符", ksBand: ">=40%", psiBand: "10%-25%", dropBand: "<=20%", abnormal: "一级", grade: "B", reason: "排序性不符 + PSI 轻度偏移", action: "诊断报告" },
{ id: 9, ranking: "不符", ksBand: ">=40%", psiBand: "<=10%", dropBand: "无条件", abnormal: "一级", grade: "B", reason: "排序性不符", action: "诊断报告" },
{ id: 10, ranking: "相符", ksBand: ">=40%", psiBand: ">25%", dropBand: "<=20%", abnormal: "一级", grade: "B", reason: "PSI 明显偏移", action: "诊断报告" },
{ id: 11, ranking: "相符", ksBand: ">=40%", psiBand: "10%-25%", dropBand: "无条件", abnormal: "一级", grade: "B", reason: "PSI 轻度偏移", action: "诊断报告" },
{ id: 12, ranking: "相符", ksBand: ">=40%", psiBand: "<=10%", dropBand: ">20%", abnormal: "一级", grade: "B", reason: "KS 环比下滑明显", action: "诊断报告" },
{ id: 13, ranking: "相符", ksBand: ">=40%", psiBand: "<=10%", dropBand: "<=20%", abnormal: "正常", grade: "A", reason: "各项指标均在阈值内", action: "监控报告" },
];
export const MONITORING_RULES: MonitoringRule[] = [];
export const RULE_VERSIONS = [
{ version: "V3", category: "全部大类", author: "管理员 王芳", createdAt: "2026-07-02 10:24", current: true, note: "新增 KS 环比降幅维度" },
{ version: "V2", category: "全部大类", author: "管理员 王芳", createdAt: "2026-03-15 14:08", current: false, note: "PSI 分档由两档改三档" },
{ version: "V1", category: "全部大类", author: "管理员 王芳", createdAt: "2025-11-20 09:41", current: false, note: "初版" },
];
export const RULE_VERSIONS: Array<{ version: string; category: string; author: string; createdAt: string; current: boolean; note: string }> = [];
export const PROMPTS = {
A: {
name: "监控报告模板(A 等级)",
text: `你是一名信贷风险模型分析师。请依据平台程序取数的指标,撰写月度模型监控报告。\n\n【硬性要求】\n1. 所有数值只使用给定值,禁止自行计算。\n2. 正文不得出现 A/B/C 等级、判级或评级字样。\n3. 仅撰写监控结论、排序性、KS、PSI 四节。\n4. 语气客观,不做超出数据的推断。\n\n【平台注入变量】\n银行:{{bank}}\n模型名称:{{model_name}}\n模型版本:{{model_ver}}\n模型ID{{model_id}}\n报告周期:{{period}}\n排序性:{{rank_result}}\nKS{{ks}}%\nKS 环比降幅:{{ks_drop}}%\nPSI(滚动基准期):{{psi_roll}}%\n近 6 期趋势:{{trend_6m}}`,
},
BC: {
name: "诊断报告模板(B / C 等级)",
text: `你是一名信贷风险模型分析师。请依据平台程序取数的指标,撰写月度模型诊断报告。\n\n【硬性要求】\n1. 所有数值只使用给定值,禁止自行计算。\n2. 正文不得出现 A/B/C 等级、判级或评级字样。\n3. 结构包含监控结论、排序性、KS、PSI、IV、CSI、归因与建议。\n4. 归因只能基于命中规则与特征级指标,不得臆测业务原因。\n\n【平台注入变量】\n银行:{{bank}}\n模型名称:{{model_name}}\n模型版本:{{model_ver}}\n模型ID{{model_id}}\n报告周期:{{period}}\n排序性:{{rank_result}}\nKS{{ks}}%\nKS 环比降幅:{{ks_drop}}%\nPSI(滚动):{{psi_roll}}%\n命中规则:{{hit_rule}}\n异常等级:{{ab_level}}\n近 6 个月二级次数:{{lv2_6m}}\n特征级 IV{{iv_by_feature}}\n特征级 CSI{{csi_by_feature}}\n各特征分布变化:{{dist_shift}}`,
},
} as const;
export type PromptKey = "A" | "BC";
export const PROMPTS: Partial<Record<PromptKey, { name: string; text: string }>> = {};
export const PROMPT_VERSIONS = [
{ version: "P5", author: "模型团队 李伟", createdAt: "2026-08-02 15:20", current: true, note: "加入禁止自行计算硬约束" },
{ version: "P4", author: "模型团队 李伟", createdAt: "2026-06-11 10:05", current: false, note: "正文禁止出现等级字样" },
{ version: "P3", author: "模型团队 王芳", createdAt: "2026-04-08 16:48", current: false, note: "归因段落收敛,禁止臆测业务原因" },
];
export const PROMPT_VERSIONS: Array<{ version: string; author: string; createdAt: string; current: boolean; note: string }> = [];
export const PROMPT_REGRESSION = [
{ sample: "2026-06 江城银行 标准A卡", result: "通过", detail: "数值一致,无等级字样" },
{ sample: "2026-06 通汇银行 标准A卡", result: "通过", detail: "数值一致,归因引用命中规则" },
{ sample: "2026-05 华东银行 反欺诈评分", result: "通过", detail: "—" },
{ sample: "2026-05 南岭银行 白户A卡", result: "待复核", detail: "CSI 表述偏笼统" },
{ sample: "2026-04 云岭银行 标准A卡", result: "通过", detail: "—" },
];
export const PROMPT_REGRESSION: Array<{ sample: string; result: string; detail: string }> = [];
export const TEMPLATE_VERSIONS = [
{ version: "T4", author: "管理员 王芳", createdAt: "2026-08-01 16:30", current: true, note: "诊断报告增加 IV / CSI 段落" },
{ version: "T3", author: "管理员 王芳", createdAt: "2026-05-18 11:12", current: false, note: "隐藏监控结果等级字样" },
{ version: "T2", author: "管理员 王芳", createdAt: "2026-02-09 09:55", current: false, note: "调整排序性图表位置" },
];
export const TEMPLATE_VERSIONS: Array<{ version: string; author: string; createdAt: string; current: boolean; note: string }> = [];
export const BANK_REPORT_CONFIG: Record<string, { frequency: string; day: number }> = {
: { frequency: "月度", day: 15 },
: { frequency: "月度", day: 15 },
: { frequency: "月度", day: 18 },
: { frequency: "季度", day: 15 },
: { frequency: "月度", day: 20 },
: { frequency: "半年度", day: 15 },
: { frequency: "年度", day: 15 },
};
export const BANK_REPORT_CONFIG: Record<string, { frequency: string; day: number }> = {};