修复:EdgeAlarmReport 添加 area_id 字段,告警创建时优先从顶层取 area_id

This commit is contained in:
2026-03-27 11:09:47 +08:00
parent e7c9ee126f
commit f96d692dd9
2 changed files with 2 additions and 1 deletions

View File

@@ -124,6 +124,7 @@ class EdgeAlarmReport(BaseModel):
snapshot_url: Optional[str] = Field(None, max_length=512, description="截图 COS object_key")
algorithm_code: Optional[str] = Field(None, max_length=64, description="算法编码")
confidence_score: Optional[float] = Field(None, ge=0, le=1, description="置信度 0-1")
area_id: Optional[int] = Field(None, description="区域ID")
ext_data: Optional[Dict[str, Any]] = Field(None, description="扩展数据 (bbox/target_class 等)")

View File

@@ -240,7 +240,7 @@ class AlarmEventService:
handle_status="UNHANDLED",
snapshot_url=data.get("snapshot_url"),
edge_node_id=ext_data.get("edge_node_id"),
area_id=ext_data.get("area_id"),
area_id=data.get("area_id") or ext_data.get("area_id"),
)
db.add(alarm)