完善牧安云哨-后端
This commit is contained in:
@@ -4,10 +4,15 @@ from uuid import UUID
|
||||
import config.minIO as minIO
|
||||
import db.postgres as pg
|
||||
from agent.licenseImageAgent import get_license_response
|
||||
from agent.vehicleImageAgent import get_vehicle_response
|
||||
from config.minIO import minio_client
|
||||
from config.yolo import YOLOSingleton
|
||||
from db.postgres import get_dept_id_by_iot_user_name, get_dept_ids_by_dept_id
|
||||
from db.postgres.sentinel import update_sentinel_record
|
||||
from llm.ticketLLM import *
|
||||
from llm.ticketLLMv2 import get_ticket_response_v2
|
||||
from models.SentinelRecordRequest import SentinelRecordRequest
|
||||
from routers.WS import ws_manager
|
||||
|
||||
|
||||
def process_ticket_image(
|
||||
@@ -178,3 +183,27 @@ def process_silkworm_cocoon_image(
|
||||
"postprocess_time_ms": speed_json.get("postprocess"),
|
||||
"details": results_json.get("class_counts"),
|
||||
}
|
||||
|
||||
|
||||
async def process_vehicle_animal_image(
|
||||
data: SentinelRecordRequest,
|
||||
):
|
||||
# 通过设备id获得组织id
|
||||
dept_id = get_dept_id_by_iot_user_name(data.DeviceId)
|
||||
# 得到动物类型
|
||||
oss_url = minIO.get_temp_url("sentinel", "vehicle_image/" + data.VehicleImage)
|
||||
analysis_result = await get_vehicle_response(oss_url)
|
||||
livestock_type = analysis_result.get("livestock_type", "")
|
||||
remark = analysis_result.get("remark", "")
|
||||
|
||||
available_departments = get_dept_ids_by_dept_id(dept_id)
|
||||
|
||||
await ws_manager.noticeSentinel(
|
||||
{
|
||||
"content": f"载有{livestock_type}的车辆即将进入关卡,请准备检查",
|
||||
"type": "vehicle_alert",
|
||||
},
|
||||
available_departments,
|
||||
)
|
||||
# 保存到数据库
|
||||
return update_sentinel_record(data.Id, livestock_type, remark, dept_id)
|
||||
|
||||
Reference in New Issue
Block a user