From 16442e8f155048bbd40fbff08f3bba931ab504a7 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed, 15 Mar 2023 18:44:51 +1100 Subject: [PATCH] fix(ui): update client & nodes test code w/ new Edge type --- invokeai/frontend/web/src/app/NodeAPITest.tsx | 8 +++---- .../frontend/web/src/services/api/index.ts | 2 ++ .../web/src/services/api/models/Edge.ts | 17 ++++++++++++++ .../web/src/services/api/models/Graph.ts | 4 ++-- .../web/src/services/api/schemas/$Edge.ts | 23 +++++++++++++++++++ .../web/src/services/api/schemas/$Graph.ts | 6 +---- .../services/api/services/SessionsService.ts | 3 ++- 7 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 invokeai/frontend/web/src/services/api/models/Edge.ts create mode 100644 invokeai/frontend/web/src/services/api/schemas/$Edge.ts diff --git a/invokeai/frontend/web/src/app/NodeAPITest.tsx b/invokeai/frontend/web/src/app/NodeAPITest.tsx index 1420ec04c8..0aa8e84f3a 100644 --- a/invokeai/frontend/web/src/app/NodeAPITest.tsx +++ b/invokeai/frontend/web/src/app/NodeAPITest.tsx @@ -45,10 +45,10 @@ const NodeAPITest = () => { }, }, edges: [ - [ - { node_id: 'a', field: 'image' }, - { node_id: 'b', field: 'image' }, - ], + { + source: { node_id: 'a', field: 'image' }, + destination: { node_id: 'b', field: 'image' }, + }, ], }); diff --git a/invokeai/frontend/web/src/services/api/index.ts b/invokeai/frontend/web/src/services/api/index.ts index 2495235fda..d10e0b6624 100644 --- a/invokeai/frontend/web/src/services/api/index.ts +++ b/invokeai/frontend/web/src/services/api/index.ts @@ -12,6 +12,7 @@ export type { CollectInvocation } from './models/CollectInvocation'; export type { CollectInvocationOutput } from './models/CollectInvocationOutput'; export type { CropImageInvocation } from './models/CropImageInvocation'; export type { CvInpaintInvocation } from './models/CvInpaintInvocation'; +export type { Edge } from './models/Edge'; export type { EdgeConnection } from './models/EdgeConnection'; export type { Graph } from './models/Graph'; export type { GraphExecutionState } from './models/GraphExecutionState'; @@ -45,6 +46,7 @@ export { $CollectInvocation } from './schemas/$CollectInvocation'; export { $CollectInvocationOutput } from './schemas/$CollectInvocationOutput'; export { $CropImageInvocation } from './schemas/$CropImageInvocation'; export { $CvInpaintInvocation } from './schemas/$CvInpaintInvocation'; +export { $Edge } from './schemas/$Edge'; export { $EdgeConnection } from './schemas/$EdgeConnection'; export { $Graph } from './schemas/$Graph'; export { $GraphExecutionState } from './schemas/$GraphExecutionState'; diff --git a/invokeai/frontend/web/src/services/api/models/Edge.ts b/invokeai/frontend/web/src/services/api/models/Edge.ts new file mode 100644 index 0000000000..bba275cb26 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/Edge.ts @@ -0,0 +1,17 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { EdgeConnection } from './EdgeConnection'; + +export type Edge = { + /** + * The connection for the edge's from node and field + */ + source: EdgeConnection; + /** + * The connection for the edge's to node and field + */ + destination: EdgeConnection; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/Graph.ts b/invokeai/frontend/web/src/services/api/models/Graph.ts index 9070de7588..0b8cd3029f 100644 --- a/invokeai/frontend/web/src/services/api/models/Graph.ts +++ b/invokeai/frontend/web/src/services/api/models/Graph.ts @@ -6,7 +6,7 @@ import type { BlurInvocation } from './BlurInvocation'; import type { CollectInvocation } from './CollectInvocation'; import type { CropImageInvocation } from './CropImageInvocation'; import type { CvInpaintInvocation } from './CvInpaintInvocation'; -import type { EdgeConnection } from './EdgeConnection'; +import type { Edge } from './Edge'; import type { GraphInvocation } from './GraphInvocation'; import type { ImageToImageInvocation } from './ImageToImageInvocation'; import type { InpaintInvocation } from './InpaintInvocation'; @@ -33,6 +33,6 @@ export type Graph = { /** * The connections between nodes and their fields in this graph */ - edges?: Array<[EdgeConnection, EdgeConnection]>; + edges?: Array; }; diff --git a/invokeai/frontend/web/src/services/api/schemas/$Edge.ts b/invokeai/frontend/web/src/services/api/schemas/$Edge.ts new file mode 100644 index 0000000000..d7e7028bf1 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/schemas/$Edge.ts @@ -0,0 +1,23 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $Edge = { + properties: { + source: { + type: 'all-of', + description: `The connection for the edge's from node and field`, + contains: [{ + type: 'EdgeConnection', + }], + isRequired: true, + }, + destination: { + type: 'all-of', + description: `The connection for the edge's to node and field`, + contains: [{ + type: 'EdgeConnection', + }], + isRequired: true, + }, + }, +} as const; diff --git a/invokeai/frontend/web/src/services/api/schemas/$Graph.ts b/invokeai/frontend/web/src/services/api/schemas/$Graph.ts index 95a51e55b8..61cb6e477f 100644 --- a/invokeai/frontend/web/src/services/api/schemas/$Graph.ts +++ b/invokeai/frontend/web/src/services/api/schemas/$Graph.ts @@ -51,11 +51,7 @@ export const $Graph = { edges: { type: 'array', contains: { - type: 'array', - contains: { - properties: { - }, - }, + type: 'Edge', }, }, }, diff --git a/invokeai/frontend/web/src/services/api/services/SessionsService.ts b/invokeai/frontend/web/src/services/api/services/SessionsService.ts index 17386f8d08..8941355157 100644 --- a/invokeai/frontend/web/src/services/api/services/SessionsService.ts +++ b/invokeai/frontend/web/src/services/api/services/SessionsService.ts @@ -5,6 +5,7 @@ import type { BlurInvocation } from '../models/BlurInvocation'; import type { CollectInvocation } from '../models/CollectInvocation'; import type { CropImageInvocation } from '../models/CropImageInvocation'; import type { CvInpaintInvocation } from '../models/CvInpaintInvocation'; +import type { Edge } from '../models/Edge'; import type { Graph } from '../models/Graph'; import type { GraphExecutionState } from '../models/GraphExecutionState'; import type { GraphInvocation } from '../models/GraphInvocation'; @@ -197,7 +198,7 @@ export class SessionsService { */ public static addEdge( sessionId: string, - requestBody: Array, + requestBody: Edge, ): CancelablePromise { return __request(OpenAPI, { method: 'POST',