feat(ui): update linear UI to use new board field on save_image

- No longer need to make network request to add image to board after it's finished - removed
- Update linear graphs & upscale graph to save image to the board
- Update autoSwitch logic so when image is generated we still switch to the right board
This commit is contained in:
psychedelicious
2023-09-22 12:38:09 +10:00
committed by Kent Keirsey
parent 43fbac26df
commit 88c8cb61f0
4 changed files with 30 additions and 37 deletions

View File

@ -24,12 +24,14 @@ export const addSaveImageNode = (
const activeTabName = activeTabNameSelector(state);
const is_intermediate =
activeTabName === 'unifiedCanvas' ? !state.canvas.shouldAutoSave : false;
const { autoAddBoardId } = state.gallery;
const saveImageNode: SaveImageInvocation = {
id: SAVE_IMAGE,
type: 'save_image',
is_intermediate,
use_cache: false,
board: autoAddBoardId === 'none' ? undefined : { board_id: autoAddBoardId },
};
graph.nodes[SAVE_IMAGE] = saveImageNode;

View File

@ -6,15 +6,18 @@ import {
SaveImageInvocation,
} from 'services/api/types';
import { REALESRGAN as ESRGAN, SAVE_IMAGE } from './constants';
import { BoardId } from 'features/gallery/store/types';
type Arg = {
image_name: string;
esrganModelName: ESRGANModelName;
autoAddBoardId: BoardId;
};
export const buildAdHocUpscaleGraph = ({
image_name,
esrganModelName,
autoAddBoardId,
}: Arg): Graph => {
const realesrganNode: ESRGANInvocation = {
id: ESRGAN,
@ -28,6 +31,8 @@ export const buildAdHocUpscaleGraph = ({
id: SAVE_IMAGE,
type: 'save_image',
use_cache: false,
is_intermediate: false,
board: autoAddBoardId === 'none' ? undefined : { board_id: autoAddBoardId },
};
const graph: NonNullableGraph = {