mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): handle new image origin/category setup
- Update all thunks & network related things - Update gallery What I have not done yet is rename the gallery tabs and the relevant slices, but I believe the functionality is all there. Also I fixed several bugs along the way but couldn't really commit them separately bc I was refactoring. Can't remember what they were, but related to the gallery image switching.
This commit is contained in:
committed by
Kent Keirsey
parent
d78e3572e3
commit
29fcc92da9
@@ -23,8 +23,8 @@ export const receivedGalleryImages = createAppAsyncThunk<
|
||||
const pageOffset = Math.floor(upsertedImageCount / IMAGES_PER_PAGE);
|
||||
|
||||
const response = await ImagesService.listImagesWithMetadata({
|
||||
excludeCategories: ['user'],
|
||||
isIntermediate: false,
|
||||
showInGallery: true,
|
||||
page: nextPage + pageOffset,
|
||||
perPage: IMAGES_PER_PAGE,
|
||||
});
|
||||
@@ -53,9 +53,8 @@ export const receivedUploadImages = createAppAsyncThunk<
|
||||
const pageOffset = Math.floor(upsertedImageCount / IMAGES_PER_PAGE);
|
||||
|
||||
const response = await ImagesService.listImagesWithMetadata({
|
||||
imageType: 'uploads',
|
||||
includeCategories: ['user'],
|
||||
isIntermediate: false,
|
||||
showInGallery: false,
|
||||
page: nextPage + pageOffset,
|
||||
perPage: IMAGES_PER_PAGE,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { ResultsImageDTO } from 'features/gallery/store/resultsSlice';
|
||||
import { UploadsImageDTO } from 'features/gallery/store/uploadsSlice';
|
||||
import { get, isObject, isString } from 'lodash-es';
|
||||
import {
|
||||
@@ -9,17 +8,18 @@ import {
|
||||
PromptOutput,
|
||||
IterateInvocationOutput,
|
||||
CollectInvocationOutput,
|
||||
ImageType,
|
||||
ImageField,
|
||||
LatentsOutput,
|
||||
ImageDTO,
|
||||
ResourceOrigin,
|
||||
} from 'services/api';
|
||||
|
||||
export const isUploadsImageDTO = (image: ImageDTO): image is UploadsImageDTO =>
|
||||
image.image_type === 'uploads';
|
||||
|
||||
export const isResultsImageDTO = (image: ImageDTO): image is ResultsImageDTO =>
|
||||
image.image_type === 'results';
|
||||
export const isUploadsImageDTO = (
|
||||
image: ImageDTO | undefined
|
||||
): image is UploadsImageDTO =>
|
||||
image !== undefined &&
|
||||
image.image_origin === 'external' &&
|
||||
image.image_category === 'user';
|
||||
|
||||
export const isImageOutput = (
|
||||
output: GraphExecutionState['results'][string]
|
||||
@@ -49,10 +49,10 @@ export const isCollectOutput = (
|
||||
output: GraphExecutionState['results'][string]
|
||||
): output is CollectInvocationOutput => output.type === 'collect_output';
|
||||
|
||||
export const isImageType = (t: unknown): t is ImageType =>
|
||||
isString(t) && ['results', 'uploads', 'intermediates'].includes(t);
|
||||
export const isResourceOrigin = (t: unknown): t is ResourceOrigin =>
|
||||
isString(t) && ['internal', 'external'].includes(t);
|
||||
|
||||
export const isImageField = (imageField: unknown): imageField is ImageField =>
|
||||
isObject(imageField) &&
|
||||
isString(get(imageField, 'image_name')) &&
|
||||
isImageType(get(imageField, 'image_type'));
|
||||
isResourceOrigin(get(imageField, 'image_origin'));
|
||||
|
||||
Reference in New Issue
Block a user