Refactor samples gallery

Signed-off-by: Felipe Cardoso <felipe.cardoso@hotmail.it>
This commit is contained in:
2025-01-23 13:10:58 +01:00
parent acd37d2d75
commit 4b9d3e7d55
4 changed files with 12 additions and 10 deletions

View File

@@ -10,7 +10,7 @@ router = APIRouter()
@router.get("/list", response_model=List[Sample])
async def list_samples(
request: Request,
limit: int = Query(20, ge=1, le=1000),
limit: int = Query(200, ge=1, le=1000),
offset: int = Query(0, ge=0)
):
"""
@@ -25,7 +25,7 @@ async def list_samples(
@router.get("/latest", response_model=List[Sample])
async def get_latest_samples(
request: Request,
count: int = Query(5, ge=1, le=20)
count: int = Query(20, ge=1, le=100)
):
"""
Get the most recent sample images

View File

@@ -191,7 +191,7 @@ class SampleManager:
# Wait a bit before retrying on error
await asyncio.sleep(5)
async def list_samples(self, limit: int = 20, offset: int = 0) -> List[Sample]:
async def list_samples(self, limit: int = 200, offset: int = 0) -> List[Sample]:
"""List sample images with pagination"""
logger.info(f"Total samples: {len(self.samples)}")
@@ -204,7 +204,7 @@ class SampleManager:
return sorted_samples[offset:offset + limit]
async def get_latest_samples(self, count: int = 5) -> List[Sample]:
async def get_latest_samples(self, count: int = 20) -> List[Sample]:
"""Get most recent samples"""
return await self.list_samples(limit=count, offset=0)