diff --git a/surfsense_backend/app/capabilities/web/scrape/schemas.py b/surfsense_backend/app/capabilities/web/scrape/schemas.py index 3e77dd56b..91de17a53 100644 --- a/surfsense_backend/app/capabilities/web/scrape/schemas.py +++ b/surfsense_backend/app/capabilities/web/scrape/schemas.py @@ -4,13 +4,21 @@ from __future__ import annotations from typing import Literal -from pydantic import BaseModel +from pydantic import BaseModel, Field + +MAX_SCRAPE_URLS = 20 +"""Per-call batch cap: bounds a synchronous request's crawl fan-out (05).""" class ScrapeInput(BaseModel): - urls: list[str] + urls: list[str] = Field(min_length=1, max_length=MAX_SCRAPE_URLS) max_length: int = 50_000 + @property + def estimated_units(self) -> int: + """Worst-case billable crawls for pre-flight: one per requested URL.""" + return len(self.urls) + class ScrapeRow(BaseModel): url: str