69 lines
1.2 KiB
Python
69 lines
1.2 KiB
Python
|
|
from pydantic import BaseModel
|
||
|
|
from typing import Optional
|
||
|
|
from enum import Enum
|
||
|
|
|
||
|
|
|
||
|
|
class RiskLevel(str, Enum):
|
||
|
|
high = "high"
|
||
|
|
medium = "medium"
|
||
|
|
low = "low"
|
||
|
|
|
||
|
|
|
||
|
|
class ComplianceStatus(str, Enum):
|
||
|
|
pass_status = "pass"
|
||
|
|
warning = "warning"
|
||
|
|
fail = "fail"
|
||
|
|
|
||
|
|
|
||
|
|
class Regulation(BaseModel):
|
||
|
|
id: int
|
||
|
|
name: str
|
||
|
|
clause: Optional[str] = None
|
||
|
|
score: float
|
||
|
|
match_keyword: str
|
||
|
|
category: RiskLevel
|
||
|
|
full_content: str
|
||
|
|
|
||
|
|
|
||
|
|
class ComplianceSegment(BaseModel):
|
||
|
|
id: int
|
||
|
|
index: int
|
||
|
|
intent: str
|
||
|
|
start_pos: int
|
||
|
|
end_pos: int
|
||
|
|
content: str
|
||
|
|
risk_level: RiskLevel
|
||
|
|
regulations: list[Regulation]
|
||
|
|
|
||
|
|
|
||
|
|
class RiskDashboard(BaseModel):
|
||
|
|
score: float
|
||
|
|
high_risk_count: int
|
||
|
|
medium_risk_count: int
|
||
|
|
low_risk_count: int
|
||
|
|
need_fix_segments: int
|
||
|
|
status: ComplianceStatus
|
||
|
|
status_label: str
|
||
|
|
|
||
|
|
|
||
|
|
class PriorityAction(BaseModel):
|
||
|
|
regulation: str
|
||
|
|
issue: str
|
||
|
|
suggestion: str
|
||
|
|
severity: RiskLevel
|
||
|
|
|
||
|
|
|
||
|
|
class ComplianceResult(BaseModel):
|
||
|
|
task_id: str
|
||
|
|
dashboard: RiskDashboard
|
||
|
|
segments: list[ComplianceSegment]
|
||
|
|
priority_actions: list[PriorityAction]
|
||
|
|
|
||
|
|
|
||
|
|
class ComplianceChatRequest(BaseModel):
|
||
|
|
query: str
|
||
|
|
|
||
|
|
|
||
|
|
class AnalyzeResponse(BaseModel):
|
||
|
|
task_id: str
|
||
|
|
status: str = "processing"
|