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
*/
id?: string;
id: string;
/**
* The graph being executed
*/
@ -25,30 +25,30 @@ export type GraphExecutionState = {
/**
* The expanded graph of activated and executed nodes
*/
execution_graph?: Graph;
execution_graph: Graph;
/**
* 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
*/
executed_history?: Array<string>;
executed_history: Array<string>;
/**
* 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?: Record<string, string>;
errors: Record<string, string>;
/**
* 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
*/
source_prepared_mapping?: Record<string, Array<string>>;
source_prepared_mapping: Record<string, Array<string>>;
};

View File

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

View File

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

View File

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