mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
chore(ui): format
Lots of changed bc the line length is now 120. May as well do it now.
This commit is contained in:
@@ -3,9 +3,7 @@ import type { CurrentImageNode } from 'features/nodes/types/invocation';
|
||||
import type { XYPosition } from 'reactflow';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
export const buildCurrentImageNode = (
|
||||
position: XYPosition
|
||||
): CurrentImageNode => {
|
||||
export const buildCurrentImageNode = (position: XYPosition): CurrentImageNode => {
|
||||
const nodeId = uuidv4();
|
||||
const node: CurrentImageNode = {
|
||||
...SHARED_NODE_PROPERTIES,
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
import { SHARED_NODE_PROPERTIES } from 'features/nodes/types/constants';
|
||||
import type {
|
||||
FieldInputInstance,
|
||||
FieldOutputInstance,
|
||||
} from 'features/nodes/types/field';
|
||||
import type {
|
||||
InvocationNode,
|
||||
InvocationTemplate,
|
||||
} from 'features/nodes/types/invocation';
|
||||
import type { FieldInputInstance, FieldOutputInstance } from 'features/nodes/types/field';
|
||||
import type { InvocationNode, InvocationTemplate } from 'features/nodes/types/invocation';
|
||||
import { buildFieldInputInstance } from 'features/nodes/util/schema/buildFieldInputInstance';
|
||||
import { reduce } from 'lodash-es';
|
||||
import type { XYPosition } from 'reactflow';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
export const buildInvocationNode = (
|
||||
position: XYPosition,
|
||||
template: InvocationTemplate
|
||||
): InvocationNode => {
|
||||
export const buildInvocationNode = (position: XYPosition, template: InvocationTemplate): InvocationNode => {
|
||||
const nodeId = uuidv4();
|
||||
const { type } = template;
|
||||
|
||||
@@ -24,10 +15,7 @@ export const buildInvocationNode = (
|
||||
(inputsAccumulator, inputTemplate, inputName) => {
|
||||
const fieldId = uuidv4();
|
||||
|
||||
const inputFieldValue: FieldInputInstance = buildFieldInputInstance(
|
||||
fieldId,
|
||||
inputTemplate
|
||||
);
|
||||
const inputFieldValue: FieldInputInstance = buildFieldInputInstance(fieldId, inputTemplate);
|
||||
|
||||
inputsAccumulator[inputName] = inputFieldValue;
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import type {
|
||||
FieldInputTemplate,
|
||||
FieldOutputTemplate,
|
||||
} from 'features/nodes/types/field';
|
||||
import type { FieldInputTemplate, FieldOutputTemplate } from 'features/nodes/types/field';
|
||||
import { isNil } from 'lodash-es';
|
||||
|
||||
export const getSortedFilteredFieldNames = (
|
||||
fields: FieldInputTemplate[] | FieldOutputTemplate[]
|
||||
): string[] => {
|
||||
export const getSortedFilteredFieldNames = (fields: FieldInputTemplate[] | FieldOutputTemplate[]): string[] => {
|
||||
const visibleFields = fields.filter((field) => !field.ui_hidden);
|
||||
|
||||
// we want explicitly ordered fields to be before unordered fields; split the list
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
import { satisfies } from 'compare-versions';
|
||||
import { NodeUpdateError } from 'features/nodes/types/error';
|
||||
import type {
|
||||
InvocationNode,
|
||||
InvocationTemplate,
|
||||
} from 'features/nodes/types/invocation';
|
||||
import type { InvocationNode, InvocationTemplate } from 'features/nodes/types/invocation';
|
||||
import { zParsedSemver } from 'features/nodes/types/semver';
|
||||
import { cloneDeep, defaultsDeep, keys, pick } from 'lodash-es';
|
||||
|
||||
import { buildInvocationNode } from './buildInvocationNode';
|
||||
|
||||
export const getNeedsUpdate = (
|
||||
node: InvocationNode,
|
||||
template: InvocationTemplate
|
||||
): boolean => {
|
||||
export const getNeedsUpdate = (node: InvocationNode, template: InvocationTemplate): boolean => {
|
||||
if (node.data.type !== template.type) {
|
||||
return true;
|
||||
}
|
||||
@@ -23,10 +17,7 @@ export const getNeedsUpdate = (
|
||||
* @param template The invocation template to check against.
|
||||
*/
|
||||
|
||||
export const getMayUpdateNode = (
|
||||
node: InvocationNode,
|
||||
template: InvocationTemplate
|
||||
): boolean => {
|
||||
export const getMayUpdateNode = (node: InvocationNode, template: InvocationTemplate): boolean => {
|
||||
const needsUpdate = getNeedsUpdate(node, template);
|
||||
if (!needsUpdate || node.data.type !== template.type) {
|
||||
return false;
|
||||
@@ -44,10 +35,7 @@ export const getMayUpdateNode = (
|
||||
* @throws {NodeUpdateError} If the node is not an invocation node.
|
||||
*/
|
||||
|
||||
export const updateNode = (
|
||||
node: InvocationNode,
|
||||
template: InvocationTemplate
|
||||
): InvocationNode => {
|
||||
export const updateNode = (node: InvocationNode, template: InvocationTemplate): InvocationNode => {
|
||||
const mayUpdate = getMayUpdateNode(node, template);
|
||||
|
||||
if (!mayUpdate || node.data.type !== template.type) {
|
||||
|
||||
Reference in New Issue
Block a user