mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(nodes): handle intermediates during images.get_many()
This commit is contained in:
parent
33a0af4637
commit
ee0225f4ba
@ -230,6 +230,9 @@ async def get_image_urls(
|
||||
async def list_images_with_metadata(
|
||||
image_type: ImageType = Query(description="The type of images to list"),
|
||||
image_category: ImageCategory = Query(description="The kind of images to list"),
|
||||
is_intermediate: bool = Query(
|
||||
default=False, description="The kind of images to list"
|
||||
),
|
||||
page: int = Query(default=0, description="The page of image metadata to get"),
|
||||
per_page: int = Query(
|
||||
default=10, description="The number of image metadata per page"
|
||||
@ -240,6 +243,7 @@ async def list_images_with_metadata(
|
||||
image_dtos = ApiDependencies.invoker.services.images.get_many(
|
||||
image_type,
|
||||
image_category,
|
||||
is_intermediate,
|
||||
page,
|
||||
per_page,
|
||||
)
|
||||
|
@ -65,6 +65,7 @@ class ImageRecordStorageBase(ABC):
|
||||
self,
|
||||
image_type: ImageType,
|
||||
image_category: ImageCategory,
|
||||
is_intermediate: bool = False,
|
||||
page: int = 0,
|
||||
per_page: int = 10,
|
||||
) -> PaginatedResults[ImageRecord]:
|
||||
@ -245,6 +246,7 @@ class SqliteImageRecordStorage(ImageRecordStorageBase):
|
||||
self,
|
||||
image_type: ImageType,
|
||||
image_category: ImageCategory,
|
||||
is_intermediate: bool = False,
|
||||
page: int = 0,
|
||||
per_page: int = 10,
|
||||
) -> PaginatedResults[ImageRecord]:
|
||||
@ -254,11 +256,11 @@ class SqliteImageRecordStorage(ImageRecordStorageBase):
|
||||
self._cursor.execute(
|
||||
f"""--sql
|
||||
SELECT * FROM images
|
||||
WHERE image_type = ? AND image_category = ?
|
||||
WHERE image_type = ? AND image_category = ? AND is_intermediate = ?
|
||||
ORDER BY created_at DESC
|
||||
LIMIT ? OFFSET ?;
|
||||
""",
|
||||
(image_type.value, image_category.value, per_page, page * per_page),
|
||||
(image_type.value, image_category.value, is_intermediate, per_page, page * per_page),
|
||||
)
|
||||
|
||||
result = cast(list[sqlite3.Row], self._cursor.fetchall())
|
||||
@ -268,9 +270,9 @@ class SqliteImageRecordStorage(ImageRecordStorageBase):
|
||||
self._cursor.execute(
|
||||
"""--sql
|
||||
SELECT count(*) FROM images
|
||||
WHERE image_type = ? AND image_category = ?
|
||||
WHERE image_type = ? AND image_category = ? AND is_intermediate = ?
|
||||
""",
|
||||
(image_type.value, image_category.value),
|
||||
(image_type.value, image_category.value, is_intermediate),
|
||||
)
|
||||
|
||||
count = self._cursor.fetchone()[0]
|
||||
|
@ -330,6 +330,7 @@ class ImageService(ImageServiceABC):
|
||||
self,
|
||||
image_type: ImageType,
|
||||
image_category: ImageCategory,
|
||||
is_intermediate: bool = False,
|
||||
page: int = 0,
|
||||
per_page: int = 10,
|
||||
) -> PaginatedResults[ImageDTO]:
|
||||
@ -337,6 +338,7 @@ class ImageService(ImageServiceABC):
|
||||
results = self._services.records.get_many(
|
||||
image_type,
|
||||
image_category,
|
||||
is_intermediate,
|
||||
page,
|
||||
per_page,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user