mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Missed Translations
This commit is contained in:
@ -3,6 +3,7 @@ import { NodesState } from '../store/types';
|
||||
import { Workflow, zWorkflowEdge, zWorkflowNode } from '../types/types';
|
||||
import { fromZodError } from 'zod-validation-error';
|
||||
import { parseify } from 'common/util/serialize';
|
||||
import i18n from 'i18next';
|
||||
|
||||
export const buildWorkflow = (nodesState: NodesState): Workflow => {
|
||||
const { workflow: workflowMeta, nodes, edges } = nodesState;
|
||||
@ -20,7 +21,7 @@ export const buildWorkflow = (nodesState: NodesState): Workflow => {
|
||||
const result = zWorkflowNode.safeParse(node);
|
||||
if (!result.success) {
|
||||
const { message } = fromZodError(result.error, {
|
||||
prefix: 'Unable to parse node',
|
||||
prefix: i18n.t('nodes.unableToParseNode'),
|
||||
});
|
||||
logger('nodes').warn({ node: parseify(node) }, message);
|
||||
return;
|
||||
@ -32,7 +33,7 @@ export const buildWorkflow = (nodesState: NodesState): Workflow => {
|
||||
const result = zWorkflowEdge.safeParse(edge);
|
||||
if (!result.success) {
|
||||
const { message } = fromZodError(result.error, {
|
||||
prefix: 'Unable to parse edge',
|
||||
prefix: i18n.t('nodes.unableToParseEdge'),
|
||||
});
|
||||
logger('nodes').warn({ edge: parseify(edge) }, message);
|
||||
return;
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
zWorkflow,
|
||||
} from 'features/nodes/types/types';
|
||||
import { get } from 'lodash-es';
|
||||
import i18n from 'i18next';
|
||||
|
||||
export const getMetadataAndWorkflowFromImageBlob = async (
|
||||
image: Blob
|
||||
@ -23,7 +24,7 @@ export const getMetadataAndWorkflowFromImageBlob = async (
|
||||
} else {
|
||||
logger('system').error(
|
||||
{ error: parseify(metadataResult.error) },
|
||||
'Problem reading metadata from image'
|
||||
i18n.t('nodes.problemReadingMetadata')
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -36,7 +37,7 @@ export const getMetadataAndWorkflowFromImageBlob = async (
|
||||
} else {
|
||||
logger('system').error(
|
||||
{ error: parseify(workflowResult.error) },
|
||||
'Problem reading workflow from image'
|
||||
i18n.t('nodes.problemReadingWorkflow')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import { buildCanvasSDXLInpaintGraph } from './buildCanvasSDXLInpaintGraph';
|
||||
import { buildCanvasSDXLOutpaintGraph } from './buildCanvasSDXLOutpaintGraph';
|
||||
import { buildCanvasSDXLTextToImageGraph } from './buildCanvasSDXLTextToImageGraph';
|
||||
import { buildCanvasTextToImageGraph } from './buildCanvasTextToImageGraph';
|
||||
import i18n from 'i18next';
|
||||
|
||||
export const buildCanvasGraph = (
|
||||
state: RootState,
|
||||
@ -29,7 +30,7 @@ export const buildCanvasGraph = (
|
||||
}
|
||||
} else if (generationMode === 'img2img') {
|
||||
if (!canvasInitImage) {
|
||||
throw new Error('Missing canvas init image');
|
||||
throw new Error(i18n.t('nodes.missingCanvaInitImage'));
|
||||
}
|
||||
if (
|
||||
state.generation.model &&
|
||||
@ -41,7 +42,7 @@ export const buildCanvasGraph = (
|
||||
}
|
||||
} else if (generationMode === 'inpaint') {
|
||||
if (!canvasInitImage || !canvasMaskImage) {
|
||||
throw new Error('Missing canvas init and mask images');
|
||||
throw new Error(i18n.t('nodes.missingCanvaInitMaskImages'));
|
||||
}
|
||||
if (
|
||||
state.generation.model &&
|
||||
@ -57,7 +58,7 @@ export const buildCanvasGraph = (
|
||||
}
|
||||
} else {
|
||||
if (!canvasInitImage) {
|
||||
throw new Error('Missing canvas init image');
|
||||
throw new Error(i18n.t('nodes.missingCanvaInitImage'));
|
||||
}
|
||||
if (
|
||||
state.generation.model &&
|
||||
|
@ -25,6 +25,7 @@ import {
|
||||
POSITIVE_CONDITIONING,
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Canvas tab's Image to Image graph.
|
||||
@ -66,8 +67,8 @@ export const buildCanvasImageToImageGraph = (
|
||||
);
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
let modelLoaderNodeId = MAIN_MODEL_LOADER;
|
||||
|
@ -44,6 +44,7 @@ import {
|
||||
RANGE_OF_SIZE,
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Canvas tab's Inpaint graph.
|
||||
@ -79,8 +80,8 @@ export const buildCanvasInpaintGraph = (
|
||||
} = state.generation;
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noImageFoundState'));
|
||||
throw new Error(i18n.t('nodes.noImageFoundState'));
|
||||
}
|
||||
|
||||
// The bounding box determines width and height, not the width and height params
|
||||
|
@ -46,6 +46,7 @@ import {
|
||||
RANGE_OF_SIZE,
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Canvas tab's Outpaint graph.
|
||||
@ -83,8 +84,8 @@ export const buildCanvasOutpaintGraph = (
|
||||
} = state.generation;
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noImageFoundState'));
|
||||
throw new Error(i18n.t('nodes.noImageFoundState'));
|
||||
}
|
||||
|
||||
// The bounding box determines width and height, not the width and height params
|
||||
|
@ -27,6 +27,7 @@ import {
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Canvas tab's Image to Image graph.
|
||||
@ -74,8 +75,8 @@ export const buildCanvasSDXLImageToImageGraph = (
|
||||
);
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
// Model Loader ID
|
||||
|
@ -46,6 +46,7 @@ import {
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Canvas tab's Inpaint graph.
|
||||
@ -86,8 +87,8 @@ export const buildCanvasSDXLInpaintGraph = (
|
||||
} = state.sdxl;
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
// The bounding box determines width and height, not the width and height params
|
||||
|
@ -48,6 +48,7 @@ import {
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Canvas tab's Outpaint graph.
|
||||
@ -90,8 +91,8 @@ export const buildCanvasSDXLOutpaintGraph = (
|
||||
} = state.sdxl;
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
// The bounding box determines width and height, not the width and height params
|
||||
|
@ -29,6 +29,7 @@ import {
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Canvas tab's Text to Image graph.
|
||||
@ -71,8 +72,8 @@ export const buildCanvasSDXLTextToImageGraph = (
|
||||
state.sdxl;
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
const use_cpu = shouldUseNoiseSettings
|
||||
|
@ -27,6 +27,7 @@ import {
|
||||
POSITIVE_CONDITIONING,
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Canvas tab's Text to Image graph.
|
||||
@ -66,8 +67,8 @@ export const buildCanvasTextToImageGraph = (
|
||||
);
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
const use_cpu = shouldUseNoiseSettings
|
||||
|
@ -27,6 +27,7 @@ import {
|
||||
RESIZE,
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Image to Image tab graph.
|
||||
@ -75,13 +76,13 @@ export const buildLinearImageToImageGraph = (
|
||||
*/
|
||||
|
||||
if (!initialImage) {
|
||||
log.error('No initial image found in state');
|
||||
throw new Error('No initial image found in state');
|
||||
log.error(i18n.t('nodes.noImageFoundState'));
|
||||
throw new Error(i18n.t('nodes.noImageFoundState'));
|
||||
}
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
const fp32 = vaePrecision === 'fp32';
|
||||
|
@ -29,6 +29,7 @@ import {
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||
import i18n from 'i18next';
|
||||
|
||||
/**
|
||||
* Builds the Image to Image tab graph.
|
||||
@ -75,13 +76,13 @@ export const buildLinearSDXLImageToImageGraph = (
|
||||
*/
|
||||
|
||||
if (!initialImage) {
|
||||
log.error('No initial image found in state');
|
||||
throw new Error('No initial image found in state');
|
||||
log.error(i18n.t('nodes.noImageFoundState'));
|
||||
throw new Error(i18n.t('nodes.noImageFoundState'));
|
||||
}
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
const fp32 = vaePrecision === 'fp32';
|
||||
|
@ -23,6 +23,7 @@ import {
|
||||
SEAMLESS,
|
||||
} from './constants';
|
||||
import { craftSDXLStylePrompt } from './helpers/craftSDXLStylePrompt';
|
||||
import i18n from 'i18next';
|
||||
|
||||
export const buildLinearSDXLTextToImageGraph = (
|
||||
state: RootState
|
||||
@ -58,8 +59,8 @@ export const buildLinearSDXLTextToImageGraph = (
|
||||
: initialGenerationState.shouldUseCpuNoise;
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
const fp32 = vaePrecision === 'fp32';
|
||||
|
@ -26,6 +26,7 @@ import {
|
||||
SEAMLESS,
|
||||
TEXT_TO_IMAGE_GRAPH,
|
||||
} from './constants';
|
||||
import i18n from 'i18next';
|
||||
|
||||
export const buildLinearTextToImageGraph = (
|
||||
state: RootState
|
||||
@ -53,8 +54,8 @@ export const buildLinearTextToImageGraph = (
|
||||
: initialGenerationState.shouldUseCpuNoise;
|
||||
|
||||
if (!model) {
|
||||
log.error('No model found in state');
|
||||
throw new Error('No model found in state');
|
||||
log.error(i18n.t('nodes.noModelFoundState'));
|
||||
throw new Error(i18n.t('nodes.noModelFoundState'));
|
||||
}
|
||||
|
||||
const fp32 = vaePrecision === 'fp32';
|
||||
|
@ -15,6 +15,7 @@ import {
|
||||
isInvocationSchemaObject,
|
||||
} from '../types/types';
|
||||
import { buildInputFieldTemplate, getFieldType } from './fieldTemplateBuilders';
|
||||
import i18n from 'i18next';
|
||||
|
||||
const RESERVED_INPUT_FIELD_NAMES = ['id', 'type', 'metadata'];
|
||||
const RESERVED_OUTPUT_FIELD_NAMES = ['type'];
|
||||
@ -97,7 +98,7 @@ export const parseSchema = (
|
||||
if (isReservedInputField(type, propertyName)) {
|
||||
logger('nodes').trace(
|
||||
{ node: type, fieldName: propertyName, field: parseify(property) },
|
||||
'Skipped reserved input field'
|
||||
i18n.t('nodes.skippedReservedInput')
|
||||
);
|
||||
return inputsAccumulator;
|
||||
}
|
||||
@ -105,7 +106,7 @@ export const parseSchema = (
|
||||
if (!isInvocationFieldSchema(property)) {
|
||||
logger('nodes').warn(
|
||||
{ node: type, propertyName, property: parseify(property) },
|
||||
'Unhandled input property'
|
||||
i18n.t('nodes.unhandledInputProperty')
|
||||
);
|
||||
return inputsAccumulator;
|
||||
}
|
||||
@ -120,7 +121,7 @@ export const parseSchema = (
|
||||
fieldType,
|
||||
field: parseify(property),
|
||||
},
|
||||
'Skipping unknown input field type'
|
||||
i18n.t('nodes.skippingUnknownInputType')
|
||||
);
|
||||
return inputsAccumulator;
|
||||
}
|
||||
@ -133,7 +134,7 @@ export const parseSchema = (
|
||||
fieldType,
|
||||
field: parseify(property),
|
||||
},
|
||||
'Skipping reserved field type'
|
||||
i18n.t('nodes.skippingReservedFieldType')
|
||||
);
|
||||
return inputsAccumulator;
|
||||
}
|
||||
@ -153,7 +154,7 @@ export const parseSchema = (
|
||||
fieldType,
|
||||
field: parseify(property),
|
||||
},
|
||||
'Skipping input field with no template'
|
||||
i18n.t('nodes.skippingInputNoTemplate')
|
||||
);
|
||||
return inputsAccumulator;
|
||||
}
|
||||
@ -169,21 +170,24 @@ export const parseSchema = (
|
||||
if (!outputSchemaName) {
|
||||
logger('nodes').warn(
|
||||
{ outputRefObject: parseify(schema.output) },
|
||||
'No output schema name found in ref object'
|
||||
i18n.t('nodes.noOutputSchemaName')
|
||||
);
|
||||
return invocationsAccumulator;
|
||||
}
|
||||
|
||||
const outputSchema = openAPI.components?.schemas?.[outputSchemaName];
|
||||
if (!outputSchema) {
|
||||
logger('nodes').warn({ outputSchemaName }, 'Output schema not found');
|
||||
logger('nodes').warn(
|
||||
{ outputSchemaName },
|
||||
i18n.t('nodes.outputSchemaNotFound')
|
||||
);
|
||||
return invocationsAccumulator;
|
||||
}
|
||||
|
||||
if (!isInvocationOutputSchemaObject(outputSchema)) {
|
||||
logger('nodes').error(
|
||||
{ outputSchema: parseify(outputSchema) },
|
||||
'Invalid output schema'
|
||||
i18n.t('nodes.invalidOutputSchema')
|
||||
);
|
||||
return invocationsAccumulator;
|
||||
}
|
||||
@ -196,7 +200,7 @@ export const parseSchema = (
|
||||
if (!isAllowedOutputField(type, propertyName)) {
|
||||
logger('nodes').trace(
|
||||
{ type, propertyName, property: parseify(property) },
|
||||
'Skipped reserved output field'
|
||||
i18n.t('nodes.skippedReservedOutput')
|
||||
);
|
||||
return outputsAccumulator;
|
||||
}
|
||||
@ -204,7 +208,7 @@ export const parseSchema = (
|
||||
if (!isInvocationFieldSchema(property)) {
|
||||
logger('nodes').warn(
|
||||
{ type, propertyName, property: parseify(property) },
|
||||
'Unhandled output property'
|
||||
i18n.t('nodes.unhandledOutputProperty')
|
||||
);
|
||||
return outputsAccumulator;
|
||||
}
|
||||
@ -214,7 +218,7 @@ export const parseSchema = (
|
||||
if (!isFieldType(fieldType)) {
|
||||
logger('nodes').warn(
|
||||
{ fieldName: propertyName, fieldType, field: parseify(property) },
|
||||
'Skipping unknown output field type'
|
||||
i18n.t('nodes.skippingUnknownOutputType')
|
||||
);
|
||||
return outputsAccumulator;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
isWorkflowInvocationNode,
|
||||
} from '../types/types';
|
||||
import { parseify } from 'common/util/serialize';
|
||||
import i18n from 'i18next';
|
||||
|
||||
export const validateWorkflow = (
|
||||
workflow: Workflow,
|
||||
@ -25,8 +26,14 @@ export const validateWorkflow = (
|
||||
const nodeTemplate = nodeTemplates[node.data.type];
|
||||
if (!nodeTemplate) {
|
||||
errors.push({
|
||||
message: `Node "${node.data.type}" skipped`,
|
||||
issues: [`Node type "${node.data.type}" does not exist`],
|
||||
message: `${i18n.t('nodes.node')} "${node.data.type}" ${i18n.t(
|
||||
'nodes.skipped'
|
||||
)}`,
|
||||
issues: [
|
||||
`${i18n.t('nodes.nodeType')}"${node.data.type}" ${i18n.t(
|
||||
'nodes.doesNotExist'
|
||||
)}`,
|
||||
],
|
||||
data: node,
|
||||
});
|
||||
return;
|
||||
@ -38,9 +45,13 @@ export const validateWorkflow = (
|
||||
compareVersions(nodeTemplate.version, node.data.version) !== 0
|
||||
) {
|
||||
errors.push({
|
||||
message: `Node "${node.data.type}" has mismatched version`,
|
||||
message: `${i18n.t('nodes.node')} "${node.data.type}" ${i18n.t(
|
||||
'nodes.mismatchedVersion'
|
||||
)}`,
|
||||
issues: [
|
||||
`Node "${node.data.type}" v${node.data.version} may be incompatible with installed v${nodeTemplate.version}`,
|
||||
`${i18n.t('nodes.node')} "${node.data.type}" v${
|
||||
node.data.version
|
||||
} ${i18n.t('nodes.maybeIncompatible')} v${nodeTemplate.version}`,
|
||||
],
|
||||
data: { node, nodeTemplate: parseify(nodeTemplate) },
|
||||
});
|
||||
@ -52,33 +63,49 @@ export const validateWorkflow = (
|
||||
const targetNode = keyedNodes[edge.target];
|
||||
const issues: string[] = [];
|
||||
if (!sourceNode) {
|
||||
issues.push(`Output node ${edge.source} does not exist`);
|
||||
issues.push(
|
||||
`${i18n.t('nodes.outputNode')} ${edge.source} ${i18n.t(
|
||||
'nodes.doesNotExist'
|
||||
)}`
|
||||
);
|
||||
} else if (
|
||||
edge.type === 'default' &&
|
||||
!(edge.sourceHandle in sourceNode.data.outputs)
|
||||
) {
|
||||
issues.push(
|
||||
`Output field "${edge.source}.${edge.sourceHandle}" does not exist`
|
||||
`${i18n.t('nodes.outputNodes')} "${edge.source}.${
|
||||
edge.sourceHandle
|
||||
}" ${i18n.t('nodes.doesNotExist')}`
|
||||
);
|
||||
}
|
||||
if (!targetNode) {
|
||||
issues.push(`Input node ${edge.target} does not exist`);
|
||||
issues.push(
|
||||
`${i18n.t('nodes.inputNode')} ${edge.target} ${i18n.t(
|
||||
'nodes.doesNotExist'
|
||||
)}`
|
||||
);
|
||||
} else if (
|
||||
edge.type === 'default' &&
|
||||
!(edge.targetHandle in targetNode.data.inputs)
|
||||
) {
|
||||
issues.push(
|
||||
`Input field "${edge.target}.${edge.targetHandle}" does not exist`
|
||||
`${i18n.t('nodes.inputFeilds')} "${edge.target}.${
|
||||
edge.targetHandle
|
||||
}" ${i18n.t('nodes.doesNotExist')}`
|
||||
);
|
||||
}
|
||||
if (!nodeTemplates[sourceNode?.data.type ?? '__UNKNOWN_NODE_TYPE__']) {
|
||||
issues.push(
|
||||
`Source node "${edge.source}" missing template "${sourceNode?.data.type}"`
|
||||
`${i18n.t('nodes.sourceNode')} "${edge.source}" ${i18n.t(
|
||||
'nodes.missingTemplate'
|
||||
)} "${sourceNode?.data.type}"`
|
||||
);
|
||||
}
|
||||
if (!nodeTemplates[targetNode?.data.type ?? '__UNKNOWN_NODE_TYPE__']) {
|
||||
issues.push(
|
||||
`Source node "${edge.target}" missing template "${targetNode?.data.type}"`
|
||||
`${i18n.t('nodes.sourceNode')}"${edge.target}" ${i18n.t(
|
||||
'nodes.missingTemplate'
|
||||
)} "${targetNode?.data.type}"`
|
||||
);
|
||||
}
|
||||
if (issues.length) {
|
||||
|
Reference in New Issue
Block a user