fix more merge conflicts

This commit is contained in:
Jennifer Player 2023-09-20 10:56:12 -04:00
commit 5075e9c899
59 changed files with 323 additions and 417 deletions

View File

@ -425,12 +425,21 @@ class InvocationContext:
graph_execution_state_id: str
queue_id: str
queue_item_id: int
queue_batch_id: str
def __init__(self, services: InvocationServices, queue_id: str, queue_item_id: int, graph_execution_state_id: str):
def __init__(
self,
services: InvocationServices,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
):
self.services = services
self.graph_execution_state_id = graph_execution_state_id
self.queue_id = queue_id
self.queue_item_id = queue_item_id
self.queue_batch_id = queue_batch_id
class BaseInvocationOutput(BaseModel):

View File

@ -30,6 +30,7 @@ class EventServiceBase:
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
node: dict,
source_node_id: str,
@ -44,6 +45,7 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
node_id=node.get("id"),
source_node_id=source_node_id,
@ -58,6 +60,7 @@ class EventServiceBase:
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
result: dict,
node: dict,
@ -69,6 +72,7 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
node=node,
source_node_id=source_node_id,
@ -80,6 +84,7 @@ class EventServiceBase:
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
node: dict,
source_node_id: str,
@ -92,6 +97,7 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
node=node,
source_node_id=source_node_id,
@ -101,7 +107,13 @@ class EventServiceBase:
)
def emit_invocation_started(
self, queue_id: str, queue_item_id: int, graph_execution_state_id: str, node: dict, source_node_id: str
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
node: dict,
source_node_id: str,
) -> None:
"""Emitted when an invocation has started"""
self.__emit_queue_event(
@ -109,19 +121,23 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
node=node,
source_node_id=source_node_id,
),
)
def emit_graph_execution_complete(self, queue_id: str, queue_item_id: int, graph_execution_state_id: str) -> None:
def emit_graph_execution_complete(
self, queue_id: str, queue_item_id: int, queue_batch_id: str, graph_execution_state_id: str
) -> None:
"""Emitted when a session has completed all invocations"""
self.__emit_queue_event(
event_name="graph_execution_state_complete",
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
),
)
@ -130,6 +146,7 @@ class EventServiceBase:
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
model_name: str,
base_model: BaseModelType,
@ -142,6 +159,7 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
model_name=model_name,
base_model=base_model,
@ -154,6 +172,7 @@ class EventServiceBase:
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
model_name: str,
base_model: BaseModelType,
@ -167,6 +186,7 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
model_name=model_name,
base_model=base_model,
@ -182,6 +202,7 @@ class EventServiceBase:
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
error_type: str,
error: str,
@ -192,6 +213,7 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
error_type=error_type,
error=error,
@ -202,6 +224,7 @@ class EventServiceBase:
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
node_id: str,
error_type: str,
@ -213,6 +236,7 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
node_id=node_id,
error_type=error_type,
@ -224,6 +248,7 @@ class EventServiceBase:
self,
queue_id: str,
queue_item_id: int,
queue_batch_id: str,
graph_execution_state_id: str,
) -> None:
"""Emitted when a session is canceled"""
@ -232,6 +257,7 @@ class EventServiceBase:
payload=dict(
queue_id=queue_id,
queue_item_id=queue_item_id,
queue_batch_id=queue_batch_id,
graph_execution_state_id=graph_execution_state_id,
),
)

View File

@ -15,6 +15,9 @@ class InvocationQueueItem(BaseModel):
session_queue_item_id: int = Field(
description="The ID of session queue item from which this invocation queue item came"
)
session_queue_batch_id: str = Field(
description="The ID of the session batch from which this invocation queue item came"
)
invoke_all: bool = Field(default=False)
timestamp: float = Field(default_factory=time.time)

View File

@ -18,7 +18,12 @@ class Invoker:
self._start()
def invoke(
self, queue_id: str, queue_item_id: int, graph_execution_state: GraphExecutionState, invoke_all: bool = False
self,
session_queue_id: str,
session_queue_item_id: int,
session_queue_batch_id: str,
graph_execution_state: GraphExecutionState,
invoke_all: bool = False,
) -> Optional[str]:
"""Determines the next node to invoke and enqueues it, preparing if needed.
Returns the id of the queued node, or `None` if there are no nodes left to enqueue."""
@ -34,8 +39,9 @@ class Invoker:
# Queue the invocation
self.services.queue.put(
InvocationQueueItem(
session_queue_item_id=queue_item_id,
session_queue_id=queue_id,
session_queue_id=session_queue_id,
session_queue_item_id=session_queue_item_id,
session_queue_batch_id=session_queue_batch_id,
graph_execution_state_id=graph_execution_state.id,
invocation_id=invocation.id,
invoke_all=invoke_all,

View File

@ -539,6 +539,7 @@ class ModelManagerService(ModelManagerServiceBase):
context.services.events.emit_model_load_completed(
queue_id=context.queue_id,
queue_item_id=context.queue_item_id,
queue_batch_id=context.queue_batch_id,
graph_execution_state_id=context.graph_execution_state_id,
model_name=model_name,
base_model=base_model,
@ -550,6 +551,7 @@ class ModelManagerService(ModelManagerServiceBase):
context.services.events.emit_model_load_started(
queue_id=context.queue_id,
queue_item_id=context.queue_item_id,
queue_batch_id=context.queue_batch_id,
graph_execution_state_id=context.graph_execution_state_id,
model_name=model_name,
base_model=base_model,

View File

@ -57,6 +57,7 @@ class DefaultInvocationProcessor(InvocationProcessorABC):
except Exception as e:
self.__invoker.services.logger.error("Exception while retrieving session:\n%s" % e)
self.__invoker.services.events.emit_session_retrieval_error(
queue_batch_id=queue_item.session_queue_batch_id,
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
graph_execution_state_id=queue_item.graph_execution_state_id,
@ -70,6 +71,7 @@ class DefaultInvocationProcessor(InvocationProcessorABC):
except Exception as e:
self.__invoker.services.logger.error("Exception while retrieving invocation:\n%s" % e)
self.__invoker.services.events.emit_invocation_retrieval_error(
queue_batch_id=queue_item.session_queue_batch_id,
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
graph_execution_state_id=queue_item.graph_execution_state_id,
@ -84,6 +86,7 @@ class DefaultInvocationProcessor(InvocationProcessorABC):
# Send starting event
self.__invoker.services.events.emit_invocation_started(
queue_batch_id=queue_item.session_queue_batch_id,
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
graph_execution_state_id=graph_execution_state.id,
@ -106,6 +109,7 @@ class DefaultInvocationProcessor(InvocationProcessorABC):
graph_execution_state_id=graph_execution_state.id,
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
queue_batch_id=queue_item.session_queue_batch_id,
)
)
@ -121,6 +125,7 @@ class DefaultInvocationProcessor(InvocationProcessorABC):
# Send complete event
self.__invoker.services.events.emit_invocation_complete(
queue_batch_id=queue_item.session_queue_batch_id,
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
graph_execution_state_id=graph_execution_state.id,
@ -150,6 +155,7 @@ class DefaultInvocationProcessor(InvocationProcessorABC):
self.__invoker.services.logger.error("Error while invoking:\n%s" % e)
# Send error event
self.__invoker.services.events.emit_invocation_error(
queue_batch_id=queue_item.session_queue_batch_id,
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
graph_execution_state_id=graph_execution_state.id,
@ -170,14 +176,16 @@ class DefaultInvocationProcessor(InvocationProcessorABC):
if queue_item.invoke_all and not is_complete:
try:
self.__invoker.invoke(
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
session_queue_batch_id=queue_item.session_queue_batch_id,
session_queue_item_id=queue_item.session_queue_item_id,
session_queue_id=queue_item.session_queue_id,
graph_execution_state=graph_execution_state,
invoke_all=True,
)
except Exception as e:
self.__invoker.services.logger.error("Error while invoking:\n%s" % e)
self.__invoker.services.events.emit_invocation_error(
queue_batch_id=queue_item.session_queue_batch_id,
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
graph_execution_state_id=graph_execution_state.id,
@ -188,6 +196,7 @@ class DefaultInvocationProcessor(InvocationProcessorABC):
)
elif is_complete:
self.__invoker.services.events.emit_graph_execution_complete(
queue_batch_id=queue_item.session_queue_batch_id,
queue_item_id=queue_item.session_queue_item_id,
queue_id=queue_item.session_queue_id,
graph_execution_state_id=graph_execution_state.id,

View File

@ -102,8 +102,9 @@ class DefaultSessionProcessor(SessionProcessorBase):
self.__queue_item = queue_item
self.__invoker.services.graph_execution_manager.set(queue_item.session)
self.__invoker.invoke(
queue_item_id=queue_item.item_id,
queue_id=queue_item.queue_id,
session_queue_batch_id=queue_item.batch_id,
session_queue_id=queue_item.queue_id,
session_queue_item_id=queue_item.item_id,
graph_execution_state=queue_item.session,
invoke_all=True,
)

View File

@ -562,6 +562,7 @@ class SqliteSessionQueue(SessionQueueBase):
self.__invoker.services.events.emit_session_canceled(
queue_item_id=queue_item.item_id,
queue_id=queue_item.queue_id,
queue_batch_id=queue_item.batch_id,
graph_execution_state_id=queue_item.session_id,
)
self.__invoker.services.events.emit_queue_item_status_changed(queue_item)
@ -604,6 +605,7 @@ class SqliteSessionQueue(SessionQueueBase):
self.__invoker.services.events.emit_session_canceled(
queue_item_id=current_queue_item.item_id,
queue_id=current_queue_item.queue_id,
queue_batch_id=current_queue_item.batch_id,
graph_execution_state_id=current_queue_item.session_id,
)
self.__invoker.services.events.emit_queue_item_status_changed(current_queue_item)
@ -649,6 +651,7 @@ class SqliteSessionQueue(SessionQueueBase):
self.__invoker.services.events.emit_session_canceled(
queue_item_id=current_queue_item.item_id,
queue_id=current_queue_item.queue_id,
queue_batch_id=current_queue_item.batch_id,
graph_execution_state_id=current_queue_item.session_id,
)
self.__invoker.services.events.emit_queue_item_status_changed(current_queue_item)

View File

@ -112,6 +112,7 @@ def stable_diffusion_step_callback(
context.services.events.emit_generator_progress(
queue_id=context.queue_id,
queue_item_id=context.queue_item_id,
queue_batch_id=context.queue_batch_id,
graph_execution_state_id=context.graph_execution_state_id,
node=node,
source_node_id=source_node_id,

View File

@ -885,6 +885,7 @@
},
"cfgScale": "CFG Scale",
"clipSkip": "CLIP Skip",
"clipSkipWithLayerCount": "CLIP Skip {{layerCount}}",
"closeViewer": "Close Viewer",
"codeformerFidelity": "Fidelity",
"coherenceMode": "Mode",
@ -958,6 +959,9 @@
"seamlessTiling": "Seamless Tiling",
"seamlessXAxis": "X Axis",
"seamlessYAxis": "Y Axis",
"seamlessX": "Seamless X",
"seamlessY": "Seamless Y",
"seamlessX&Y": "Seamless X & Y",
"seamLowThreshold": "Low",
"seed": "Seed",
"seedWeights": "Seed Weights",
@ -979,6 +983,8 @@
"upscaling": "Upscaling",
"useAll": "Use All",
"useCpuNoise": "Use CPU Noise",
"cpuNoise": "CPU Noise",
"gpuNoise": "GPU Noise",
"useInitImg": "Use Initial Image",
"usePrompt": "Use Prompt",
"useSeed": "Use Seed",

View File

@ -1,7 +1,7 @@
import { isAnyOf } from '@reduxjs/toolkit';
import { logger } from 'app/logging/logger';
import {
canvasBatchesAndSessionsReset,
canvasBatchIdsReset,
commitStagingAreaImage,
discardStagedImages,
} from 'features/canvas/store/canvasSlice';
@ -38,7 +38,7 @@ export const addCommitStagingAreaImageListener = () => {
})
);
}
dispatch(canvasBatchesAndSessionsReset());
dispatch(canvasBatchIdsReset());
} catch {
log.error('Failed to cancel canvas batches');
dispatch(

View File

@ -65,7 +65,6 @@ export const addControlNetImageProcessedListener = () => {
);
const enqueueResult = await req.unwrap();
req.reset();
console.log(enqueueResult.queue_item.session_id);
log.debug(
{ enqueueResult: parseify(enqueueResult) },
t('queue.graphQueued')

View File

@ -30,7 +30,7 @@ export const addInvocationCompleteEventListener = () => {
`Invocation complete (${action.payload.data.node.type})`
);
const { result, node, graph_execution_state_id } = data;
const { result, node, queue_batch_id } = data;
// This complete event has an associated image output
if (isImageOutput(result) && !nodeDenylist.includes(node.type)) {
@ -43,7 +43,7 @@ export const addInvocationCompleteEventListener = () => {
// Add canvas images to the staging area
if (
canvas.sessionIds.includes(graph_execution_state_id) &&
canvas.batchIds.includes(queue_batch_id) &&
[CANVAS_OUTPUT].includes(data.source_node_id)
) {
dispatch(addImageToStagingArea(imageDTO));
@ -76,7 +76,6 @@ export const addInvocationCompleteEventListener = () => {
categories: IMAGE_CATEGORIES,
},
(draft) => {
console.log(draft);
imagesAdapter.addOne(draft, imageDTO);
}
)

View File

@ -1,5 +1,4 @@
import { logger } from 'app/logging/logger';
import { canvasSessionIdAdded } from 'features/canvas/store/canvasSlice';
import { queueApi, queueItemsAdapter } from 'services/api/endpoints/queue';
import {
appSocketQueueItemStatusChanged,
@ -10,12 +9,11 @@ import { startAppListening } from '../..';
export const addSocketQueueItemStatusChangedEventListener = () => {
startAppListening({
actionCreator: socketQueueItemStatusChanged,
effect: (action, { dispatch, getState }) => {
effect: async (action, { dispatch }) => {
const log = logger('socketio');
const {
queue_item_id: item_id,
batch_id,
graph_execution_state_id,
queue_batch_id,
status,
} = action.payload.data;
log.debug(
@ -26,9 +24,6 @@ export const addSocketQueueItemStatusChangedEventListener = () => {
dispatch(
queueApi.util.updateQueryData('listQueueItems', undefined, (draft) => {
if (!draft) {
console.log('no draft!');
}
queueItemsAdapter.updateOne(draft, {
id: item_id,
changes: action.payload.data,
@ -36,21 +31,23 @@ export const addSocketQueueItemStatusChangedEventListener = () => {
})
);
const state = getState();
if (state.canvas.batchIds.includes(batch_id)) {
dispatch(canvasSessionIdAdded(graph_execution_state_id));
}
dispatch(
queueApi.util.invalidateTags([
'CurrentSessionQueueItem',
'NextSessionQueueItem',
'SessionQueueStatus',
{ type: 'SessionQueueItem', id: item_id },
{ type: 'SessionQueueItemDTO', id: item_id },
{ type: 'BatchStatus', id: batch_id },
{ type: 'BatchStatus', id: queue_batch_id },
])
);
const req = dispatch(
queueApi.endpoints.getQueueStatus.initiate(undefined, {
forceRefetch: true,
})
);
await req.unwrap();
req.unsubscribe();
},
});
};

View File

@ -13,7 +13,6 @@ import {
Image,
} from '@chakra-ui/react';
import { useAppSelector } from '../../app/store/storeHooks';
import { systemSelector } from '../../features/system/store/systemSelectors';
import { useTranslation } from 'react-i18next';
interface Props extends PopoverProps {
@ -33,7 +32,9 @@ function IAIInformationalPopover({
children,
placement,
}: Props): JSX.Element {
const { shouldDisableInformationalPopovers } = useAppSelector(systemSelector);
const shouldDisableInformationalPopovers = useAppSelector(
(state) => state.system.shouldDisableInformationalPopovers
);
const { t } = useTranslation();
const heading = t(`popovers.${details}.heading`);

View File

@ -11,12 +11,12 @@ const selector = createSelector(
({ system, canvas }) => {
const { denoiseProgress } = system;
const { boundingBox } = canvas.layerState.stagingArea;
const { sessionIds } = canvas;
const { batchIds } = canvas;
return {
boundingBox,
progressImage:
denoiseProgress && sessionIds.includes(denoiseProgress.session_id)
denoiseProgress && batchIds.includes(denoiseProgress.batch_id)
? denoiseProgress.progress_image
: undefined,
};

View File

@ -85,7 +85,6 @@ export const initialCanvasState: CanvasState = {
stageDimensions: { width: 0, height: 0 },
stageScale: 1,
tool: 'brush',
sessionIds: [],
batchIds: [],
};
@ -302,11 +301,7 @@ export const canvasSlice = createSlice({
canvasBatchIdAdded: (state, action: PayloadAction<string>) => {
state.batchIds.push(action.payload);
},
canvasSessionIdAdded: (state, action: PayloadAction<string>) => {
state.sessionIds.push(action.payload);
},
canvasBatchesAndSessionsReset: (state) => {
state.sessionIds = [];
canvasBatchIdsReset: (state) => {
state.batchIds = [];
},
stagingAreaInitialized: (
@ -879,8 +874,7 @@ export const {
setShouldAntialias,
canvasResized,
canvasBatchIdAdded,
canvasSessionIdAdded,
canvasBatchesAndSessionsReset,
canvasBatchIdsReset,
} = canvasSlice.actions;
export default canvasSlice.reducer;

View File

@ -166,7 +166,6 @@ export interface CanvasState {
tool: CanvasTool;
generationMode?: GenerationMode;
batchIds: string[];
sessionIds: string[];
}
export type GenerationMode = 'txt2img' | 'img2img' | 'inpaint' | 'outpaint';

View File

@ -6,7 +6,6 @@ import IAISwitch from 'common/components/IAISwitch';
import { isIPAdapterEnableToggled } from 'features/controlNet/store/controlNetSlice';
import { memo, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import IAIInformationalPopover from 'common/components/IAIInformationalPopover';
const selector = createSelector(
stateSelector,
@ -28,16 +27,14 @@ const ParamIPAdapterFeatureToggle = () => {
}, [dispatch]);
return (
<IAIInformationalPopover details="dynamicPromptsToggle">
<IAISwitch
label={t('controlnet.enableIPAdapter')}
isChecked={isIPAdapterEnabled}
onChange={handleChange}
formControlProps={{
width: '100%',
}}
/>
</IAIInformationalPopover>
<IAISwitch
label={t('controlnet.enableIPAdapter')}
isChecked={isIPAdapterEnabled}
onChange={handleChange}
formControlProps={{
width: '100%',
}}
/>
);
};

View File

@ -871,7 +871,7 @@ const nodesSlice = createSlice({
nes.error = null;
nes.progress = null;
nes.progressImage = null;
// do not reset nes.outputs, this allows a user to inspect the output of a node across batches
nes.outputs = [];
});
}
});

View File

@ -1120,36 +1120,45 @@ export type LoRAMetadataItem = z.infer<typeof zLoRAMetadataItem>;
export const zCoreMetadata = z
.object({
app_version: z.string().nullish(),
generation_mode: z.string().nullish(),
created_by: z.string().nullish(),
positive_prompt: z.string().nullish(),
negative_prompt: z.string().nullish(),
width: z.number().int().nullish(),
height: z.number().int().nullish(),
seed: z.number().int().nullish(),
rand_device: z.string().nullish(),
cfg_scale: z.number().nullish(),
steps: z.number().int().nullish(),
scheduler: z.string().nullish(),
clip_skip: z.number().int().nullish(),
app_version: z.string().nullish().catch(null),
generation_mode: z.string().nullish().catch(null),
created_by: z.string().nullish().catch(null),
positive_prompt: z.string().nullish().catch(null),
negative_prompt: z.string().nullish().catch(null),
width: z.number().int().nullish().catch(null),
height: z.number().int().nullish().catch(null),
seed: z.number().int().nullish().catch(null),
rand_device: z.string().nullish().catch(null),
cfg_scale: z.number().nullish().catch(null),
steps: z.number().int().nullish().catch(null),
scheduler: z.string().nullish().catch(null),
clip_skip: z.number().int().nullish().catch(null),
model: z
.union([zMainModel.deepPartial(), zOnnxModel.deepPartial()])
.nullish(),
controlnets: z.array(zControlField.deepPartial()).nullish(),
loras: z.array(zLoRAMetadataItem).nullish(),
vae: zVaeModelField.nullish(),
strength: z.number().nullish(),
init_image: z.string().nullish(),
positive_style_prompt: z.string().nullish(),
negative_style_prompt: z.string().nullish(),
refiner_model: zSDXLRefinerModel.deepPartial().nullish(),
refiner_cfg_scale: z.number().nullish(),
refiner_steps: z.number().int().nullish(),
refiner_scheduler: z.string().nullish(),
refiner_positive_aesthetic_score: z.number().nullish(),
refiner_negative_aesthetic_score: z.number().nullish(),
refiner_start: z.number().nullish(),
.nullish()
.catch(null),
controlnets: z.array(zControlField.deepPartial()).nullish().catch(null),
loras: z
.array(
z.object({
lora: zLoRAModelField.deepPartial(),
weight: z.number(),
})
)
.nullish()
.catch(null),
vae: zVaeModelField.nullish().catch(null),
strength: z.number().nullish().catch(null),
init_image: z.string().nullish().catch(null),
positive_style_prompt: z.string().nullish().catch(null),
negative_style_prompt: z.string().nullish().catch(null),
refiner_model: zSDXLRefinerModel.deepPartial().nullish().catch(null),
refiner_cfg_scale: z.number().nullish().catch(null),
refiner_steps: z.number().int().nullish().catch(null),
refiner_scheduler: z.string().nullish().catch(null),
refiner_positive_aesthetic_score: z.number().nullish().catch(null),
refiner_negative_aesthetic_score: z.number().nullish().catch(null),
refiner_start: z.number().nullish().catch(null),
})
.passthrough();

View File

@ -1,7 +1,6 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import { ImageDTO, ImageToLatentsInvocation } from 'services/api/types';
import { addControlNetToLinearGraph } from './addControlNetToLinearGraph';
import { addIPAdapterToLinearGraph } from './addIPAdapterToLinearGraph';
@ -47,7 +46,6 @@ export const buildCanvasImageToImageGraph = (
vaePrecision,
clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
seamlessXAxis,
seamlessYAxis,
} = state.generation;
@ -70,9 +68,7 @@ export const buildCanvasImageToImageGraph = (
let modelLoaderNodeId = MAIN_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
/**
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the

View File

@ -61,7 +61,6 @@ export const buildCanvasInpaintGraph = (
img2imgStrength: strength,
seed,
vaePrecision,
shouldUseNoiseSettings,
shouldUseCpuNoise,
maskBlur,
maskBlurMethod,
@ -92,9 +91,7 @@ export const buildCanvasInpaintGraph = (
let modelLoaderNodeId = MAIN_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
const graph: NonNullableGraph = {
id: CANVAS_INPAINT_GRAPH,

View File

@ -63,7 +63,6 @@ export const buildCanvasOutpaintGraph = (
img2imgStrength: strength,
seed,
vaePrecision,
shouldUseNoiseSettings,
shouldUseCpuNoise,
maskBlur,
canvasCoherenceMode,
@ -96,9 +95,7 @@ export const buildCanvasOutpaintGraph = (
let modelLoaderNodeId = MAIN_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
const graph: NonNullableGraph = {
id: CANVAS_OUTPAINT_GRAPH,

View File

@ -1,7 +1,6 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import { ImageDTO, ImageToLatentsInvocation } from 'services/api/types';
import { addControlNetToLinearGraph } from './addControlNetToLinearGraph';
import { addIPAdapterToLinearGraph } from './addIPAdapterToLinearGraph';
@ -48,7 +47,6 @@ export const buildCanvasSDXLImageToImageGraph = (
vaePrecision,
clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
seamlessXAxis,
seamlessYAxis,
} = state.generation;
@ -78,9 +76,7 @@ export const buildCanvasSDXLImageToImageGraph = (
// Model Loader ID
let modelLoaderNodeId = SDXL_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
// Construct Style Prompt
const { joinedPositiveStylePrompt, joinedNegativeStylePrompt } =

View File

@ -62,7 +62,6 @@ export const buildCanvasSDXLInpaintGraph = (
steps,
seed,
vaePrecision,
shouldUseNoiseSettings,
shouldUseCpuNoise,
maskBlur,
maskBlurMethod,
@ -98,9 +97,7 @@ export const buildCanvasSDXLInpaintGraph = (
let modelLoaderNodeId = SDXL_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
// Construct Style Prompt
const { joinedPositiveStylePrompt, joinedNegativeStylePrompt } =

View File

@ -64,7 +64,6 @@ export const buildCanvasSDXLOutpaintGraph = (
steps,
seed,
vaePrecision,
shouldUseNoiseSettings,
shouldUseCpuNoise,
maskBlur,
canvasCoherenceMode,
@ -102,9 +101,7 @@ export const buildCanvasSDXLOutpaintGraph = (
let modelLoaderNodeId = SDXL_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
// Construct Style Prompt
const { joinedPositiveStylePrompt, joinedNegativeStylePrompt } =

View File

@ -1,7 +1,6 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import {
DenoiseLatentsInvocation,
ONNXTextToLatentsInvocation,
@ -49,7 +48,6 @@ export const buildCanvasSDXLTextToImageGraph = (
vaePrecision,
clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
seamlessXAxis,
seamlessYAxis,
} = state.generation;
@ -72,9 +70,7 @@ export const buildCanvasSDXLTextToImageGraph = (
throw new Error('No model found in state');
}
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
const isUsingOnnxModel = model.model_type === 'onnx';

View File

@ -1,7 +1,6 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import {
DenoiseLatentsInvocation,
ONNXTextToLatentsInvocation,
@ -47,7 +46,6 @@ export const buildCanvasTextToImageGraph = (
vaePrecision,
clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
seamlessXAxis,
seamlessYAxis,
} = state.generation;
@ -68,9 +66,7 @@ export const buildCanvasTextToImageGraph = (
throw new Error('No model found in state');
}
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
const isUsingOnnxModel = model.model_type === 'onnx';

View File

@ -1,7 +1,6 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import {
ImageResizeInvocation,
ImageToLatentsInvocation,
@ -51,7 +50,6 @@ export const buildLinearImageToImageGraph = (
height,
clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
vaePrecision,
seamlessXAxis,
seamlessYAxis,
@ -81,9 +79,7 @@ export const buildLinearImageToImageGraph = (
let modelLoaderNodeId = MAIN_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
// copy-pasted graph from node editor, filled in with state values & friendly node ids
const graph: NonNullableGraph = {

View File

@ -1,7 +1,6 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import {
ImageResizeInvocation,
ImageToLatentsInvocation,
@ -52,7 +51,6 @@ export const buildLinearSDXLImageToImageGraph = (
height,
clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
vaePrecision,
seamlessXAxis,
seamlessYAxis,
@ -91,9 +89,7 @@ export const buildLinearSDXLImageToImageGraph = (
// Model Loader ID
let modelLoaderNodeId = SDXL_MODEL_LOADER;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
// Construct Style Prompt
const { joinedPositiveStylePrompt, joinedNegativeStylePrompt } =

View File

@ -1,7 +1,6 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import { addControlNetToLinearGraph } from './addControlNetToLinearGraph';
import { addIPAdapterToLinearGraph } from './addIPAdapterToLinearGraph';
import { addNSFWCheckerToGraph } from './addNSFWCheckerToGraph';
@ -41,7 +40,6 @@ export const buildLinearSDXLTextToImageGraph = (
height,
clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
vaePrecision,
seamlessXAxis,
seamlessYAxis,
@ -54,9 +52,8 @@ export const buildLinearSDXLTextToImageGraph = (
refinerStart,
} = state.sdxl;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
if (!model) {
log.error('No model found in state');
throw new Error('No model found in state');

View File

@ -1,7 +1,6 @@
import { logger } from 'app/logging/logger';
import { RootState } from 'app/store/store';
import { NonNullableGraph } from 'features/nodes/types/types';
import { initialGenerationState } from 'features/parameters/store/generationSlice';
import {
DenoiseLatentsInvocation,
ONNXTextToLatentsInvocation,
@ -43,16 +42,13 @@ export const buildLinearTextToImageGraph = (
height,
clipSkip,
shouldUseCpuNoise,
shouldUseNoiseSettings,
vaePrecision,
seamlessXAxis,
seamlessYAxis,
seed,
} = state.generation;
const use_cpu = shouldUseNoiseSettings
? shouldUseCpuNoise
: initialGenerationState.shouldUseCpuNoise;
const use_cpu = shouldUseCpuNoise;
if (!model) {
log.error('No model found in state');

View File

@ -1,37 +1,64 @@
import { Flex } from '@chakra-ui/react';
import { Divider, Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit';
import { RootState, stateSelector } from 'app/store/store';
import { useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAICollapse from 'common/components/IAICollapse';
import ParamClipSkip from './ParamClipSkip';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { ParamCpuNoiseToggle } from '../Noise/ParamCpuNoise';
import ParamSeamless from '../Seamless/ParamSeamless';
import ParamClipSkip from './ParamClipSkip';
const selector = createSelector(
stateSelector,
(state: RootState) => {
const clipSkip = state.generation.clipSkip;
return {
activeLabel: clipSkip > 0 ? 'Clip Skip' : undefined,
};
const { clipSkip, seamlessXAxis, seamlessYAxis, shouldUseCpuNoise } =
state.generation;
return { clipSkip, seamlessXAxis, seamlessYAxis, shouldUseCpuNoise };
},
defaultSelectorOptions
);
export default function ParamAdvancedCollapse() {
const { activeLabel } = useAppSelector(selector);
const shouldShowAdvancedOptions = useAppSelector(
(state: RootState) => state.generation.shouldShowAdvancedOptions
);
const { clipSkip, seamlessXAxis, seamlessYAxis, shouldUseCpuNoise } =
useAppSelector(selector);
const { t } = useTranslation();
if (!shouldShowAdvancedOptions) {
return null;
}
const activeLabel = useMemo(() => {
const activeLabel: string[] = [];
if (shouldUseCpuNoise) {
activeLabel.push(t('parameters.cpuNoise'));
} else {
activeLabel.push(t('parameters.gpuNoise'));
}
if (clipSkip > 0) {
activeLabel.push(
t('parameters.clipSkipWithLayerCount', { layerCount: clipSkip })
);
}
if (seamlessXAxis && seamlessYAxis) {
activeLabel.push(t('parameters.seamlessX&Y'));
} else if (seamlessXAxis) {
activeLabel.push(t('parameters.seamlessX'));
} else if (seamlessYAxis) {
activeLabel.push(t('parameters.seamlessY'));
}
return activeLabel.join(', ');
}, [clipSkip, seamlessXAxis, seamlessYAxis, shouldUseCpuNoise, t]);
return (
<IAICollapse label={t('common.advanced')} activeLabel={activeLabel}>
<Flex sx={{ flexDir: 'column', gap: 2 }}>
<ParamSeamless />
<Divider />
<ParamClipSkip />
<Divider pt={2} />
<ParamCpuNoiseToggle />
</Flex>
</IAICollapse>
);

View File

@ -1,37 +1,27 @@
import { createSelector } from '@reduxjs/toolkit';
import { stateSelector } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAIInformationalPopover from 'common/components/IAIInformationalPopover';
import IAISwitch from 'common/components/IAISwitch';
import { shouldUseCpuNoiseChanged } from 'features/parameters/store/generationSlice';
import { ChangeEvent } from 'react';
import { ChangeEvent, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
const selector = createSelector(
stateSelector,
(state) => {
const { shouldUseNoiseSettings, shouldUseCpuNoise } = state.generation;
return {
isDisabled: !shouldUseNoiseSettings,
shouldUseCpuNoise,
};
},
defaultSelectorOptions
);
export const ParamCpuNoiseToggle = () => {
const dispatch = useAppDispatch();
const { isDisabled, shouldUseCpuNoise } = useAppSelector(selector);
const shouldUseCpuNoise = useAppSelector(
(state) => state.generation.shouldUseCpuNoise
);
const { t } = useTranslation();
const handleChange = (e: ChangeEvent<HTMLInputElement>) =>
dispatch(shouldUseCpuNoiseChanged(e.target.checked));
const handleChange = useCallback(
(e: ChangeEvent<HTMLInputElement>) => {
dispatch(shouldUseCpuNoiseChanged(e.target.checked));
},
[dispatch]
);
return (
<IAIInformationalPopover details="noiseUseCPU">
<IAISwitch
isDisabled={isDisabled}
label={t('parameters.useCpuNoise')}
isChecked={shouldUseCpuNoise}
onChange={handleChange}

View File

@ -1,55 +0,0 @@
import { Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit';
import { stateSelector } from 'app/store/store';
import { useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAICollapse from 'common/components/IAICollapse';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { ParamCpuNoiseToggle } from './ParamCpuNoise';
import ParamNoiseThreshold from './ParamNoiseThreshold';
import { ParamNoiseToggle } from './ParamNoiseToggle';
import ParamPerlinNoise from './ParamPerlinNoise';
const selector = createSelector(
stateSelector,
(state) => {
const { shouldUseNoiseSettings } = state.generation;
return {
activeLabel: shouldUseNoiseSettings ? 'Enabled' : undefined,
};
},
defaultSelectorOptions
);
const ParamNoiseCollapse = () => {
const { t } = useTranslation();
const isNoiseEnabled = useFeatureStatus('noise').isFeatureEnabled;
const isPerlinNoiseEnabled = useFeatureStatus('perlinNoise').isFeatureEnabled;
const isNoiseThresholdEnabled =
useFeatureStatus('noiseThreshold').isFeatureEnabled;
const { activeLabel } = useAppSelector(selector);
if (!isNoiseEnabled) {
return null;
}
return (
<IAICollapse
label={t('parameters.noiseSettings')}
activeLabel={activeLabel}
>
<Flex sx={{ gap: 2, flexDirection: 'column' }}>
<ParamNoiseToggle />
<ParamCpuNoiseToggle />
{isPerlinNoiseEnabled && <ParamPerlinNoise />}
{isNoiseThresholdEnabled && <ParamNoiseThreshold />}
</Flex>
</IAICollapse>
);
};
export default memo(ParamNoiseCollapse);

View File

@ -9,9 +9,8 @@ import { useTranslation } from 'react-i18next';
const selector = createSelector(
stateSelector,
(state) => {
const { shouldUseNoiseSettings, threshold } = state.generation;
const { threshold } = state.generation;
return {
isDisabled: !shouldUseNoiseSettings,
threshold,
};
},
@ -20,12 +19,11 @@ const selector = createSelector(
export default function ParamNoiseThreshold() {
const dispatch = useAppDispatch();
const { threshold, isDisabled } = useAppSelector(selector);
const { threshold } = useAppSelector(selector);
const { t } = useTranslation();
return (
<IAISlider
isDisabled={isDisabled}
label={t('parameters.noiseThreshold')}
min={0}
max={20}

View File

@ -1,29 +0,0 @@
import type { RootState } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAIInformationalPopover from 'common/components/IAIInformationalPopover';
import IAISwitch from 'common/components/IAISwitch';
import { setShouldUseNoiseSettings } from 'features/parameters/store/generationSlice';
import { ChangeEvent } from 'react';
import { useTranslation } from 'react-i18next';
export const ParamNoiseToggle = () => {
const dispatch = useAppDispatch();
const { t } = useTranslation();
const shouldUseNoiseSettings = useAppSelector(
(state: RootState) => state.generation.shouldUseNoiseSettings
);
const handleChange = (e: ChangeEvent<HTMLInputElement>) =>
dispatch(setShouldUseNoiseSettings(e.target.checked));
return (
<IAIInformationalPopover details="noiseEnable">
<IAISwitch
label={t('parameters.enableNoiseSettings')}
isChecked={shouldUseNoiseSettings}
onChange={handleChange}
/>
</IAIInformationalPopover>
);
};

View File

@ -9,9 +9,8 @@ import { useTranslation } from 'react-i18next';
const selector = createSelector(
stateSelector,
(state) => {
const { shouldUseNoiseSettings, perlin } = state.generation;
const { perlin } = state.generation;
return {
isDisabled: !shouldUseNoiseSettings,
perlin,
};
},
@ -20,12 +19,11 @@ const selector = createSelector(
export default function ParamPerlinNoise() {
const dispatch = useAppDispatch();
const { perlin, isDisabled } = useAppSelector(selector);
const { perlin } = useAppSelector(selector);
const { t } = useTranslation();
return (
<IAISlider
isDisabled={isDisabled}
label={t('parameters.perlinNoise')}
min={0}
max={1}

View File

@ -0,0 +1,32 @@
import { Box, Flex, FormControl, FormLabel } from '@chakra-ui/react';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import ParamSeamlessXAxis from './ParamSeamlessXAxis';
import ParamSeamlessYAxis from './ParamSeamlessYAxis';
const ParamSeamless = () => {
const { t } = useTranslation();
const isSeamlessEnabled = useFeatureStatus('seamless').isFeatureEnabled;
if (!isSeamlessEnabled) {
return null;
}
return (
<FormControl>
<FormLabel>{t('parameters.seamlessTiling')}</FormLabel>{' '}
<Flex sx={{ gap: 5 }}>
<Box flexGrow={1}>
<ParamSeamlessXAxis />
</Box>
<Box flexGrow={1}>
<ParamSeamlessYAxis />
</Box>
</Flex>
</FormControl>
);
};
export default memo(ParamSeamless);

View File

@ -1,65 +0,0 @@
import { Box, Flex } from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAICollapse from 'common/components/IAICollapse';
import { generationSelector } from 'features/parameters/store/generationSelectors';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import ParamSeamlessXAxis from './ParamSeamlessXAxis';
import ParamSeamlessYAxis from './ParamSeamlessYAxis';
const getActiveLabel = (seamlessXAxis: boolean, seamlessYAxis: boolean) => {
if (seamlessXAxis && seamlessYAxis) {
return 'X & Y';
}
if (seamlessXAxis) {
return 'X';
}
if (seamlessYAxis) {
return 'Y';
}
};
const selector = createSelector(
generationSelector,
(generation) => {
const { seamlessXAxis, seamlessYAxis } = generation;
const activeLabel = getActiveLabel(seamlessXAxis, seamlessYAxis);
return { activeLabel };
},
defaultSelectorOptions
);
const ParamSeamlessCollapse = () => {
const { t } = useTranslation();
const { activeLabel } = useAppSelector(selector);
const isSeamlessEnabled = useFeatureStatus('seamless').isFeatureEnabled;
if (!isSeamlessEnabled) {
return null;
}
return (
<IAICollapse
label={t('parameters.seamlessTiling')}
activeLabel={activeLabel}
>
<Flex sx={{ gap: 5 }}>
<Box flexGrow={1}>
<ParamSeamlessXAxis />
</Box>
<Box flexGrow={1}>
<ParamSeamlessYAxis />
</Box>
</Flex>
</IAICollapse>
);
};
export default memo(ParamSeamlessCollapse);

View File

@ -46,7 +46,6 @@ export interface GenerationState {
shouldFitToWidthHeight: boolean;
shouldGenerateVariations: boolean;
shouldRandomizeSeed: boolean;
shouldUseNoiseSettings: boolean;
steps: StepsParam;
threshold: number;
infillTileSize: number;
@ -88,7 +87,6 @@ export const initialGenerationState: GenerationState = {
shouldFitToWidthHeight: true,
shouldGenerateVariations: false,
shouldRandomizeSeed: true,
shouldUseNoiseSettings: false,
steps: 50,
threshold: 0,
infillTileSize: 32,
@ -244,9 +242,6 @@ export const generationSlice = createSlice({
setVerticalSymmetrySteps: (state, action: PayloadAction<number>) => {
state.verticalSymmetrySteps = action.payload;
},
setShouldUseNoiseSettings: (state, action: PayloadAction<boolean>) => {
state.shouldUseNoiseSettings = action.payload;
},
initialImageChanged: (state, action: PayloadAction<ImageDTO>) => {
const { image_name, width, height } = action.payload;
state.initialImage = { imageName: image_name, width, height };
@ -278,12 +273,6 @@ export const generationSlice = createSlice({
shouldUseCpuNoiseChanged: (state, action: PayloadAction<boolean>) => {
state.shouldUseCpuNoise = action.payload;
},
setShouldShowAdvancedOptions: (state, action: PayloadAction<boolean>) => {
state.shouldShowAdvancedOptions = action.payload;
if (!action.payload) {
state.clipSkip = 0;
}
},
setAspectRatio: (state, action: PayloadAction<number | null>) => {
const newAspectRatio = action.payload;
state.aspectRatio = newAspectRatio;
@ -313,12 +302,6 @@ export const generationSlice = createSlice({
}
}
});
builder.addCase(setShouldShowAdvancedOptions, (state, action) => {
const advancedOptionsStatus = action.payload;
if (!advancedOptionsStatus) {
state.clipSkip = 0;
}
});
},
});
@ -359,12 +342,10 @@ export const {
initialImageChanged,
modelChanged,
vaeSelected,
setShouldUseNoiseSettings,
setSeamlessXAxis,
setSeamlessYAxis,
setClipSkip,
shouldUseCpuNoiseChanged,
setShouldShowAdvancedOptions,
setAspectRatio,
setShouldLockAspectRatio,
vaePrecisionChanged,

View File

@ -59,16 +59,22 @@ const QueueItemComponent = ({ index, item, context }: InnerItemProps) => {
return `${seconds}s`;
}, [item]);
const isCanceled = useMemo(
() => ['canceled', 'completed', 'failed'].includes(item.status),
[item.status]
);
return (
<Flex
flexDir="column"
borderRadius="base"
aria-selected={isOpen}
fontSize="sm"
borderRadius="base"
justifyContent="center"
sx={sx}
>
<Flex
minH={9}
alignItems="center"
gap={4}
p={1.5}
@ -128,10 +134,8 @@ const QueueItemComponent = ({ index, item, context }: InnerItemProps) => {
<ButtonGroup size="xs" variant="ghost">
<IAIIconButton
onClick={handleCancelQueueItem}
isDisabled={isCanceled}
isLoading={isLoading}
isDisabled={['canceled', 'completed', 'failed'].includes(
item.status
)}
aria-label={t('queue.cancelItem')}
icon={<FaTimes />}
/>

View File

@ -31,7 +31,7 @@ const QueueItemComponent = ({ queueItemDTO }: Props) => {
const statusAndTiming = useMemo(() => {
if (!queueItem) {
return '';
return t('common.loading');
}
if (!queueItem.completed_at || !queueItem.started_at) {
return t(`queue.${queueItem.status}`);
@ -62,6 +62,7 @@ const QueueItemComponent = ({ queueItemDTO }: Props) => {
justifyContent="space-between"
alignItems="center"
borderRadius="base"
h={20}
>
<QueueItemData label={t('queue.status')} data={statusAndTiming} />
<QueueItemData label={t('queue.item')} data={item_id} />
@ -136,9 +137,17 @@ type QueueItemDataProps = { label: string; data: ReactNode };
const QueueItemData = ({ label, data }: QueueItemDataProps) => {
return (
<Flex flexDir="column" p={1} gap={1} overflow="hidden">
<Flex
flexDir="column"
justifyContent="flex-start"
p={1}
gap={1}
overflow="hidden"
h="full"
w="full"
>
<Heading
size="sm"
size="md"
overflow="hidden"
textOverflow="ellipsis"
whiteSpace="nowrap"

View File

@ -21,16 +21,16 @@ const QueueListHeader = () => {
>
<Text variant="subtext">#</Text>
</Flex>
<Flex w={COLUMN_WIDTHS.statusBadge} alignItems="center">
<Flex ps={0.5} w={COLUMN_WIDTHS.statusBadge} alignItems="center">
<Text variant="subtext">status</Text>
</Flex>
<Flex w={COLUMN_WIDTHS.time} alignItems="center">
<Flex ps={0.5} w={COLUMN_WIDTHS.time} alignItems="center">
<Text variant="subtext">time</Text>
</Flex>
<Flex w={COLUMN_WIDTHS.batchId} alignItems="center">
<Flex ps={0.5} w={COLUMN_WIDTHS.batchId} alignItems="center">
<Text variant="subtext">batch</Text>
</Flex>
<Flex alignItems="center" w={COLUMN_WIDTHS.fieldValues}>
<Flex ps={0.5} w={COLUMN_WIDTHS.fieldValues} alignItems="center">
<Text variant="subtext">batch field values</Text>
</Flex>
</Flex>

View File

@ -1,8 +1,7 @@
import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/ParamDynamicPromptsCollapse';
import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse';
import ParamAdvancedCollapse from 'features/parameters/components/Parameters/Advanced/ParamAdvancedCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse';
import { memo } from 'react';
import ParamSDXLPromptArea from './ParamSDXLPromptArea';
import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse';
@ -17,8 +16,7 @@ const SDXLImageToImageTabParameters = () => {
<ParamControlNetCollapse />
<ParamLoraCollapse />
<ParamDynamicPromptsCollapse />
<ParamNoiseCollapse />
<ParamSeamlessCollapse />
<ParamAdvancedCollapse />
</>
);
};

View File

@ -1,8 +1,7 @@
import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/ParamDynamicPromptsCollapse';
import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse';
import ParamAdvancedCollapse from 'features/parameters/components/Parameters/Advanced/ParamAdvancedCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse';
import TextToImageTabCoreParameters from 'features/ui/components/tabs/TextToImage/TextToImageTabCoreParameters';
import { memo } from 'react';
import ParamSDXLPromptArea from './ParamSDXLPromptArea';
@ -17,8 +16,7 @@ const SDXLTextToImageTabParameters = () => {
<ParamControlNetCollapse />
<ParamLoraCollapse />
<ParamDynamicPromptsCollapse />
<ParamNoiseCollapse />
<ParamSeamlessCollapse />
<ParamAdvancedCollapse />
</>
);
};

View File

@ -1,10 +1,9 @@
import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/ParamDynamicPromptsCollapse';
import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse';
import ParamAdvancedCollapse from 'features/parameters/components/Parameters/Advanced/ParamAdvancedCollapse';
import ParamCompositingSettingsCollapse from 'features/parameters/components/Parameters/Canvas/Compositing/ParamCompositingSettingsCollapse';
import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse';
import ParamSDXLPromptArea from './ParamSDXLPromptArea';
import ParamSDXLRefinerCollapse from './ParamSDXLRefinerCollapse';
import SDXLUnifiedCanvasTabCoreParameters from './SDXLUnifiedCanvasTabCoreParameters';
@ -18,10 +17,9 @@ export default function SDXLUnifiedCanvasTabParameters() {
<ParamControlNetCollapse />
<ParamLoraCollapse />
<ParamDynamicPromptsCollapse />
<ParamNoiseCollapse />
<ParamInfillAndScalingCollapse />
<ParamCompositingSettingsCollapse />
<ParamSeamlessCollapse />
<ParamAdvancedCollapse />
</>
);
}

View File

@ -19,7 +19,6 @@ import { stateSelector } from 'app/store/store';
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
import IAIButton from 'common/components/IAIButton';
import IAIMantineSelect from 'common/components/IAIMantineSelect';
import { setShouldShowAdvancedOptions } from 'features/parameters/store/generationSlice';
import {
consoleLogLevelChanged,
setEnableImageDebugging,
@ -30,6 +29,7 @@ import {
shouldUseNSFWCheckerChanged,
shouldUseWatermarkerChanged,
} from 'features/system/store/systemSlice';
import { LANGUAGES } from 'features/system/store/types';
import {
setShouldAutoChangeDimensions,
setShouldShowProgressInViewer,
@ -55,11 +55,10 @@ import SettingSwitch from './SettingSwitch';
import SettingsClearIntermediates from './SettingsClearIntermediates';
import SettingsSchedulers from './SettingsSchedulers';
import StyledFlex from './StyledFlex';
import { LANGUAGES } from 'features/system/store/types';
const selector = createSelector(
[stateSelector],
({ system, ui, generation }) => {
({ system, ui }) => {
const {
shouldConfirmOnDelete,
enableImageDebugging,
@ -77,8 +76,6 @@ const selector = createSelector(
shouldAutoChangeDimensions,
} = ui;
const { shouldShowAdvancedOptions } = generation;
return {
shouldConfirmOnDelete,
enableImageDebugging,
@ -87,7 +84,6 @@ const selector = createSelector(
consoleLogLevel,
shouldLogToConsole,
shouldAntialiasProgressImage,
shouldShowAdvancedOptions,
shouldUseNSFWChecker,
shouldUseWatermarker,
shouldAutoChangeDimensions,
@ -121,8 +117,6 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
const shouldShowDeveloperSettings =
config?.shouldShowDeveloperSettings ?? true;
const shouldShowResetWebUiText = config?.shouldShowResetWebUiText ?? true;
const shouldShowAdvancedOptionsSettings =
config?.shouldShowAdvancedOptionsSettings ?? true;
const shouldShowClearIntermediates =
config?.shouldShowClearIntermediates ?? true;
const shouldShowLocalizationToggle =
@ -164,7 +158,6 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
consoleLogLevel,
shouldLogToConsole,
shouldAntialiasProgressImage,
shouldShowAdvancedOptions,
shouldUseNSFWChecker,
shouldUseWatermarker,
shouldAutoChangeDimensions,
@ -246,15 +239,6 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
dispatch(setShouldConfirmOnDelete(e.target.checked))
}
/>
{shouldShowAdvancedOptionsSettings && (
<SettingSwitch
label={t('settings.showAdvancedOptions')}
isChecked={shouldShowAdvancedOptions}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
dispatch(setShouldShowAdvancedOptions(e.target.checked))
}
/>
)}
</StyledFlex>
<StyledFlex>

View File

@ -2,8 +2,6 @@ import { createSelector } from '@reduxjs/toolkit';
import { stateSelector } from 'app/store/store';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
export const systemSelector = (state: RootState) => state.system;
export const languageSelector = createSelector(
stateSelector,
({ system }) => system.language,

View File

@ -120,6 +120,7 @@ export const systemSlice = createSlice({
order,
progress_image,
graph_execution_state_id: session_id,
queue_batch_id: batch_id,
} = action.payload.data;
state.denoiseProgress = {
@ -129,6 +130,7 @@ export const systemSlice = createSlice({
percentage: calculateStepPercentage(step, total_steps, order),
progress_image,
session_id,
batch_id,
};
state.status = 'PROCESSING';

View File

@ -12,6 +12,7 @@ export type SystemStatus =
export type DenoiseProgress = {
session_id: string;
batch_id: string;
progress_image: ProgressImage | null | undefined;
step: number;
total_steps: number;

View File

@ -2,9 +2,7 @@ import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/Para
import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse';
import ParamAdvancedCollapse from 'features/parameters/components/Parameters/Advanced/ParamAdvancedCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ParamPromptArea from 'features/parameters/components/Parameters/Prompt/ParamPromptArea';
import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse';
import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse';
import { memo } from 'react';
import ImageToImageTabCoreParameters from './ImageToImageTabCoreParameters';
@ -17,9 +15,7 @@ const ImageToImageTabParameters = () => {
<ParamControlNetCollapse />
<ParamLoraCollapse />
<ParamDynamicPromptsCollapse />
<ParamNoiseCollapse />
<ParamSymmetryCollapse />
<ParamSeamlessCollapse />
<ParamAdvancedCollapse />
</>
);

View File

@ -58,7 +58,6 @@ export default function SimpleAddModels() {
})
.catch((error) => {
if (error) {
console.log(error);
dispatch(
addToast(
makeToast({

View File

@ -2,8 +2,6 @@ import ParamDynamicPromptsCollapse from 'features/dynamicPrompts/components/Para
import ParamLoraCollapse from 'features/lora/components/ParamLoraCollapse';
import ParamAdvancedCollapse from 'features/parameters/components/Parameters/Advanced/ParamAdvancedCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamNoiseCollapse from 'features/parameters/components/Parameters/Noise/ParamNoiseCollapse';
import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse';
import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse';
import { memo } from 'react';
import ParamPromptArea from '../../../../parameters/components/Parameters/Prompt/ParamPromptArea';
@ -17,9 +15,7 @@ const TextToImageTabParameters = () => {
<ParamControlNetCollapse />
<ParamLoraCollapse />
<ParamDynamicPromptsCollapse />
<ParamNoiseCollapse />
<ParamSymmetryCollapse />
<ParamSeamlessCollapse />
<ParamAdvancedCollapse />
</>
);

View File

@ -5,7 +5,6 @@ import ParamCompositingSettingsCollapse from 'features/parameters/components/Par
import ParamInfillAndScalingCollapse from 'features/parameters/components/Parameters/Canvas/InfillAndScaling/ParamInfillAndScalingCollapse';
import ParamControlNetCollapse from 'features/parameters/components/Parameters/ControlNet/ParamControlNetCollapse';
import ParamPromptArea from 'features/parameters/components/Parameters/Prompt/ParamPromptArea';
import ParamSeamlessCollapse from 'features/parameters/components/Parameters/Seamless/ParamSeamlessCollapse';
import ParamSymmetryCollapse from 'features/parameters/components/Parameters/Symmetry/ParamSymmetryCollapse';
import { memo } from 'react';
import UnifiedCanvasCoreParameters from './UnifiedCanvasCoreParameters';
@ -21,7 +20,6 @@ const UnifiedCanvasParameters = () => {
<ParamSymmetryCollapse />
<ParamInfillAndScalingCollapse />
<ParamCompositingSettingsCollapse />
<ParamSeamlessCollapse />
<ParamAdvancedCollapse />
</>
);

View File

@ -34,7 +34,8 @@ export type BaseNode = {
export type ModelLoadStartedEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
model_name: string;
base_model: BaseModelType;
@ -44,7 +45,8 @@ export type ModelLoadStartedEvent = {
export type ModelLoadCompletedEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
model_name: string;
base_model: BaseModelType;
@ -62,7 +64,8 @@ export type ModelLoadCompletedEvent = {
*/
export type GeneratorProgressEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
node_id: string;
source_node_id: string;
@ -81,7 +84,8 @@ export type GeneratorProgressEvent = {
*/
export type InvocationCompleteEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
node: BaseNode;
source_node_id: string;
@ -95,7 +99,8 @@ export type InvocationCompleteEvent = {
*/
export type InvocationErrorEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
node: BaseNode;
source_node_id: string;
@ -110,7 +115,8 @@ export type InvocationErrorEvent = {
*/
export type InvocationStartedEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
node: BaseNode;
source_node_id: string;
@ -123,7 +129,8 @@ export type InvocationStartedEvent = {
*/
export type GraphExecutionStateCompleteEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
};
@ -134,7 +141,8 @@ export type GraphExecutionStateCompleteEvent = {
*/
export type SessionRetrievalErrorEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
error_type: string;
error: string;
@ -147,7 +155,8 @@ export type SessionRetrievalErrorEvent = {
*/
export type InvocationRetrievalErrorEvent = {
queue_id: string;
queue_item_id: string;
queue_item_id: number;
queue_batch_id: string;
graph_execution_state_id: string;
node_id: string;
error_type: string;
@ -161,8 +170,8 @@ export type InvocationRetrievalErrorEvent = {
*/
export type QueueItemStatusChangedEvent = {
queue_id: string;
queue_item_id: string;
batch_id: string;
queue_item_id: number;
queue_batch_id: string;
session_id: string;
graph_execution_state_id: string;
status: components['schemas']['SessionQueueItemDTO']['status'];

View File

@ -75,7 +75,13 @@ def invoke_next(g: GraphExecutionState, services: InvocationServices) -> tuple[B
print(f"invoking {n.id}: {type(n)}")
o = n.invoke(
InvocationContext(queue_item_id="1", queue_id=DEFAULT_QUEUE_ID, services=services, graph_execution_state_id="1")
InvocationContext(
queue_batch_id="1",
queue_item_id=1,
queue_id=DEFAULT_QUEUE_ID,
services=services,
graph_execution_state_id="1",
)
)
g.complete(n.id, o)

View File

@ -102,7 +102,12 @@ def test_can_create_graph_state_from_graph(mock_invoker: Invoker, simple_graph):
# @pytest.mark.xfail(reason = "Requires fixing following the model manager refactor")
def test_can_invoke(mock_invoker: Invoker, simple_graph):
g = mock_invoker.create_execution_state(graph=simple_graph)
invocation_id = mock_invoker.invoke(queue_item_id="1", queue_id=DEFAULT_QUEUE_ID, graph_execution_state=g)
invocation_id = mock_invoker.invoke(
session_queue_batch_id="1",
session_queue_item_id=1,
session_queue_id=DEFAULT_QUEUE_ID,
graph_execution_state=g,
)
assert invocation_id is not None
def has_executed_any(g: GraphExecutionState):
@ -120,7 +125,11 @@ def test_can_invoke(mock_invoker: Invoker, simple_graph):
def test_can_invoke_all(mock_invoker: Invoker, simple_graph):
g = mock_invoker.create_execution_state(graph=simple_graph)
invocation_id = mock_invoker.invoke(
queue_item_id="1", queue_id=DEFAULT_QUEUE_ID, graph_execution_state=g, invoke_all=True
session_queue_batch_id="1",
session_queue_item_id=1,
session_queue_id=DEFAULT_QUEUE_ID,
graph_execution_state=g,
invoke_all=True,
)
assert invocation_id is not None
@ -140,7 +149,13 @@ def test_handles_errors(mock_invoker: Invoker):
g = mock_invoker.create_execution_state()
g.graph.add_node(ErrorInvocation(id="1"))
mock_invoker.invoke(queue_item_id="1", queue_id=DEFAULT_QUEUE_ID, graph_execution_state=g, invoke_all=True)
mock_invoker.invoke(
session_queue_batch_id="1",
session_queue_item_id=1,
session_queue_id=DEFAULT_QUEUE_ID,
graph_execution_state=g,
invoke_all=True,
)
def has_executed_all(g: GraphExecutionState):
g = mock_invoker.services.graph_execution_manager.get(g.id)