mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-08 22:22:17 +02:00
feat(capabilities): bound web.scrape batch and expose worst-case units
This commit is contained in:
parent
8fbfa5a6e1
commit
c696829568
1 changed files with 10 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue