mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): fix batch metadata logic when graph has no metadata
On canvas, images have no metadata yet, so this needs to be handled
This commit is contained in:
parent
52fbd1b222
commit
301a8fef92
@ -11,7 +11,7 @@ import {
|
|||||||
NOISE,
|
NOISE,
|
||||||
POSITIVE_CONDITIONING,
|
POSITIVE_CONDITIONING,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { removeMetadata } from './metadata';
|
import { getHasMetadata, removeMetadata } from './metadata';
|
||||||
|
|
||||||
export const prepareLinearUIBatch = (
|
export const prepareLinearUIBatch = (
|
||||||
state: RootState,
|
state: RootState,
|
||||||
@ -40,6 +40,7 @@ export const prepareLinearUIBatch = (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getHasMetadata(graph)) {
|
||||||
// add to metadata
|
// add to metadata
|
||||||
removeMetadata(graph, 'seed');
|
removeMetadata(graph, 'seed');
|
||||||
zipped.push({
|
zipped.push({
|
||||||
@ -47,6 +48,7 @@ export const prepareLinearUIBatch = (
|
|||||||
field_name: 'seed',
|
field_name: 'seed',
|
||||||
items: seeds,
|
items: seeds,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (graph.nodes[CANVAS_COHERENCE_NOISE]) {
|
if (graph.nodes[CANVAS_COHERENCE_NOISE]) {
|
||||||
zipped.push({
|
zipped.push({
|
||||||
@ -78,12 +80,14 @@ export const prepareLinearUIBatch = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add to metadata
|
// add to metadata
|
||||||
|
if (getHasMetadata(graph)) {
|
||||||
removeMetadata(graph, 'seed');
|
removeMetadata(graph, 'seed');
|
||||||
firstBatchDatumList.push({
|
firstBatchDatumList.push({
|
||||||
node_path: METADATA,
|
node_path: METADATA,
|
||||||
field_name: 'seed',
|
field_name: 'seed',
|
||||||
items: seeds,
|
items: seeds,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (graph.nodes[CANVAS_COHERENCE_NOISE]) {
|
if (graph.nodes[CANVAS_COHERENCE_NOISE]) {
|
||||||
firstBatchDatumList.push({
|
firstBatchDatumList.push({
|
||||||
@ -108,12 +112,14 @@ export const prepareLinearUIBatch = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add to metadata
|
// add to metadata
|
||||||
|
if (getHasMetadata(graph)) {
|
||||||
removeMetadata(graph, 'seed');
|
removeMetadata(graph, 'seed');
|
||||||
secondBatchDatumList.push({
|
secondBatchDatumList.push({
|
||||||
node_path: METADATA,
|
node_path: METADATA,
|
||||||
field_name: 'seed',
|
field_name: 'seed',
|
||||||
items: seeds,
|
items: seeds,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (graph.nodes[CANVAS_COHERENCE_NOISE]) {
|
if (graph.nodes[CANVAS_COHERENCE_NOISE]) {
|
||||||
secondBatchDatumList.push({
|
secondBatchDatumList.push({
|
||||||
@ -140,12 +146,14 @@ export const prepareLinearUIBatch = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add to metadata
|
// add to metadata
|
||||||
|
if (getHasMetadata(graph)) {
|
||||||
removeMetadata(graph, 'positive_prompt');
|
removeMetadata(graph, 'positive_prompt');
|
||||||
firstBatchDatumList.push({
|
firstBatchDatumList.push({
|
||||||
node_path: METADATA,
|
node_path: METADATA,
|
||||||
field_name: 'positive_prompt',
|
field_name: 'positive_prompt',
|
||||||
items: extendedPrompts,
|
items: extendedPrompts,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldConcatSDXLStylePrompt && model?.base_model === 'sdxl') {
|
if (shouldConcatSDXLStylePrompt && model?.base_model === 'sdxl') {
|
||||||
const stylePrompts = extendedPrompts.map((p) =>
|
const stylePrompts = extendedPrompts.map((p) =>
|
||||||
@ -161,6 +169,7 @@ export const prepareLinearUIBatch = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add to metadata
|
// add to metadata
|
||||||
|
if (getHasMetadata(graph)) {
|
||||||
removeMetadata(graph, 'positive_style_prompt');
|
removeMetadata(graph, 'positive_style_prompt');
|
||||||
firstBatchDatumList.push({
|
firstBatchDatumList.push({
|
||||||
node_path: METADATA,
|
node_path: METADATA,
|
||||||
@ -168,6 +177,7 @@ export const prepareLinearUIBatch = (
|
|||||||
items: extendedPrompts,
|
items: extendedPrompts,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data.push(firstBatchDatumList);
|
data.push(firstBatchDatumList);
|
||||||
}
|
}
|
||||||
|
@ -56,3 +56,11 @@ export const removeMetadata = (
|
|||||||
|
|
||||||
delete metadataNode[key];
|
delete metadataNode[key];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getHasMetadata = (graph: NonNullableGraph): boolean => {
|
||||||
|
const metadataNode = graph.nodes[METADATA] as
|
||||||
|
| CoreMetadataInvocation
|
||||||
|
| undefined;
|
||||||
|
|
||||||
|
return Boolean(metadataNode);
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user