fix: 统一配置参数

This commit is contained in:
2026-01-22 15:53:31 +08:00
parent 6fc17ccf64
commit 2d5ada2909
4 changed files with 11 additions and 10 deletions

View File

@@ -66,9 +66,9 @@ class WorkingHours(BaseModel):
class AlgorithmsConfig(BaseModel):
leave_post_threshold_sec: int = 360
leave_post_confirm_sec: int = 30
leave_post_return_sec: int = 5
leave_post_threshold_sec: int = 300
leave_post_confirm_sec: int = 10
leave_post_return_sec: int = 30
intrusion_check_interval_sec: float = 1.0
intrusion_direction_sensitive: bool = False

View File

@@ -70,9 +70,9 @@ working_hours:
# 算法默认参数
algorithms:
leave_post:
default_threshold_sec: 360 # 离岗超时(6分钟)
confirm_sec: 30 # 岗确认时间
return_sec: 5 # 上岗确认时间
threshold_sec: 300 # 离岗超时(5分钟)
confirm_sec: 10 # 岗确认时间10秒
return_sec: 30 # 离岗缓冲时间30秒
intrusion:
check_interval_sec: 1.0 # 检测间隔
direction_sensitive: false # 方向敏感
@@ -94,7 +94,7 @@ monitoring:
# 大模型配置(预留)
llm:
enabled: false
api_key: ""
base_url: ""
api_key: "sk-21e61bef09074682b589da3bdbfe07a2"
base_url: "https://dashscope.aliyuncs.com/compatible-mode/v1"
model: "qwen3-vl-max"
timeout: 30

View File

@@ -205,6 +205,7 @@ class IntrusionAlgorithm:
def process(
self,
roi_id: str,
camera_id: str,
tracks: List[Dict],
current_time: Optional[datetime] = None,
@@ -236,7 +237,7 @@ class IntrusionAlgorithm:
for track_data in tracked:
x1, y1, x2, y2, track_id = track_data
cooldown_key = f"{camera_id}_{int(track_id)}"
cooldown_key = f"{roi_id}_{int(track_id)}"
if cooldown_key not in self.alert_cooldowns or (
now - self.alert_cooldowns[cooldown_key]

View File

@@ -58,7 +58,7 @@ def test_leave_post_algorithm_process():
{"bbox": [100, 100, 200, 200], "conf": 0.9, "cls": 0},
]
alerts = algo.process("test_cam", tracks, datetime.now())
alerts = algo.process("roi_1", "test_cam", tracks, datetime.now())
assert isinstance(alerts, list)