完成警告消息对应中文显示

This commit is contained in:
zqc
2026-03-05 16:05:58 +08:00
parent 80bc288a88
commit 8bcb586b53
4 changed files with 123 additions and 6 deletions

View File

@@ -15,6 +15,7 @@ from typing import Dict, Any, Callable
from concurrent.futures import ThreadPoolExecutor
from common import constants
from common.type_mapping import get_alert_label
from utils.logger import get_logger
from utils.hls_utils import get_segments_before_current, parse_segment_info
@@ -90,10 +91,10 @@ class BaseFrameProcessorWorker(threading.Thread):
将 msg 中的 result_type 从数组展开为多个独立的 msg
Args:
msg: 原始消息result_type 为数组
msg: 原始消息result_type 为 action code 字符串数组
Returns:
msg 列表,每个 msg 的 result_type 为数组中的单个元素
msg 列表,每个 msg 的 result_type 为包含 action_code 和 action_name 的对象
"""
result_types = msg.get("result_type", [])
if not isinstance(result_types, list):
@@ -104,9 +105,12 @@ class BaseFrameProcessorWorker(threading.Thread):
return [msg]
result = []
for r_type in result_types:
for action_code in result_types:
new_msg = msg.copy()
new_msg["result_type"] = r_type
new_msg["result_type"] = {
"action_code": action_code,
"action_name": get_alert_label(action_code)
}
result.append(new_msg)
return result