fix: VLM降级跳过时不再自动标记告警为误报

VLM调用失败(skipped=true)和VLM判定误报是两种情况,
降级跳过时保留告警原始状态,让人工处理。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 12:52:05 +08:00
parent 840bb0e720
commit d5550d8904

View File

@@ -57,12 +57,17 @@ async def process_alarm_notification(alarm_data: Dict):
# 写入 alarm_llm_analysis 表(复用已有表)
_save_vlm_result(alarm_id, vlm_result)
# VLM 判定为误报 → 更新告警状态,不通知
if not vlm_result.get("confirmed", True):
# VLM 明确判定为误报(非降级跳过)→ 更新告警状态,不通知
if not vlm_result.get("confirmed", True) and not vlm_result.get("skipped"):
_mark_false_alarm(alarm_id)
logger.info(f"VLM 判定误报,跳过通知: {alarm_id}")
return
# VLM 跳过(降级)且 confirmed=False → 不改告警状态,仅跳过通知
if not vlm_result.get("confirmed", True) and vlm_result.get("skipped"):
logger.info(f"VLM 降级跳过,不推送但保留告警状态: {alarm_id}")
return
# ========== 2. 查表获取通知人员 ==========
description = vlm_result.get("description", "")
area_name, persons = _get_notify_persons(device_id, alarm_level)