feat(ai): Copilot 评分引擎 + Handler + 路由 + 权限码

- scoring.rs: 混合评分 (calculate_risk) + RiskScore/MatchedRule 结构
- engine.rs: CopilotEngine 协调规则评估和评分
- risk_service.rs: 风险计算 + UPSERT 快照 + 规则加载
- insight_service.rs: 洞察 CRUD + 过期清理
- 3 个 Handler: insight/risk/rule,7 个 API 端点
- 5 个权限码: copilot.insights.list/manage, copilot.risk.view, copilot.rules.list/manage
- AiState 扩展 risk_service + insight_service
This commit is contained in:
iven
2026-05-12 12:14:16 +08:00
parent fe983ba4ae
commit 57f33dd726
15 changed files with 698 additions and 0 deletions

View File

@@ -11,6 +11,9 @@ use std::convert::Infallible;
use crate::dto::{AnalysisSseEvent, AnalysisType};
use crate::state::AiState;
pub mod insight_handler;
pub mod risk_handler;
pub mod rule_handler;
pub mod suggestion_handler;
// === 分析请求 Body ===