mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-12 15:24:55 -05:00
fix(ui): don't use layers when generating on generate tab
This commit is contained in:
@@ -12,6 +12,7 @@ import { getGenerationMode } from 'features/nodes/util/graph/generation/getGener
|
||||
import { Graph } from 'features/nodes/util/graph/generation/Graph';
|
||||
import { selectCanvasOutputFields, selectPresetModifiedPrompts } from 'features/nodes/util/graph/graphBuilderUtils';
|
||||
import { type GraphBuilderReturn, UnsupportedGenerationModeError } from 'features/nodes/util/graph/types';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
import { t } from 'i18next';
|
||||
import type { Equals } from 'tsafe';
|
||||
import { assert } from 'tsafe';
|
||||
@@ -20,9 +21,10 @@ const log = logger('system');
|
||||
|
||||
export const buildChatGPT4oGraph = async (
|
||||
state: RootState,
|
||||
manager?: CanvasManager | null
|
||||
manager: CanvasManager | null
|
||||
): Promise<GraphBuilderReturn> => {
|
||||
const generationMode = await getGenerationMode(manager);
|
||||
const tab = selectActiveTab(state);
|
||||
const generationMode = await getGenerationMode(manager, tab);
|
||||
|
||||
if (generationMode !== 'txt2img' && generationMode !== 'img2img') {
|
||||
throw new UnsupportedGenerationModeError(t('toast.chatGPT4oIncompatibleGenerationMode'));
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
selectPresetModifiedPrompts,
|
||||
} from 'features/nodes/util/graph/graphBuilderUtils';
|
||||
import type { GraphBuilderReturn, ImageOutputNodes } from 'features/nodes/util/graph/types';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
import type { Invocation } from 'services/api/types';
|
||||
import { isNonRefinerMainModelConfig } from 'services/api/types';
|
||||
import type { Equals } from 'tsafe';
|
||||
@@ -28,9 +29,10 @@ const log = logger('system');
|
||||
|
||||
export const buildCogView4Graph = async (
|
||||
state: RootState,
|
||||
manager?: CanvasManager | null
|
||||
manager: CanvasManager | null
|
||||
): Promise<GraphBuilderReturn> => {
|
||||
const generationMode = await getGenerationMode(manager);
|
||||
const tab = selectActiveTab(state);
|
||||
const generationMode = await getGenerationMode(manager, tab);
|
||||
log.debug({ generationMode }, 'Building CogView4 graph');
|
||||
|
||||
const params = selectParamsSlice(state);
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
type ImageOutputNodes,
|
||||
UnsupportedGenerationModeError,
|
||||
} from 'features/nodes/util/graph/types';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
import { t } from 'i18next';
|
||||
import type { Invocation } from 'services/api/types';
|
||||
import type { Equals } from 'tsafe';
|
||||
@@ -37,8 +38,9 @@ import { addIPAdapters } from './addIPAdapters';
|
||||
|
||||
const log = logger('system');
|
||||
|
||||
export const buildFLUXGraph = async (state: RootState, manager?: CanvasManager | null): Promise<GraphBuilderReturn> => {
|
||||
const generationMode = await getGenerationMode(manager);
|
||||
export const buildFLUXGraph = async (state: RootState, manager: CanvasManager | null): Promise<GraphBuilderReturn> => {
|
||||
const tab = selectActiveTab(state);
|
||||
const generationMode = await getGenerationMode(manager, tab);
|
||||
log.debug({ generationMode }, 'Building FLUX graph');
|
||||
|
||||
const params = selectParamsSlice(state);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { getGenerationMode } from 'features/nodes/util/graph/generation/getGener
|
||||
import { Graph } from 'features/nodes/util/graph/generation/Graph';
|
||||
import { selectCanvasOutputFields, selectPresetModifiedPrompts } from 'features/nodes/util/graph/graphBuilderUtils';
|
||||
import { type GraphBuilderReturn, UnsupportedGenerationModeError } from 'features/nodes/util/graph/types';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
import { t } from 'i18next';
|
||||
import type { Equals } from 'tsafe';
|
||||
import { assert } from 'tsafe';
|
||||
@@ -18,9 +19,10 @@ const log = logger('system');
|
||||
|
||||
export const buildImagen3Graph = async (
|
||||
state: RootState,
|
||||
manager?: CanvasManager | null
|
||||
manager: CanvasManager | null
|
||||
): Promise<GraphBuilderReturn> => {
|
||||
const generationMode = await getGenerationMode(manager);
|
||||
const tab = selectActiveTab(state);
|
||||
const generationMode = await getGenerationMode(manager, tab);
|
||||
|
||||
if (generationMode !== 'txt2img') {
|
||||
throw new UnsupportedGenerationModeError(t('toast.imagenIncompatibleGenerationMode', { model: 'Imagen3' }));
|
||||
|
||||
@@ -10,6 +10,7 @@ import { getGenerationMode } from 'features/nodes/util/graph/generation/getGener
|
||||
import { Graph } from 'features/nodes/util/graph/generation/Graph';
|
||||
import { selectCanvasOutputFields, selectPresetModifiedPrompts } from 'features/nodes/util/graph/graphBuilderUtils';
|
||||
import { type GraphBuilderReturn, UnsupportedGenerationModeError } from 'features/nodes/util/graph/types';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
import { t } from 'i18next';
|
||||
import type { Equals } from 'tsafe';
|
||||
import { assert } from 'tsafe';
|
||||
@@ -18,9 +19,10 @@ const log = logger('system');
|
||||
|
||||
export const buildImagen4Graph = async (
|
||||
state: RootState,
|
||||
manager?: CanvasManager | null
|
||||
manager: CanvasManager | null
|
||||
): Promise<GraphBuilderReturn> => {
|
||||
const generationMode = await getGenerationMode(manager);
|
||||
const tab = selectActiveTab(state);
|
||||
const generationMode = await getGenerationMode(manager, tab);
|
||||
|
||||
if (generationMode !== 'txt2img') {
|
||||
throw new UnsupportedGenerationModeError(t('toast.imagenIncompatibleGenerationMode', { model: 'Imagen4' }));
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
selectPresetModifiedPrompts,
|
||||
} from 'features/nodes/util/graph/graphBuilderUtils';
|
||||
import type { GraphBuilderReturn, ImageOutputNodes } from 'features/nodes/util/graph/types';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
import type { Invocation } from 'services/api/types';
|
||||
import type { Equals } from 'tsafe';
|
||||
import { assert } from 'tsafe';
|
||||
@@ -32,8 +33,9 @@ import { addRegions } from './addRegions';
|
||||
|
||||
const log = logger('system');
|
||||
|
||||
export const buildSD1Graph = async (state: RootState, manager?: CanvasManager | null): Promise<GraphBuilderReturn> => {
|
||||
const generationMode = await getGenerationMode(manager);
|
||||
export const buildSD1Graph = async (state: RootState, manager: CanvasManager | null): Promise<GraphBuilderReturn> => {
|
||||
const tab = selectActiveTab(state);
|
||||
const generationMode = await getGenerationMode(manager, tab);
|
||||
log.debug({ generationMode }, 'Building SD1/SD2 graph');
|
||||
|
||||
const params = selectParamsSlice(state);
|
||||
|
||||
@@ -18,14 +18,16 @@ import {
|
||||
selectPresetModifiedPrompts,
|
||||
} from 'features/nodes/util/graph/graphBuilderUtils';
|
||||
import type { GraphBuilderReturn, ImageOutputNodes } from 'features/nodes/util/graph/types';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
import type { Invocation } from 'services/api/types';
|
||||
import type { Equals } from 'tsafe';
|
||||
import { assert } from 'tsafe';
|
||||
|
||||
const log = logger('system');
|
||||
|
||||
export const buildSD3Graph = async (state: RootState, manager?: CanvasManager | null): Promise<GraphBuilderReturn> => {
|
||||
const generationMode = await getGenerationMode(manager);
|
||||
export const buildSD3Graph = async (state: RootState, manager: CanvasManager | null): Promise<GraphBuilderReturn> => {
|
||||
const tab = selectActiveTab(state);
|
||||
const generationMode = await getGenerationMode(manager, tab);
|
||||
log.debug({ generationMode }, 'Building SD3 graph');
|
||||
|
||||
const model = selectMainModelConfig(state);
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
selectPresetModifiedPrompts,
|
||||
} from 'features/nodes/util/graph/graphBuilderUtils';
|
||||
import type { GraphBuilderReturn, ImageOutputNodes } from 'features/nodes/util/graph/types';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
import type { Invocation } from 'services/api/types';
|
||||
import type { Equals } from 'tsafe';
|
||||
import { assert } from 'tsafe';
|
||||
@@ -32,8 +33,9 @@ import { addRegions } from './addRegions';
|
||||
|
||||
const log = logger('system');
|
||||
|
||||
export const buildSDXLGraph = async (state: RootState, manager?: CanvasManager | null): Promise<GraphBuilderReturn> => {
|
||||
const generationMode = await getGenerationMode(manager);
|
||||
export const buildSDXLGraph = async (state: RootState, manager: CanvasManager | null): Promise<GraphBuilderReturn> => {
|
||||
const tab = selectActiveTab(state);
|
||||
const generationMode = await getGenerationMode(manager, tab);
|
||||
log.debug({ generationMode }, 'Building SDXL graph');
|
||||
|
||||
const model = selectMainModelConfig(state);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import type { CanvasManager } from 'features/controlLayers/konva/CanvasManager';
|
||||
import type { GenerationMode } from 'features/controlLayers/store/types';
|
||||
import type { TabName } from 'features/ui/store/uiTypes';
|
||||
|
||||
export const getGenerationMode = async (manager?: CanvasManager | null): Promise<GenerationMode> => {
|
||||
if (!manager) {
|
||||
export const getGenerationMode = async (manager: CanvasManager | null, tab: TabName): Promise<GenerationMode> => {
|
||||
if (!manager || tab === 'generate') {
|
||||
return 'txt2img';
|
||||
}
|
||||
return await manager.compositor.getGenerationMode();
|
||||
|
||||
Reference in New Issue
Block a user