feat: add configurable history timeout and polling interval for ComfyUI API
This commit is contained in:
@@ -3,7 +3,7 @@ import type { ImageDocument } from "@core/document";
|
||||
import type { ArtboardId, AssetId, LayerId } from "@core/id";
|
||||
import type { ImageLayer } from "@core/image-layer";
|
||||
import type { Layer } from "@core/layer";
|
||||
import type { GenerationCandidate } from "@editor/state";
|
||||
import type { GenerationCandidate, GenerationState } from "@editor/state";
|
||||
import type { Command } from "./command";
|
||||
import { commandIds } from "./ids";
|
||||
|
||||
@@ -146,6 +146,7 @@ export const generationApplyCandidateAsLayerCommand: Command<GenerationApplyCand
|
||||
document: insertLayerAtTop({ ...state.document, assets: [...state.document.assets, asset] }, candidate.placement.artboardId, layer),
|
||||
editor: {
|
||||
...state.editor,
|
||||
generation: clearCommittedGenerationPreview(state.editor.generation),
|
||||
selection: { artboardId: candidate.placement.artboardId, layerIds: [layer.id] },
|
||||
},
|
||||
};
|
||||
@@ -170,6 +171,7 @@ export const generationReplaceCandidatePixelsCommand: Command<GenerationReplaceC
|
||||
},
|
||||
editor: {
|
||||
...state.editor,
|
||||
generation: clearCommittedGenerationPreview(state.editor.generation),
|
||||
selection: { artboardId: targetLayerLocation.artboardId, layerIds: [candidate.inpaint.targetLayerId] },
|
||||
},
|
||||
};
|
||||
@@ -215,3 +217,8 @@ function findLayerInTree(layers: readonly Layer[], layerId: LayerId): Layer | un
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function clearCommittedGenerationPreview(generation: GenerationState): GenerationState {
|
||||
if (generation.candidates.length === 0 && !generation.selectedCandidateId) return generation;
|
||||
return { candidates: [], selectedCandidateId: undefined };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user