feat: multi-robot architecture, car-robot rename, and credit-based OCR logic spec

This commit is contained in:
2026-02-07 02:20:04 +00:00
parent cab8706980
commit d3ce60d69b
17 changed files with 223 additions and 412 deletions

View File

@@ -0,0 +1,34 @@
import httpx
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy import select
from app.models.vehicle import VehicleCatalog
class BaseHarvester:
def __init__(self, category: str):
self.category = category
self.headers = {"User-Agent": "ServiceFinder-Harvester-Bot/2.0"}
async def check_exists(self, db: AsyncSession, brand: str, model: str):
"""Ellenőrzi, hogy az adott modell létezik-e már."""
stmt = select(VehicleCatalog).where(
VehicleCatalog.brand == brand,
VehicleCatalog.model == model,
VehicleCatalog.category == self.category
)
result = await db.execute(stmt)
return result.scalar_one_or_none()
async def log_entry(self, db: AsyncSession, brand: str, model: str, specs: dict = None):
"""Létrehoz vagy frissít egy katalógus bejegyzést."""
existing = await self.check_exists(db, brand, model)
if not existing:
new_v = VehicleCatalog(
brand=brand,
model=model,
category=self.category,
factory_specs=specs or {},
verification_status="incomplete" if not specs else "verified"
)
db.add(new_v)
return True
return False