feat(web): AI 分析详情增加建议面板 — 风险等级+建议列表+审批操作
- 新增 suggestions API 层(list/approve/getComparison) - 展开分析详情时自动加载关联的 AI 建议列表 - 风险等级彩色标签(低/中/高) - 建议类型、原因、执行状态展示 - 待审批建议支持批准/拒绝操作
This commit is contained in:
34
apps/web/src/api/ai/suggestions.ts
Normal file
34
apps/web/src/api/ai/suggestions.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import client from '../client';
|
||||
|
||||
export interface SuggestionItem {
|
||||
id: string;
|
||||
analysis_id: string;
|
||||
suggestion_type: string;
|
||||
risk_level: string;
|
||||
params: Record<string, unknown> | null;
|
||||
status: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ComparisonReport {
|
||||
suggestion_id: string;
|
||||
baseline: Record<string, unknown> | null;
|
||||
current: Record<string, unknown> | null;
|
||||
comparison_available: boolean;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export const suggestionApi = {
|
||||
list: async (params?: { analysis_id?: string; status?: string }) => {
|
||||
const resp = await client.get('/ai/suggestions', { params });
|
||||
return resp.data.data as { data: SuggestionItem[]; total: number };
|
||||
},
|
||||
approve: async (id: string, action: 'approve' | 'reject') => {
|
||||
const resp = await client.post(`/ai/suggestions/${id}/approve`, { action });
|
||||
return resp.data.data as { id: string; status: string };
|
||||
},
|
||||
getComparison: async (id: string) => {
|
||||
const resp = await client.get(`/ai/suggestions/${id}/comparison`);
|
||||
return resp.data.data as ComparisonReport;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user