feat: V1 VLM复核 + 企微通知 + 手动结单
- 新增3张通知路由表模型(notify_area, camera_area_binding, area_person_binding) - 新增VLM复核服务,通过qwen3-vl-flash对告警截图二次确认 - 新增企微通知服务,告警确认后推送文本卡片给责任人 - 新增通知调度服务,编排VLM复核→查表路由→企微推送流水线 - 新增企微回调接口,支持手动结单/确认处理/标记误报 - 新增通知管理API,区域/摄像头绑定/人员绑定CRUD - 告警上报主流程(edge_compat + yudao_aiot_alarm)接入异步通知 - 扩展配置项支持VLM和企微环境变量 - 添加openai==1.68.0依赖(通过DashScope兼容端点调用)
This commit is contained in:
16
app/main.py
16
app/main.py
@@ -28,6 +28,8 @@ from app.services.notification_service import get_notification_service
|
||||
from app.services.device_service import get_device_service
|
||||
from app.utils.logger import logger
|
||||
from app.routers import yudao_alert_router, yudao_auth_router, yudao_aiot_alarm_router, yudao_aiot_edge_router, yudao_aiot_storage_router, edge_compat_router
|
||||
from app.routers.wechat_callback import router as wechat_callback_router
|
||||
from app.routers.notify_manage import router as notify_manage_router
|
||||
from app.yudao_compat import yudao_exception_handler
|
||||
import json
|
||||
|
||||
@@ -48,6 +50,16 @@ async def lifespan(app: FastAPI):
|
||||
loop = asyncio.get_event_loop()
|
||||
notification_service.set_event_loop(loop)
|
||||
|
||||
# 初始化 VLM 服务
|
||||
from app.services.vlm_service import get_vlm_service
|
||||
vlm_svc = get_vlm_service()
|
||||
vlm_svc.init(settings.vlm)
|
||||
|
||||
# 初始化企微服务
|
||||
from app.services.wechat_service import get_wechat_service
|
||||
wechat_svc = get_wechat_service()
|
||||
wechat_svc.init(settings.wechat)
|
||||
|
||||
logger.info("AI 告警平台启动完成")
|
||||
|
||||
yield
|
||||
@@ -87,6 +99,10 @@ app.include_router(yudao_aiot_storage_router)
|
||||
# Edge 设备使用 /api/ai/alert/edge/* 路径上报(与 WVP 一致),无需认证
|
||||
app.include_router(edge_compat_router)
|
||||
|
||||
# ==================== 企微回调 + 通知管理路由 ====================
|
||||
app.include_router(wechat_callback_router)
|
||||
app.include_router(notify_manage_router)
|
||||
|
||||
# 注册芋道格式异常处理器
|
||||
app.add_exception_handler(HTTPException, yudao_exception_handler)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user