feat: 传递离岗时长到告警记录
- ResultReporter AlertInfo 添加 duration_minutes - main.py 使用 report_alert 替代 report_detection_alert - _store_alert 保存 duration_minutes
This commit is contained in:
18
main.py
18
main.py
@@ -311,18 +311,20 @@ class EdgeInferenceService:
|
||||
for alert in alerts:
|
||||
self._performance_stats["total_alerts_generated"] += 1
|
||||
|
||||
self._reporter.report_detection_alert(
|
||||
from core.result_reporter import AlertInfo
|
||||
alert_info = AlertInfo(
|
||||
alert_id=f"{roi_id}_{int(frame.timestamp.timestamp())}",
|
||||
camera_id=camera_id,
|
||||
roi_id=roi_id,
|
||||
alert_type=alert.get("alert_type", "detection"),
|
||||
detection={
|
||||
"class_name": alert.get("message", "未知目标"),
|
||||
"confidence": alert.get("confidence", 1.0),
|
||||
"bbox": alert.get("bbox", []),
|
||||
"message": alert.get("message", ""),
|
||||
},
|
||||
screenshot=frame.image
|
||||
target_class=alert.get("class", "unknown"),
|
||||
confidence=alert.get("confidence", 1.0),
|
||||
bbox=alert.get("bbox", []),
|
||||
message=alert.get("message", ""),
|
||||
timestamp=frame.timestamp,
|
||||
duration_minutes=alert.get("duration_minutes"),
|
||||
)
|
||||
self._reporter.report_alert(alert_info, screenshot=frame.image)
|
||||
|
||||
self._logger.log_alert(
|
||||
alert.get("alert_type", "detection"),
|
||||
|
||||
Reference in New Issue
Block a user