change model store to object, update main model and vae dropdowns

This commit is contained in:
Mary Hipp
2023-07-06 11:54:16 -04:00
committed by psychedelicious
parent 909fe047e4
commit 6356dc335f
10 changed files with 55 additions and 50 deletions

View File

@ -16,10 +16,12 @@ export const addVAEToGraph = (
graph: NonNullableGraph,
state: RootState
): void => {
const { vae: vaeId } = state.generation;
const vae_model = modelIdToVAEModelField(vaeId);
const { vae } = state.generation;
const vae_model = modelIdToVAEModelField(vae?.id || '');
if (vaeId !== 'auto') {
const isAutoVae = vae?.id === 'auto';
if (!isAutoVae) {
graph.nodes[VAE_LOADER] = {
type: 'vae_loader',
id: VAE_LOADER,
@ -30,7 +32,7 @@ export const addVAEToGraph = (
if (graph.id === TEXT_TO_IMAGE_GRAPH || graph.id === IMAGE_TO_IMAGE_GRAPH) {
graph.edges.push({
source: {
node_id: vaeId === 'auto' ? MAIN_MODEL_LOADER : VAE_LOADER,
node_id: isAutoVae ? MAIN_MODEL_LOADER : VAE_LOADER,
field: 'vae',
},
destination: {
@ -43,7 +45,7 @@ export const addVAEToGraph = (
if (graph.id === IMAGE_TO_IMAGE_GRAPH) {
graph.edges.push({
source: {
node_id: vaeId === 'auto' ? MAIN_MODEL_LOADER : VAE_LOADER,
node_id: isAutoVae ? MAIN_MODEL_LOADER : VAE_LOADER,
field: 'vae',
},
destination: {
@ -56,7 +58,7 @@ export const addVAEToGraph = (
if (graph.id === INPAINT_GRAPH) {
graph.edges.push({
source: {
node_id: vaeId === 'auto' ? MAIN_MODEL_LOADER : VAE_LOADER,
node_id: isAutoVae ? MAIN_MODEL_LOADER : VAE_LOADER,
field: 'vae',
},
destination: {

View File

@ -36,7 +36,7 @@ export const buildCanvasImageToImageGraph = (
const {
positivePrompt,
negativePrompt,
model: modelId,
model: currentModel,
cfgScale: cfg_scale,
scheduler,
steps,
@ -50,7 +50,7 @@ export const buildCanvasImageToImageGraph = (
// The bounding box determines width and height, not the width and height params
const { width, height } = state.canvas.boundingBoxDimensions;
const model = modelIdToMainModelField(modelId);
const model = modelIdToMainModelField(currentModel?.id || '');
/**
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the

View File

@ -35,7 +35,7 @@ export const buildCanvasInpaintGraph = (
const {
positivePrompt,
negativePrompt,
model: modelId,
model: currentModel,
cfgScale: cfg_scale,
scheduler,
steps,
@ -59,7 +59,7 @@ export const buildCanvasInpaintGraph = (
// We may need to set the inpaint width and height to scale the image
const { scaledBoundingBoxDimensions, boundingBoxScaleMethod } = state.canvas;
const model = modelIdToMainModelField(modelId);
const model = modelIdToMainModelField(currentModel?.id || '');
const graph: NonNullableGraph = {
id: INPAINT_GRAPH,

View File

@ -25,7 +25,7 @@ export const buildCanvasTextToImageGraph = (
const {
positivePrompt,
negativePrompt,
model: modelId,
model: currentModel,
cfgScale: cfg_scale,
scheduler,
steps,
@ -38,7 +38,7 @@ export const buildCanvasTextToImageGraph = (
// The bounding box determines width and height, not the width and height params
const { width, height } = state.canvas.boundingBoxDimensions;
const model = modelIdToMainModelField(modelId);
const model = modelIdToMainModelField(currentModel?.id || '');
/**
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the

View File

@ -38,7 +38,7 @@ export const buildLinearImageToImageGraph = (
const {
positivePrompt,
negativePrompt,
model: modelId,
model: currentModel,
cfgScale: cfg_scale,
scheduler,
steps,
@ -73,7 +73,7 @@ export const buildLinearImageToImageGraph = (
throw new Error('No initial image found in state');
}
const model = modelIdToMainModelField(modelId);
const model = modelIdToMainModelField(currentModel?.id || '');
// copy-pasted graph from node editor, filled in with state values & friendly node ids
const graph: NonNullableGraph = {

View File

@ -22,7 +22,7 @@ export const buildLinearTextToImageGraph = (
const {
positivePrompt,
negativePrompt,
model: modelId,
model: currentModel,
cfgScale: cfg_scale,
scheduler,
steps,
@ -31,7 +31,7 @@ export const buildLinearTextToImageGraph = (
clipSkip,
} = state.generation;
const model = modelIdToMainModelField(modelId);
const model = modelIdToMainModelField(currentModel?.id || '');
/**
* The easiest way to build linear graphs is to do it in the node editor, then copy and paste the