mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore(ui): regen api client
This commit is contained in:
parent
8c2e4700f9
commit
4150d5306f
@ -22,15 +22,13 @@ export interface OnCancel {
|
||||
}
|
||||
|
||||
export class CancelablePromise<T> implements Promise<T> {
|
||||
readonly [Symbol.toStringTag]!: string;
|
||||
|
||||
private _isResolved: boolean;
|
||||
private _isRejected: boolean;
|
||||
private _isCancelled: boolean;
|
||||
private readonly _cancelHandlers: (() => void)[];
|
||||
private readonly _promise: Promise<T>;
|
||||
private _resolve?: (value: T | PromiseLike<T>) => void;
|
||||
private _reject?: (reason?: any) => void;
|
||||
#isResolved: boolean;
|
||||
#isRejected: boolean;
|
||||
#isCancelled: boolean;
|
||||
readonly #cancelHandlers: (() => void)[];
|
||||
readonly #promise: Promise<T>;
|
||||
#resolve?: (value: T | PromiseLike<T>) => void;
|
||||
#reject?: (reason?: any) => void;
|
||||
|
||||
constructor(
|
||||
executor: (
|
||||
@ -39,78 +37,82 @@ export class CancelablePromise<T> implements Promise<T> {
|
||||
onCancel: OnCancel
|
||||
) => void
|
||||
) {
|
||||
this._isResolved = false;
|
||||
this._isRejected = false;
|
||||
this._isCancelled = false;
|
||||
this._cancelHandlers = [];
|
||||
this._promise = new Promise<T>((resolve, reject) => {
|
||||
this._resolve = resolve;
|
||||
this._reject = reject;
|
||||
this.#isResolved = false;
|
||||
this.#isRejected = false;
|
||||
this.#isCancelled = false;
|
||||
this.#cancelHandlers = [];
|
||||
this.#promise = new Promise<T>((resolve, reject) => {
|
||||
this.#resolve = resolve;
|
||||
this.#reject = reject;
|
||||
|
||||
const onResolve = (value: T | PromiseLike<T>): void => {
|
||||
if (this._isResolved || this._isRejected || this._isCancelled) {
|
||||
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
||||
return;
|
||||
}
|
||||
this._isResolved = true;
|
||||
this._resolve?.(value);
|
||||
this.#isResolved = true;
|
||||
this.#resolve?.(value);
|
||||
};
|
||||
|
||||
const onReject = (reason?: any): void => {
|
||||
if (this._isResolved || this._isRejected || this._isCancelled) {
|
||||
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
||||
return;
|
||||
}
|
||||
this._isRejected = true;
|
||||
this._reject?.(reason);
|
||||
this.#isRejected = true;
|
||||
this.#reject?.(reason);
|
||||
};
|
||||
|
||||
const onCancel = (cancelHandler: () => void): void => {
|
||||
if (this._isResolved || this._isRejected || this._isCancelled) {
|
||||
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
||||
return;
|
||||
}
|
||||
this._cancelHandlers.push(cancelHandler);
|
||||
this.#cancelHandlers.push(cancelHandler);
|
||||
};
|
||||
|
||||
Object.defineProperty(onCancel, 'isResolved', {
|
||||
get: (): boolean => this._isResolved,
|
||||
get: (): boolean => this.#isResolved,
|
||||
});
|
||||
|
||||
Object.defineProperty(onCancel, 'isRejected', {
|
||||
get: (): boolean => this._isRejected,
|
||||
get: (): boolean => this.#isRejected,
|
||||
});
|
||||
|
||||
Object.defineProperty(onCancel, 'isCancelled', {
|
||||
get: (): boolean => this._isCancelled,
|
||||
get: (): boolean => this.#isCancelled,
|
||||
});
|
||||
|
||||
return executor(onResolve, onReject, onCancel as OnCancel);
|
||||
});
|
||||
}
|
||||
|
||||
get [Symbol.toStringTag]() {
|
||||
return "Cancellable Promise";
|
||||
}
|
||||
|
||||
public then<TResult1 = T, TResult2 = never>(
|
||||
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
||||
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null
|
||||
): Promise<TResult1 | TResult2> {
|
||||
return this._promise.then(onFulfilled, onRejected);
|
||||
return this.#promise.then(onFulfilled, onRejected);
|
||||
}
|
||||
|
||||
public catch<TResult = never>(
|
||||
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null
|
||||
): Promise<T | TResult> {
|
||||
return this._promise.catch(onRejected);
|
||||
return this.#promise.catch(onRejected);
|
||||
}
|
||||
|
||||
public finally(onFinally?: (() => void) | null): Promise<T> {
|
||||
return this._promise.finally(onFinally);
|
||||
return this.#promise.finally(onFinally);
|
||||
}
|
||||
|
||||
public cancel(): void {
|
||||
if (this._isResolved || this._isRejected || this._isCancelled) {
|
||||
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
||||
return;
|
||||
}
|
||||
this._isCancelled = true;
|
||||
if (this._cancelHandlers.length) {
|
||||
this.#isCancelled = true;
|
||||
if (this.#cancelHandlers.length) {
|
||||
try {
|
||||
for (const cancelHandler of this._cancelHandlers) {
|
||||
for (const cancelHandler of this.#cancelHandlers) {
|
||||
cancelHandler();
|
||||
}
|
||||
} catch (error) {
|
||||
@ -118,11 +120,11 @@ export class CancelablePromise<T> implements Promise<T> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this._cancelHandlers.length = 0;
|
||||
this._reject?.(new CancelError('Request aborted'));
|
||||
this.#cancelHandlers.length = 0;
|
||||
this.#reject?.(new CancelError('Request aborted'));
|
||||
}
|
||||
|
||||
public get isCancelled(): boolean {
|
||||
return this._isCancelled;
|
||||
return this.#isCancelled;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ export type { PasteImageInvocation } from './models/PasteImageInvocation';
|
||||
export type { PromptOutput } from './models/PromptOutput';
|
||||
export type { RandomRangeInvocation } from './models/RandomRangeInvocation';
|
||||
export type { RangeInvocation } from './models/RangeInvocation';
|
||||
export type { ResizeLatentsInvocation } from './models/ResizeLatentsInvocation';
|
||||
export type { RestoreFaceInvocation } from './models/RestoreFaceInvocation';
|
||||
export type { ScaleLatentsInvocation } from './models/ScaleLatentsInvocation';
|
||||
export type { ShowImageInvocation } from './models/ShowImageInvocation';
|
||||
export type { SubtractInvocation } from './models/SubtractInvocation';
|
||||
export type { TextToImageInvocation } from './models/TextToImageInvocation';
|
||||
@ -119,7 +121,9 @@ export { $PasteImageInvocation } from './schemas/$PasteImageInvocation';
|
||||
export { $PromptOutput } from './schemas/$PromptOutput';
|
||||
export { $RandomRangeInvocation } from './schemas/$RandomRangeInvocation';
|
||||
export { $RangeInvocation } from './schemas/$RangeInvocation';
|
||||
export { $ResizeLatentsInvocation } from './schemas/$ResizeLatentsInvocation';
|
||||
export { $RestoreFaceInvocation } from './schemas/$RestoreFaceInvocation';
|
||||
export { $ScaleLatentsInvocation } from './schemas/$ScaleLatentsInvocation';
|
||||
export { $ShowImageInvocation } from './schemas/$ShowImageInvocation';
|
||||
export { $SubtractInvocation } from './schemas/$SubtractInvocation';
|
||||
export { $TextToImageInvocation } from './schemas/$TextToImageInvocation';
|
||||
|
@ -25,7 +25,9 @@ import type { ParamIntInvocation } from './ParamIntInvocation';
|
||||
import type { PasteImageInvocation } from './PasteImageInvocation';
|
||||
import type { RandomRangeInvocation } from './RandomRangeInvocation';
|
||||
import type { RangeInvocation } from './RangeInvocation';
|
||||
import type { ResizeLatentsInvocation } from './ResizeLatentsInvocation';
|
||||
import type { RestoreFaceInvocation } from './RestoreFaceInvocation';
|
||||
import type { ScaleLatentsInvocation } from './ScaleLatentsInvocation';
|
||||
import type { ShowImageInvocation } from './ShowImageInvocation';
|
||||
import type { SubtractInvocation } from './SubtractInvocation';
|
||||
import type { TextToImageInvocation } from './TextToImageInvocation';
|
||||
@ -40,7 +42,7 @@ export type Graph = {
|
||||
/**
|
||||
* The nodes in this graph
|
||||
*/
|
||||
nodes?: Record<string, (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | ParamIntInvocation | CvInpaintInvocation | RangeInvocation | RandomRangeInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation)>;
|
||||
nodes?: Record<string, (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | ParamIntInvocation | CvInpaintInvocation | RangeInvocation | RandomRangeInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation)>;
|
||||
/**
|
||||
* The connections between nodes and their fields in this graph
|
||||
*/
|
||||
|
@ -17,10 +17,6 @@ export type LatentsToLatentsInvocation = {
|
||||
* The prompt to generate an image from
|
||||
*/
|
||||
prompt?: string;
|
||||
/**
|
||||
* The seed to use (-1 for a random seed)
|
||||
*/
|
||||
seed?: number;
|
||||
/**
|
||||
* The noise to use
|
||||
*/
|
||||
@ -29,14 +25,6 @@ export type LatentsToLatentsInvocation = {
|
||||
* The number of steps to use to generate the image
|
||||
*/
|
||||
steps?: number;
|
||||
/**
|
||||
* The width of the resulting image
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* The height of the resulting image
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* The Classifier-Free Guidance, higher values may result in a result closer to the prompt
|
||||
*/
|
||||
|
@ -0,0 +1,37 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { LatentsField } from './LatentsField';
|
||||
|
||||
/**
|
||||
* Resizes latents to explicit width/height (in pixels). Provided dimensions are floor-divided by 8.
|
||||
*/
|
||||
export type ResizeLatentsInvocation = {
|
||||
/**
|
||||
* The id of this node. Must be unique among all nodes.
|
||||
*/
|
||||
id: string;
|
||||
type?: 'lresize';
|
||||
/**
|
||||
* The latents to resize
|
||||
*/
|
||||
latents?: LatentsField;
|
||||
/**
|
||||
* The width to resize to (px)
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* The height to resize to (px)
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* The interpolation mode
|
||||
*/
|
||||
mode?: 'nearest' | 'linear' | 'bilinear' | 'bicubic' | 'trilinear' | 'area' | 'nearest-exact';
|
||||
/**
|
||||
* Whether or not to antialias (applied in bilinear and bicubic modes only)
|
||||
*/
|
||||
antialias?: boolean;
|
||||
};
|
||||
|
@ -0,0 +1,33 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { LatentsField } from './LatentsField';
|
||||
|
||||
/**
|
||||
* Scales latents by a given factor.
|
||||
*/
|
||||
export type ScaleLatentsInvocation = {
|
||||
/**
|
||||
* The id of this node. Must be unique among all nodes.
|
||||
*/
|
||||
id: string;
|
||||
type?: 'lscale';
|
||||
/**
|
||||
* The latents to scale
|
||||
*/
|
||||
latents?: LatentsField;
|
||||
/**
|
||||
* The factor by which to scale the latents
|
||||
*/
|
||||
scale_factor: number;
|
||||
/**
|
||||
* The interpolation mode
|
||||
*/
|
||||
mode?: 'nearest' | 'linear' | 'bilinear' | 'bicubic' | 'trilinear' | 'area' | 'nearest-exact';
|
||||
/**
|
||||
* Whether or not to antialias (applied in bilinear and bicubic modes only)
|
||||
*/
|
||||
antialias?: boolean;
|
||||
};
|
||||
|
@ -17,10 +17,6 @@ export type TextToLatentsInvocation = {
|
||||
* The prompt to generate an image from
|
||||
*/
|
||||
prompt?: string;
|
||||
/**
|
||||
* The seed to use (-1 for a random seed)
|
||||
*/
|
||||
seed?: number;
|
||||
/**
|
||||
* The noise to use
|
||||
*/
|
||||
@ -29,14 +25,6 @@ export type TextToLatentsInvocation = {
|
||||
* The number of steps to use to generate the image
|
||||
*/
|
||||
steps?: number;
|
||||
/**
|
||||
* The width of the resulting image
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* The height of the resulting image
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* The Classifier-Free Guidance, higher values may result in a result closer to the prompt
|
||||
*/
|
||||
|
@ -33,6 +33,10 @@ export const $Graph = {
|
||||
type: 'TextToLatentsInvocation',
|
||||
}, {
|
||||
type: 'LatentsToImageInvocation',
|
||||
}, {
|
||||
type: 'ResizeLatentsInvocation',
|
||||
}, {
|
||||
type: 'ScaleLatentsInvocation',
|
||||
}, {
|
||||
type: 'AddInvocation',
|
||||
}, {
|
||||
|
@ -16,12 +16,6 @@ export const $LatentsToLatentsInvocation = {
|
||||
type: 'string',
|
||||
description: `The prompt to generate an image from`,
|
||||
},
|
||||
seed: {
|
||||
type: 'number',
|
||||
description: `The seed to use (-1 for a random seed)`,
|
||||
maximum: 4294967295,
|
||||
minimum: -1,
|
||||
},
|
||||
noise: {
|
||||
type: 'all-of',
|
||||
description: `The noise to use`,
|
||||
@ -33,16 +27,6 @@ export const $LatentsToLatentsInvocation = {
|
||||
type: 'number',
|
||||
description: `The number of steps to use to generate the image`,
|
||||
},
|
||||
width: {
|
||||
type: 'number',
|
||||
description: `The width of the resulting image`,
|
||||
multipleOf: 64,
|
||||
},
|
||||
height: {
|
||||
type: 'number',
|
||||
description: `The height of the resulting image`,
|
||||
multipleOf: 64,
|
||||
},
|
||||
cfg_scale: {
|
||||
type: 'number',
|
||||
description: `The Classifier-Free Guidance, higher values may result in a result closer to the prompt`,
|
||||
|
@ -0,0 +1,44 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export const $ResizeLatentsInvocation = {
|
||||
description: `Resizes latents to explicit width/height (in pixels). Provided dimensions are floor-divided by 8.`,
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
description: `The id of this node. Must be unique among all nodes.`,
|
||||
isRequired: true,
|
||||
},
|
||||
type: {
|
||||
type: 'Enum',
|
||||
},
|
||||
latents: {
|
||||
type: 'all-of',
|
||||
description: `The latents to resize`,
|
||||
contains: [{
|
||||
type: 'LatentsField',
|
||||
}],
|
||||
},
|
||||
width: {
|
||||
type: 'number',
|
||||
description: `The width to resize to (px)`,
|
||||
isRequired: true,
|
||||
minimum: 64,
|
||||
multipleOf: 8,
|
||||
},
|
||||
height: {
|
||||
type: 'number',
|
||||
description: `The height to resize to (px)`,
|
||||
isRequired: true,
|
||||
minimum: 64,
|
||||
multipleOf: 8,
|
||||
},
|
||||
mode: {
|
||||
type: 'Enum',
|
||||
},
|
||||
antialias: {
|
||||
type: 'boolean',
|
||||
description: `Whether or not to antialias (applied in bilinear and bicubic modes only)`,
|
||||
},
|
||||
},
|
||||
} as const;
|
@ -0,0 +1,35 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export const $ScaleLatentsInvocation = {
|
||||
description: `Scales latents by a given factor.`,
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
description: `The id of this node. Must be unique among all nodes.`,
|
||||
isRequired: true,
|
||||
},
|
||||
type: {
|
||||
type: 'Enum',
|
||||
},
|
||||
latents: {
|
||||
type: 'all-of',
|
||||
description: `The latents to scale`,
|
||||
contains: [{
|
||||
type: 'LatentsField',
|
||||
}],
|
||||
},
|
||||
scale_factor: {
|
||||
type: 'number',
|
||||
description: `The factor by which to scale the latents`,
|
||||
isRequired: true,
|
||||
},
|
||||
mode: {
|
||||
type: 'Enum',
|
||||
},
|
||||
antialias: {
|
||||
type: 'boolean',
|
||||
description: `Whether or not to antialias (applied in bilinear and bicubic modes only)`,
|
||||
},
|
||||
},
|
||||
} as const;
|
@ -16,12 +16,6 @@ export const $TextToLatentsInvocation = {
|
||||
type: 'string',
|
||||
description: `The prompt to generate an image from`,
|
||||
},
|
||||
seed: {
|
||||
type: 'number',
|
||||
description: `The seed to use (-1 for a random seed)`,
|
||||
maximum: 4294967295,
|
||||
minimum: -1,
|
||||
},
|
||||
noise: {
|
||||
type: 'all-of',
|
||||
description: `The noise to use`,
|
||||
@ -33,16 +27,6 @@ export const $TextToLatentsInvocation = {
|
||||
type: 'number',
|
||||
description: `The number of steps to use to generate the image`,
|
||||
},
|
||||
width: {
|
||||
type: 'number',
|
||||
description: `The width of the resulting image`,
|
||||
multipleOf: 64,
|
||||
},
|
||||
height: {
|
||||
type: 'number',
|
||||
description: `The height of the resulting image`,
|
||||
multipleOf: 64,
|
||||
},
|
||||
cfg_scale: {
|
||||
type: 'number',
|
||||
description: `The Classifier-Free Guidance, higher values may result in a result closer to the prompt`,
|
||||
|
@ -27,7 +27,9 @@ import type { ParamIntInvocation } from '../models/ParamIntInvocation';
|
||||
import type { PasteImageInvocation } from '../models/PasteImageInvocation';
|
||||
import type { RandomRangeInvocation } from '../models/RandomRangeInvocation';
|
||||
import type { RangeInvocation } from '../models/RangeInvocation';
|
||||
import type { ResizeLatentsInvocation } from '../models/ResizeLatentsInvocation';
|
||||
import type { RestoreFaceInvocation } from '../models/RestoreFaceInvocation';
|
||||
import type { ScaleLatentsInvocation } from '../models/ScaleLatentsInvocation';
|
||||
import type { ShowImageInvocation } from '../models/ShowImageInvocation';
|
||||
import type { SubtractInvocation } from '../models/SubtractInvocation';
|
||||
import type { TextToImageInvocation } from '../models/TextToImageInvocation';
|
||||
@ -142,7 +144,7 @@ export class SessionsService {
|
||||
* The id of the session
|
||||
*/
|
||||
sessionId: string,
|
||||
requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | ParamIntInvocation | CvInpaintInvocation | RangeInvocation | RandomRangeInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation),
|
||||
requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | ParamIntInvocation | CvInpaintInvocation | RangeInvocation | RandomRangeInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation),
|
||||
}): CancelablePromise<string> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'POST',
|
||||
@ -179,7 +181,7 @@ export class SessionsService {
|
||||
* The path to the node in the graph
|
||||
*/
|
||||
nodePath: string,
|
||||
requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | ParamIntInvocation | CvInpaintInvocation | RangeInvocation | RandomRangeInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation),
|
||||
requestBody: (LoadImageInvocation | ShowImageInvocation | CropImageInvocation | PasteImageInvocation | MaskFromAlphaInvocation | BlurInvocation | LerpInvocation | InverseLerpInvocation | NoiseInvocation | TextToLatentsInvocation | LatentsToImageInvocation | ResizeLatentsInvocation | ScaleLatentsInvocation | AddInvocation | SubtractInvocation | MultiplyInvocation | DivideInvocation | ParamIntInvocation | CvInpaintInvocation | RangeInvocation | RandomRangeInvocation | UpscaleInvocation | RestoreFaceInvocation | TextToImageInvocation | GraphInvocation | IterateInvocation | CollectInvocation | LatentsToLatentsInvocation | ImageToImageInvocation | InpaintInvocation),
|
||||
}): CancelablePromise<GraphExecutionState> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'PUT',
|
||||
|
Loading…
Reference in New Issue
Block a user