feat(backend): fixes for nodes/generator

This commit is contained in:
psychedelicious 2023-03-15 23:31:52 +11:00
parent d66d844dd2
commit 92996898f2
4 changed files with 133 additions and 57 deletions

View File

@ -17,7 +17,7 @@ export type GraphExecutionState = {
/** /**
* The id of the execution state * The id of the execution state
*/ */
id?: string; id: string;
/** /**
* The graph being executed * The graph being executed
*/ */
@ -25,30 +25,30 @@ export type GraphExecutionState = {
/** /**
* The expanded graph of activated and executed nodes * The expanded graph of activated and executed nodes
*/ */
execution_graph?: Graph; execution_graph: Graph;
/** /**
* The set of node ids that have been executed * The set of node ids that have been executed
*/ */
executed?: Array<string>; executed: Array<string>;
/** /**
* The list of node ids that have been executed, in order of execution * The list of node ids that have been executed, in order of execution
*/ */
executed_history?: Array<string>; executed_history: Array<string>;
/** /**
* The results of node executions * The results of node executions
*/ */
results?: Record<string, (ImageOutput | MaskOutput | PromptOutput | GraphInvocationOutput | IterateInvocationOutput | CollectInvocationOutput)>; results: Record<string, (ImageOutput | MaskOutput | PromptOutput | GraphInvocationOutput | IterateInvocationOutput | CollectInvocationOutput)>;
/** /**
* Errors raised when executing nodes * Errors raised when executing nodes
*/ */
errors?: Record<string, string>; errors: Record<string, string>;
/** /**
* The map of prepared nodes to original graph nodes * The map of prepared nodes to original graph nodes
*/ */
prepared_source_mapping?: Record<string, string>; prepared_source_mapping: Record<string, string>;
/** /**
* The map of original graph nodes to prepared nodes * The map of original graph nodes to prepared nodes
*/ */
source_prepared_mapping?: Record<string, Array<string>>; source_prepared_mapping: Record<string, Array<string>>;
}; };

View File

@ -7,6 +7,7 @@ export const $GraphExecutionState = {
id: { id: {
type: 'string', type: 'string',
description: `The id of the execution state`, description: `The id of the execution state`,
isRequired: true,
}, },
graph: { graph: {
type: 'all-of', type: 'all-of',
@ -22,18 +23,21 @@ export const $GraphExecutionState = {
contains: [{ contains: [{
type: 'Graph', type: 'Graph',
}], }],
isRequired: true,
}, },
executed: { executed: {
type: 'array', type: 'array',
contains: { contains: {
type: 'string', type: 'string',
}, },
isRequired: true,
}, },
executed_history: { executed_history: {
type: 'array', type: 'array',
contains: { contains: {
type: 'string', type: 'string',
}, },
isRequired: true,
}, },
results: { results: {
type: 'dictionary', type: 'dictionary',
@ -53,18 +57,21 @@ export const $GraphExecutionState = {
type: 'CollectInvocationOutput', type: 'CollectInvocationOutput',
}], }],
}, },
isRequired: true,
}, },
errors: { errors: {
type: 'dictionary', type: 'dictionary',
contains: { contains: {
type: 'string', type: 'string',
}, },
isRequired: true,
}, },
prepared_source_mapping: { prepared_source_mapping: {
type: 'dictionary', type: 'dictionary',
contains: { contains: {
type: 'string', type: 'string',
}, },
isRequired: true,
}, },
source_prepared_mapping: { source_prepared_mapping: {
type: 'dictionary', type: 'dictionary',
@ -74,6 +81,7 @@ export const $GraphExecutionState = {
type: 'string', type: 'string',
}, },
}, },
isRequired: true,
}, },
}, },
} as const; } as const;

View File

@ -13,15 +13,22 @@ export class ImagesService {
/** /**
* Get Image * Get Image
* Gets a result * Gets a result
* @param imageType The type of image to get
* @param imageName The name of the image to get
* @returns any Successful Response * @returns any Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static getImage( public static getImage({
imageType,
imageName,
}: {
/**
* The type of image to get
*/
imageType: ImageType, imageType: ImageType,
/**
* The name of the image to get
*/
imageName: string, imageName: string,
): CancelablePromise<any> { }): CancelablePromise<any> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'GET', method: 'GET',
url: '/api/v1/images/{image_type}/{image_name}', url: '/api/v1/images/{image_type}/{image_name}',
@ -37,13 +44,14 @@ export class ImagesService {
/** /**
* Upload Image * Upload Image
* @param formData
* @returns any Successful Response * @returns any Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static uploadImage( public static uploadImage({
formData,
}: {
formData: Body_upload_image, formData: Body_upload_image,
): CancelablePromise<any> { }): CancelablePromise<any> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'POST', method: 'POST',
url: '/api/v1/images/uploads/', url: '/api/v1/images/uploads/',

View File

@ -32,17 +32,27 @@ export class SessionsService {
/** /**
* List Sessions * List Sessions
* Gets a list of sessions, optionally searching * Gets a list of sessions, optionally searching
* @param page The page of results to get
* @param perPage The number of results per page
* @param query The query string to search for
* @returns PaginatedResults_GraphExecutionState_ Successful Response * @returns PaginatedResults_GraphExecutionState_ Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static listSessions( public static listSessions({
page,
perPage = 10,
query = '',
}: {
/**
* The page of results to get
*/
page?: number, page?: number,
perPage: number = 10, /**
query: string = '', * The number of results per page
): CancelablePromise<PaginatedResults_GraphExecutionState_> { */
perPage?: number,
/**
* The query string to search for
*/
query?: string,
}): CancelablePromise<PaginatedResults_GraphExecutionState_> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'GET', method: 'GET',
url: '/api/v1/sessions/', url: '/api/v1/sessions/',
@ -60,13 +70,14 @@ export class SessionsService {
/** /**
* Create Session * Create Session
* Creates a new session, optionally initializing it with an invocation graph * Creates a new session, optionally initializing it with an invocation graph
* @param requestBody
* @returns GraphExecutionState Successful Response * @returns GraphExecutionState Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static createSession( public static createSession({
requestBody,
}: {
requestBody?: Graph, requestBody?: Graph,
): CancelablePromise<GraphExecutionState> { }): CancelablePromise<GraphExecutionState> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'POST', method: 'POST',
url: '/api/v1/sessions/', url: '/api/v1/sessions/',
@ -82,13 +93,17 @@ export class SessionsService {
/** /**
* Get Session * Get Session
* Gets a session * Gets a session
* @param sessionId The id of the session to get
* @returns GraphExecutionState Successful Response * @returns GraphExecutionState Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static getSession( public static getSession({
sessionId,
}: {
/**
* The id of the session to get
*/
sessionId: string, sessionId: string,
): CancelablePromise<GraphExecutionState> { }): CancelablePromise<GraphExecutionState> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'GET', method: 'GET',
url: '/api/v1/sessions/{session_id}', url: '/api/v1/sessions/{session_id}',
@ -105,15 +120,19 @@ export class SessionsService {
/** /**
* Add Node * Add Node
* Adds a node to the graph * Adds a node to the graph
* @param sessionId The id of the session
* @param requestBody
* @returns string Successful Response * @returns string Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static addNode( public static addNode({
sessionId,
requestBody,
}: {
/**
* The id of the session
*/
sessionId: string, sessionId: string,
requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | CvInpaintInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | ImageToImageInvocation | InpaintInvocation), requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | CvInpaintInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | ImageToImageInvocation | InpaintInvocation),
): CancelablePromise<string> { }): CancelablePromise<string> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'POST', method: 'POST',
url: '/api/v1/sessions/{session_id}/nodes', url: '/api/v1/sessions/{session_id}/nodes',
@ -133,17 +152,24 @@ export class SessionsService {
/** /**
* Update Node * Update Node
* Updates a node in the graph and removes all linked edges * Updates a node in the graph and removes all linked edges
* @param sessionId The id of the session
* @param nodePath The path to the node in the graph
* @param requestBody
* @returns GraphExecutionState Successful Response * @returns GraphExecutionState Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static updateNode( public static updateNode({
sessionId,
nodePath,
requestBody,
}: {
/**
* The id of the session
*/
sessionId: string, sessionId: string,
/**
* The path to the node in the graph
*/
nodePath: string, nodePath: string,
requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | CvInpaintInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | ImageToImageInvocation | InpaintInvocation), requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | CvInpaintInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | ImageToImageInvocation | InpaintInvocation),
): CancelablePromise<GraphExecutionState> { }): CancelablePromise<GraphExecutionState> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'PUT', method: 'PUT',
url: '/api/v1/sessions/{session_id}/nodes/{node_path}', url: '/api/v1/sessions/{session_id}/nodes/{node_path}',
@ -164,15 +190,22 @@ export class SessionsService {
/** /**
* Delete Node * Delete Node
* Deletes a node in the graph and removes all linked edges * Deletes a node in the graph and removes all linked edges
* @param sessionId The id of the session
* @param nodePath The path to the node to delete
* @returns GraphExecutionState Successful Response * @returns GraphExecutionState Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static deleteNode( public static deleteNode({
sessionId,
nodePath,
}: {
/**
* The id of the session
*/
sessionId: string, sessionId: string,
/**
* The path to the node to delete
*/
nodePath: string, nodePath: string,
): CancelablePromise<GraphExecutionState> { }): CancelablePromise<GraphExecutionState> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'DELETE', method: 'DELETE',
url: '/api/v1/sessions/{session_id}/nodes/{node_path}', url: '/api/v1/sessions/{session_id}/nodes/{node_path}',
@ -191,15 +224,19 @@ export class SessionsService {
/** /**
* Add Edge * Add Edge
* Adds an edge to the graph * Adds an edge to the graph
* @param sessionId The id of the session
* @param requestBody
* @returns GraphExecutionState Successful Response * @returns GraphExecutionState Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static addEdge( public static addEdge({
sessionId,
requestBody,
}: {
/**
* The id of the session
*/
sessionId: string, sessionId: string,
requestBody: Edge, requestBody: Edge,
): CancelablePromise<GraphExecutionState> { }): CancelablePromise<GraphExecutionState> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'POST', method: 'POST',
url: '/api/v1/sessions/{session_id}/edges', url: '/api/v1/sessions/{session_id}/edges',
@ -219,21 +256,37 @@ export class SessionsService {
/** /**
* Delete Edge * Delete Edge
* Deletes an edge from the graph * Deletes an edge from the graph
* @param sessionId The id of the session
* @param fromNodeId The id of the node the edge is coming from
* @param fromField The field of the node the edge is coming from
* @param toNodeId The id of the node the edge is going to
* @param toField The field of the node the edge is going to
* @returns GraphExecutionState Successful Response * @returns GraphExecutionState Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static deleteEdge( public static deleteEdge({
sessionId,
fromNodeId,
fromField,
toNodeId,
toField,
}: {
/**
* The id of the session
*/
sessionId: string, sessionId: string,
/**
* The id of the node the edge is coming from
*/
fromNodeId: string, fromNodeId: string,
/**
* The field of the node the edge is coming from
*/
fromField: string, fromField: string,
/**
* The id of the node the edge is going to
*/
toNodeId: string, toNodeId: string,
/**
* The field of the node the edge is going to
*/
toField: string, toField: string,
): CancelablePromise<GraphExecutionState> { }): CancelablePromise<GraphExecutionState> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'DELETE', method: 'DELETE',
url: '/api/v1/sessions/{session_id}/edges/{from_node_id}/{from_field}/{to_node_id}/{to_field}', url: '/api/v1/sessions/{session_id}/edges/{from_node_id}/{from_field}/{to_node_id}/{to_field}',
@ -255,15 +308,22 @@ export class SessionsService {
/** /**
* Invoke Session * Invoke Session
* Invokes a session * Invokes a session
* @param sessionId The id of the session to invoke
* @param all Whether or not to invoke all remaining invocations
* @returns any Successful Response * @returns any Successful Response
* @throws ApiError * @throws ApiError
*/ */
public static invokeSession( public static invokeSession({
sessionId,
all = false,
}: {
/**
* The id of the session to invoke
*/
sessionId: string, sessionId: string,
all: boolean = false, /**
): CancelablePromise<any> { * Whether or not to invoke all remaining invocations
*/
all?: boolean,
}): CancelablePromise<any> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'PUT', method: 'PUT',
url: '/api/v1/sessions/{session_id}/invoke', url: '/api/v1/sessions/{session_id}/invoke',