This commit is contained in:
HuangHai
2026-01-13 20:12:38 +08:00
parent 099f8fb148
commit c1effd1249
6 changed files with 154 additions and 65 deletions

View File

@@ -144,7 +144,7 @@ class AiTeJiYiChongService:
logger.info(f"场站详情处理完成: {name}")
return detail
async def process_station_list_vl(self, image_path, json_metadata, device_info=None) -> list:
async def process_station_list_vl(self, image_path, json_metadata, device_info=None, max_count=None) -> list:
"""
基于 VL 模式处理场站列表 (整页识别)
"""
@@ -159,6 +159,12 @@ class AiTeJiYiChongService:
processed_stations = []
async with await self.db.get_session() as session:
for station in station_list:
# 如果指定了最大数量且已达到,则停止保存
if max_count is not None and len(processed_stations) >= max_count:
# 填充空位以保持索引对齐,但不保存到数据库
processed_stations.append(None)
continue
name = station.get("station_name")
if not name:
continue
@@ -167,7 +173,7 @@ class AiTeJiYiChongService:
now = datetime.now()
station["station_hash"] = station_hash
# 1. 保存 Profile
# 1. 保存 Profile (使用 db_retry 装饰器的方法,如果 Db 类已更新)
profile_id = self.generate_id()
await self.station_profile_model.save(
session=session,