Filters existing images when adding new images; Fixes #1085; Builds fresh bundle

This commit is contained in:
psychedelicious 2022-10-20 08:16:43 +08:00 committed by Lincoln Stein
parent 3e0a7b6229
commit 213e12fe13
4 changed files with 18 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>InvokeAI - A Stable Diffusion Toolkit</title>
<link rel="shortcut icon" type="icon" href="/assets/favicon.0d253ced.ico" />
<script type="module" crossorigin src="/assets/index.b5f97cf7.js"></script>
<script type="module" crossorigin src="/assets/index.b06af007.js"></script>
<link rel="stylesheet" href="/assets/index.58175ea1.css">
</head>

View File

@ -72,7 +72,13 @@ export const gallerySlice = createSlice({
},
addImage: (state, action: PayloadAction<InvokeAI.Image>) => {
const newImage = action.payload;
const { uuid, mtime } = newImage;
const { uuid, url, mtime } = newImage;
// Do not add duplicate images
if (state.images.find((i) => i.url === url && i.mtime === mtime)) {
return;
}
state.images.unshift(newImage);
state.currentImageUuid = uuid;
state.intermediateImage = undefined;
@ -120,8 +126,15 @@ export const gallerySlice = createSlice({
) => {
const { images, areMoreImagesAvailable } = action.payload;
if (images.length > 0) {
// Filter images that already exist in the gallery
const newImages = images.filter(
(newImage) =>
!state.images.find(
(i) => i.url === newImage.url && i.mtime === newImage.mtime
)
);
state.images = state.images
.concat(images)
.concat(newImages)
.sort((a, b) => b.mtime - a.mtime);
if (!state.currentImage) {

View File

@ -15,7 +15,7 @@ export default function MainCFGScale() {
label="CFG Scale"
step={0.5}
min={1}
max={200}
max={30}
onChange={handleChangeCfgScale}
value={cfgScale}
width={inputWidth}