mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-12 15:24:55 -05:00
chore: ruff
This commit is contained in:
@@ -565,7 +565,9 @@ async def get_bulk_download_item(
|
||||
raise HTTPException(status_code=404)
|
||||
|
||||
|
||||
@images_router.get("/collections/counts", operation_id="get_image_collection_counts", response_model=ImageCollectionCounts)
|
||||
@images_router.get(
|
||||
"/collections/counts", operation_id="get_image_collection_counts", response_model=ImageCollectionCounts
|
||||
)
|
||||
async def get_image_collection_counts(
|
||||
image_origin: Optional[ResourceOrigin] = Query(default=None, description="The origin of images to count."),
|
||||
categories: Optional[list[ImageCategory]] = Query(default=None, description="The categories of image to include."),
|
||||
|
||||
@@ -208,6 +208,7 @@ def deserialize_image_record(image_dict: dict) -> ImageRecord:
|
||||
has_workflow=has_workflow,
|
||||
)
|
||||
|
||||
|
||||
class ImageCollectionCounts(BaseModel):
|
||||
starred_count: int = Field(description="The number of starred images in the collection.")
|
||||
unstarred_count: int = Field(description="The number of unstarred images in the collection.")
|
||||
|
||||
@@ -626,9 +626,12 @@ class SqliteImageRecordStorage(ImageRecordStorageBase):
|
||||
query_params.append(f"%{search_term.lower()}%")
|
||||
|
||||
# Order by starred first, then by created_at
|
||||
query += query_conditions + f"""--sql
|
||||
query += (
|
||||
query_conditions
|
||||
+ f"""--sql
|
||||
ORDER BY images.starred DESC, images.created_at {order_dir.value}
|
||||
"""
|
||||
)
|
||||
|
||||
cursor.execute(query, query_params)
|
||||
result = cast(list[sqlite3.Row], cursor.fetchall())
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from time import time
|
||||
from typing import Literal, Optional
|
||||
|
||||
from PIL.Image import Image as PILImageType
|
||||
|
||||
Reference in New Issue
Block a user