@runware/sdk-js 1.0.30 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +117 -61
- package/dist/index.d.ts +117 -61
- package/dist/index.js +276 -340
- package/dist/index.mjs +275 -340
- package/package.json +2 -2
- package/readme.md +198 -72
package/dist/index.d.mts
CHANGED
|
@@ -7,20 +7,44 @@ declare enum SdkType {
|
|
|
7
7
|
CLIENT = "CLIENT",
|
|
8
8
|
SERVER = "SERVER"
|
|
9
9
|
}
|
|
10
|
+
declare enum ETaskType {
|
|
11
|
+
IMAGE_INFERENCE = "imageInference",
|
|
12
|
+
IMAGE_UPLOAD = "imageUpload",
|
|
13
|
+
IMAGE_UPSCALE = "imageUpscale",
|
|
14
|
+
IMAGE_BACKGROUND_REMOVAL = "imageBackgroundRemoval",
|
|
15
|
+
IMAGE_CAPTION = "imageCaption",
|
|
16
|
+
IMAGE_CONTROL_NET_PRE_PROCESS = "imageControlNetPreProcess",
|
|
17
|
+
PROMPT_ENHANCE = "promptEnhance",
|
|
18
|
+
AUTHENTICATION = "authentication"
|
|
19
|
+
}
|
|
10
20
|
type RunwareBaseType = {
|
|
11
21
|
apiKey: string;
|
|
12
22
|
url?: string;
|
|
13
23
|
};
|
|
24
|
+
type IOutputType = "base64Data" | "dataURI" | "URL";
|
|
25
|
+
type IOutputFormat = "JPG" | "PNG" | "WEBP";
|
|
14
26
|
interface IImage {
|
|
15
|
-
|
|
27
|
+
taskType: ETaskType;
|
|
16
28
|
imageUUID: string;
|
|
29
|
+
inputImageUUID?: string;
|
|
17
30
|
taskUUID: string;
|
|
18
|
-
|
|
19
|
-
cost: number;
|
|
31
|
+
imageURL?: string;
|
|
20
32
|
imageBase64Data?: string;
|
|
33
|
+
imageDataURI?: string;
|
|
34
|
+
NSFWContent?: boolean;
|
|
35
|
+
cost?: number;
|
|
36
|
+
}
|
|
37
|
+
interface IControlNetImage {
|
|
38
|
+
taskUUID: string;
|
|
39
|
+
inputImageUUID: string;
|
|
40
|
+
guideImageUUID: string;
|
|
41
|
+
guideImageURL?: string;
|
|
42
|
+
guideImageBase64Data?: string;
|
|
43
|
+
guideImageDataURI?: string;
|
|
44
|
+
cost?: number;
|
|
21
45
|
}
|
|
22
46
|
interface ILora {
|
|
23
|
-
|
|
47
|
+
model: string | number;
|
|
24
48
|
weight: number;
|
|
25
49
|
}
|
|
26
50
|
declare enum EControlMode {
|
|
@@ -29,30 +53,30 @@ declare enum EControlMode {
|
|
|
29
53
|
CONTROL_NET = "controlnet"
|
|
30
54
|
}
|
|
31
55
|
type IControlNetGeneral = {
|
|
32
|
-
|
|
33
|
-
weight: number;
|
|
34
|
-
startStep: number;
|
|
35
|
-
endStep: number;
|
|
56
|
+
model: string;
|
|
36
57
|
guideImage: string | File;
|
|
37
|
-
|
|
58
|
+
weight?: number;
|
|
59
|
+
startStep?: number;
|
|
60
|
+
startStepPercentage?: number;
|
|
61
|
+
endStep?: number;
|
|
62
|
+
endStepPercentage?: number;
|
|
38
63
|
controlMode: EControlMode;
|
|
39
|
-
returnBase64Image?: boolean;
|
|
40
64
|
};
|
|
41
|
-
type
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
65
|
+
type IControlNetPreprocess = {
|
|
66
|
+
inputImage: string | File;
|
|
67
|
+
preProcessor: EPreProcessor;
|
|
68
|
+
height?: number;
|
|
69
|
+
width?: number;
|
|
70
|
+
outputType?: IOutputType;
|
|
71
|
+
outputFormat?: IOutputFormat;
|
|
72
|
+
highThresholdCanny?: number;
|
|
73
|
+
lowThresholdCanny?: number;
|
|
74
|
+
includeHandsAndFaceOpenPose?: boolean;
|
|
75
|
+
includeCost?: boolean;
|
|
47
76
|
};
|
|
48
|
-
type
|
|
49
|
-
preprocessor: keyof typeof EOpenPosePreProcessor;
|
|
50
|
-
includeHandsAndFaceOpenPose: boolean;
|
|
51
|
-
returnBase64Image?: boolean;
|
|
52
|
-
};
|
|
53
|
-
type IControlNet = IControlNetCanny | IControlNetA | IControlNetHandsAndFace;
|
|
77
|
+
type IControlNet = IControlNetGeneral;
|
|
54
78
|
type IControlNetWithUUID = Omit<IControlNet, "guideImage"> & {
|
|
55
|
-
|
|
79
|
+
guideImage: string;
|
|
56
80
|
};
|
|
57
81
|
interface IError {
|
|
58
82
|
error: boolean;
|
|
@@ -60,56 +84,87 @@ interface IError {
|
|
|
60
84
|
taskUUID: string;
|
|
61
85
|
}
|
|
62
86
|
interface IRequestImage {
|
|
87
|
+
outputType?: IOutputType;
|
|
88
|
+
outputFormat?: IOutputFormat;
|
|
89
|
+
uploadEndpoint?: string;
|
|
90
|
+
checkNsfw?: boolean;
|
|
63
91
|
positivePrompt: string;
|
|
64
|
-
imageSize: number;
|
|
65
|
-
modelId: number | string;
|
|
66
|
-
numberOfImages?: number;
|
|
67
92
|
negativePrompt?: string;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
93
|
+
seedImage?: File | string;
|
|
94
|
+
maskImage?: File | string;
|
|
95
|
+
strength?: number;
|
|
96
|
+
height?: number;
|
|
97
|
+
width?: number;
|
|
98
|
+
model: number | string;
|
|
73
99
|
steps?: number;
|
|
74
|
-
onPartialImages?: (images: IImage[], error?: IError) => void;
|
|
75
|
-
seed?: number;
|
|
76
|
-
gScale?: number;
|
|
77
|
-
checkNsfw?: boolean;
|
|
78
|
-
returnBase64Image?: boolean;
|
|
79
100
|
scheduler?: string;
|
|
101
|
+
seed?: number;
|
|
102
|
+
CFGScale?: number;
|
|
103
|
+
clipSkip?: number;
|
|
80
104
|
usePromptWeighting?: boolean;
|
|
105
|
+
numberResults?: number;
|
|
106
|
+
controlNet?: IControlNet[];
|
|
107
|
+
lora?: ILora[];
|
|
108
|
+
includeCost?: boolean;
|
|
109
|
+
useCache?: boolean;
|
|
110
|
+
onPartialImages?: (images: IImage[], error?: IError) => void;
|
|
81
111
|
}
|
|
82
112
|
interface IRequestImageToText {
|
|
83
|
-
|
|
113
|
+
inputImage?: File | string;
|
|
114
|
+
includeCost?: boolean;
|
|
84
115
|
}
|
|
85
116
|
interface IImageToText {
|
|
117
|
+
taskType: ETaskType;
|
|
86
118
|
taskUUID: string;
|
|
87
119
|
text: string;
|
|
120
|
+
cost?: number;
|
|
88
121
|
}
|
|
89
122
|
interface IRemoveImageBackground extends IRequestImageToText {
|
|
123
|
+
outputType?: IOutputType;
|
|
124
|
+
outputFormat?: IOutputFormat;
|
|
125
|
+
rgba?: number[];
|
|
126
|
+
postProcessMask?: boolean;
|
|
127
|
+
returnOnlyMask?: boolean;
|
|
128
|
+
alphaMatting?: boolean;
|
|
129
|
+
alphaMattingForegroundThreshold?: number;
|
|
130
|
+
alphaMattingBackgroundThreshold?: number;
|
|
131
|
+
alphaMattingErodeSize?: number;
|
|
132
|
+
includeCost?: boolean;
|
|
133
|
+
}
|
|
134
|
+
interface IRemoveImage {
|
|
135
|
+
taskType: ETaskType;
|
|
136
|
+
taskUUID: string;
|
|
137
|
+
imageUUID: string;
|
|
138
|
+
inputImageUUID: string;
|
|
139
|
+
imageURL?: string;
|
|
140
|
+
imageBase64Data?: string;
|
|
141
|
+
imageDataURI?: string;
|
|
142
|
+
cost?: number;
|
|
90
143
|
}
|
|
91
144
|
interface IPromptEnhancer {
|
|
92
145
|
promptMaxLength?: number;
|
|
93
|
-
promptLanguageId?: number;
|
|
94
146
|
promptVersions?: number;
|
|
95
147
|
prompt: string;
|
|
148
|
+
includeCost?: boolean;
|
|
96
149
|
}
|
|
97
150
|
interface IEnhancedPrompt extends IImageToText {
|
|
98
151
|
}
|
|
99
152
|
interface IUpscaleGan {
|
|
100
|
-
|
|
153
|
+
inputImage: File | string;
|
|
101
154
|
upscaleFactor: number;
|
|
102
|
-
|
|
103
|
-
|
|
155
|
+
outputType?: IOutputType;
|
|
156
|
+
outputFormat?: IOutputFormat;
|
|
157
|
+
includeCost?: boolean;
|
|
104
158
|
}
|
|
105
159
|
type ReconnectingWebsocketProps = {
|
|
106
160
|
addEventListener: (type: string, listener: EventListener, options: any) => void;
|
|
107
161
|
send: (data: any) => void;
|
|
108
162
|
} & WebSocket;
|
|
109
163
|
type UploadImageType = {
|
|
110
|
-
|
|
111
|
-
|
|
164
|
+
imageURL: string;
|
|
165
|
+
imageUUID: string;
|
|
112
166
|
taskUUID: string;
|
|
167
|
+
taskType: ETaskType;
|
|
113
168
|
};
|
|
114
169
|
type GetWithPromiseCallBackType = ({ resolve, reject, intervalId, }: {
|
|
115
170
|
resolve: <T>(value: T) => void;
|
|
@@ -195,10 +250,10 @@ declare class RunwareBase {
|
|
|
195
250
|
_sdkType: SdkType;
|
|
196
251
|
constructor({ apiKey, url }: RunwareBaseType);
|
|
197
252
|
protected isWebsocketReadyState: () => boolean;
|
|
198
|
-
protected addListener({ lis,
|
|
253
|
+
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
199
254
|
lis: (v: any) => any;
|
|
200
|
-
check: (v: any) => any;
|
|
201
255
|
groupKey?: string;
|
|
256
|
+
taskUUID: string;
|
|
202
257
|
}): {
|
|
203
258
|
destroy: () => void;
|
|
204
259
|
};
|
|
@@ -206,7 +261,6 @@ declare class RunwareBase {
|
|
|
206
261
|
protected send: (msg: Object) => any;
|
|
207
262
|
private destroy;
|
|
208
263
|
private uploadImage;
|
|
209
|
-
private uploadUnprocessedImage;
|
|
210
264
|
listenToImages({ onPartialImages, taskUUID, groupKey, }: {
|
|
211
265
|
taskUUID: string;
|
|
212
266
|
onPartialImages?: (images: IImage[], error?: any) => void;
|
|
@@ -214,29 +268,31 @@ declare class RunwareBase {
|
|
|
214
268
|
}): {
|
|
215
269
|
destroy: () => void;
|
|
216
270
|
};
|
|
217
|
-
globalListener({
|
|
218
|
-
responseKey: string;
|
|
219
|
-
taskKey: string;
|
|
271
|
+
globalListener({ taskUUID }: {
|
|
220
272
|
taskUUID: string;
|
|
221
273
|
}): {
|
|
222
274
|
destroy: () => void;
|
|
223
275
|
};
|
|
224
|
-
requestImages({
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
removeImageBackground: ({ imageInitiator, }: IRemoveImageBackground) => Promise<IImage[]>;
|
|
231
|
-
upscaleGan: ({ imageInitiator, upscaleFactor, }: IUpscaleGan) => Promise<IImage[]>;
|
|
232
|
-
enhancePrompt: ({ prompt, promptMaxLength, promptLanguageId, promptVersions, }: IPromptEnhancer) => Promise<IEnhancedPrompt>;
|
|
276
|
+
requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, useCache, onPartialImages, includeCost, }: IRequestImage): Promise<IImage[] | undefined>;
|
|
277
|
+
controlNetPreProcess: ({ inputImage, preProcessor, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
278
|
+
requestImageToText: ({ inputImage, includeCost, }: IRequestImageToText) => Promise<IImageToText>;
|
|
279
|
+
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, }: IRemoveImageBackground) => Promise<IRemoveImage[]>;
|
|
280
|
+
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, }: IUpscaleGan) => Promise<IImage[]>;
|
|
281
|
+
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
233
282
|
ensureConnection(): Promise<void>;
|
|
234
|
-
|
|
283
|
+
getSimilarImages({ taskUUID, numberResults, shouldThrowError, lis, }: {
|
|
235
284
|
taskUUID: string | string[];
|
|
236
|
-
|
|
285
|
+
numberResults: number;
|
|
237
286
|
shouldThrowError?: boolean;
|
|
238
287
|
lis: any;
|
|
239
288
|
}): Promise<IImage[] | IError>;
|
|
289
|
+
getSingleMessage: ({ taskUUID }: {
|
|
290
|
+
taskUUID: string;
|
|
291
|
+
}) => any;
|
|
292
|
+
handleIncompleteImages({ taskUUIDs, error, }: {
|
|
293
|
+
taskUUIDs: string[];
|
|
294
|
+
error: any;
|
|
295
|
+
}): IImage[];
|
|
240
296
|
connected: () => boolean;
|
|
241
297
|
}
|
|
242
298
|
|
|
@@ -257,4 +313,4 @@ declare class RunwareServer extends RunwareBase {
|
|
|
257
313
|
protected heartBeat(): void;
|
|
258
314
|
}
|
|
259
315
|
|
|
260
|
-
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, Environment, GetWithPromiseCallBackType, IControlNet,
|
|
316
|
+
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareServer, SdkType, UploadImageType };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,20 +7,44 @@ declare enum SdkType {
|
|
|
7
7
|
CLIENT = "CLIENT",
|
|
8
8
|
SERVER = "SERVER"
|
|
9
9
|
}
|
|
10
|
+
declare enum ETaskType {
|
|
11
|
+
IMAGE_INFERENCE = "imageInference",
|
|
12
|
+
IMAGE_UPLOAD = "imageUpload",
|
|
13
|
+
IMAGE_UPSCALE = "imageUpscale",
|
|
14
|
+
IMAGE_BACKGROUND_REMOVAL = "imageBackgroundRemoval",
|
|
15
|
+
IMAGE_CAPTION = "imageCaption",
|
|
16
|
+
IMAGE_CONTROL_NET_PRE_PROCESS = "imageControlNetPreProcess",
|
|
17
|
+
PROMPT_ENHANCE = "promptEnhance",
|
|
18
|
+
AUTHENTICATION = "authentication"
|
|
19
|
+
}
|
|
10
20
|
type RunwareBaseType = {
|
|
11
21
|
apiKey: string;
|
|
12
22
|
url?: string;
|
|
13
23
|
};
|
|
24
|
+
type IOutputType = "base64Data" | "dataURI" | "URL";
|
|
25
|
+
type IOutputFormat = "JPG" | "PNG" | "WEBP";
|
|
14
26
|
interface IImage {
|
|
15
|
-
|
|
27
|
+
taskType: ETaskType;
|
|
16
28
|
imageUUID: string;
|
|
29
|
+
inputImageUUID?: string;
|
|
17
30
|
taskUUID: string;
|
|
18
|
-
|
|
19
|
-
cost: number;
|
|
31
|
+
imageURL?: string;
|
|
20
32
|
imageBase64Data?: string;
|
|
33
|
+
imageDataURI?: string;
|
|
34
|
+
NSFWContent?: boolean;
|
|
35
|
+
cost?: number;
|
|
36
|
+
}
|
|
37
|
+
interface IControlNetImage {
|
|
38
|
+
taskUUID: string;
|
|
39
|
+
inputImageUUID: string;
|
|
40
|
+
guideImageUUID: string;
|
|
41
|
+
guideImageURL?: string;
|
|
42
|
+
guideImageBase64Data?: string;
|
|
43
|
+
guideImageDataURI?: string;
|
|
44
|
+
cost?: number;
|
|
21
45
|
}
|
|
22
46
|
interface ILora {
|
|
23
|
-
|
|
47
|
+
model: string | number;
|
|
24
48
|
weight: number;
|
|
25
49
|
}
|
|
26
50
|
declare enum EControlMode {
|
|
@@ -29,30 +53,30 @@ declare enum EControlMode {
|
|
|
29
53
|
CONTROL_NET = "controlnet"
|
|
30
54
|
}
|
|
31
55
|
type IControlNetGeneral = {
|
|
32
|
-
|
|
33
|
-
weight: number;
|
|
34
|
-
startStep: number;
|
|
35
|
-
endStep: number;
|
|
56
|
+
model: string;
|
|
36
57
|
guideImage: string | File;
|
|
37
|
-
|
|
58
|
+
weight?: number;
|
|
59
|
+
startStep?: number;
|
|
60
|
+
startStepPercentage?: number;
|
|
61
|
+
endStep?: number;
|
|
62
|
+
endStepPercentage?: number;
|
|
38
63
|
controlMode: EControlMode;
|
|
39
|
-
returnBase64Image?: boolean;
|
|
40
64
|
};
|
|
41
|
-
type
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
65
|
+
type IControlNetPreprocess = {
|
|
66
|
+
inputImage: string | File;
|
|
67
|
+
preProcessor: EPreProcessor;
|
|
68
|
+
height?: number;
|
|
69
|
+
width?: number;
|
|
70
|
+
outputType?: IOutputType;
|
|
71
|
+
outputFormat?: IOutputFormat;
|
|
72
|
+
highThresholdCanny?: number;
|
|
73
|
+
lowThresholdCanny?: number;
|
|
74
|
+
includeHandsAndFaceOpenPose?: boolean;
|
|
75
|
+
includeCost?: boolean;
|
|
47
76
|
};
|
|
48
|
-
type
|
|
49
|
-
preprocessor: keyof typeof EOpenPosePreProcessor;
|
|
50
|
-
includeHandsAndFaceOpenPose: boolean;
|
|
51
|
-
returnBase64Image?: boolean;
|
|
52
|
-
};
|
|
53
|
-
type IControlNet = IControlNetCanny | IControlNetA | IControlNetHandsAndFace;
|
|
77
|
+
type IControlNet = IControlNetGeneral;
|
|
54
78
|
type IControlNetWithUUID = Omit<IControlNet, "guideImage"> & {
|
|
55
|
-
|
|
79
|
+
guideImage: string;
|
|
56
80
|
};
|
|
57
81
|
interface IError {
|
|
58
82
|
error: boolean;
|
|
@@ -60,56 +84,87 @@ interface IError {
|
|
|
60
84
|
taskUUID: string;
|
|
61
85
|
}
|
|
62
86
|
interface IRequestImage {
|
|
87
|
+
outputType?: IOutputType;
|
|
88
|
+
outputFormat?: IOutputFormat;
|
|
89
|
+
uploadEndpoint?: string;
|
|
90
|
+
checkNsfw?: boolean;
|
|
63
91
|
positivePrompt: string;
|
|
64
|
-
imageSize: number;
|
|
65
|
-
modelId: number | string;
|
|
66
|
-
numberOfImages?: number;
|
|
67
92
|
negativePrompt?: string;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
93
|
+
seedImage?: File | string;
|
|
94
|
+
maskImage?: File | string;
|
|
95
|
+
strength?: number;
|
|
96
|
+
height?: number;
|
|
97
|
+
width?: number;
|
|
98
|
+
model: number | string;
|
|
73
99
|
steps?: number;
|
|
74
|
-
onPartialImages?: (images: IImage[], error?: IError) => void;
|
|
75
|
-
seed?: number;
|
|
76
|
-
gScale?: number;
|
|
77
|
-
checkNsfw?: boolean;
|
|
78
|
-
returnBase64Image?: boolean;
|
|
79
100
|
scheduler?: string;
|
|
101
|
+
seed?: number;
|
|
102
|
+
CFGScale?: number;
|
|
103
|
+
clipSkip?: number;
|
|
80
104
|
usePromptWeighting?: boolean;
|
|
105
|
+
numberResults?: number;
|
|
106
|
+
controlNet?: IControlNet[];
|
|
107
|
+
lora?: ILora[];
|
|
108
|
+
includeCost?: boolean;
|
|
109
|
+
useCache?: boolean;
|
|
110
|
+
onPartialImages?: (images: IImage[], error?: IError) => void;
|
|
81
111
|
}
|
|
82
112
|
interface IRequestImageToText {
|
|
83
|
-
|
|
113
|
+
inputImage?: File | string;
|
|
114
|
+
includeCost?: boolean;
|
|
84
115
|
}
|
|
85
116
|
interface IImageToText {
|
|
117
|
+
taskType: ETaskType;
|
|
86
118
|
taskUUID: string;
|
|
87
119
|
text: string;
|
|
120
|
+
cost?: number;
|
|
88
121
|
}
|
|
89
122
|
interface IRemoveImageBackground extends IRequestImageToText {
|
|
123
|
+
outputType?: IOutputType;
|
|
124
|
+
outputFormat?: IOutputFormat;
|
|
125
|
+
rgba?: number[];
|
|
126
|
+
postProcessMask?: boolean;
|
|
127
|
+
returnOnlyMask?: boolean;
|
|
128
|
+
alphaMatting?: boolean;
|
|
129
|
+
alphaMattingForegroundThreshold?: number;
|
|
130
|
+
alphaMattingBackgroundThreshold?: number;
|
|
131
|
+
alphaMattingErodeSize?: number;
|
|
132
|
+
includeCost?: boolean;
|
|
133
|
+
}
|
|
134
|
+
interface IRemoveImage {
|
|
135
|
+
taskType: ETaskType;
|
|
136
|
+
taskUUID: string;
|
|
137
|
+
imageUUID: string;
|
|
138
|
+
inputImageUUID: string;
|
|
139
|
+
imageURL?: string;
|
|
140
|
+
imageBase64Data?: string;
|
|
141
|
+
imageDataURI?: string;
|
|
142
|
+
cost?: number;
|
|
90
143
|
}
|
|
91
144
|
interface IPromptEnhancer {
|
|
92
145
|
promptMaxLength?: number;
|
|
93
|
-
promptLanguageId?: number;
|
|
94
146
|
promptVersions?: number;
|
|
95
147
|
prompt: string;
|
|
148
|
+
includeCost?: boolean;
|
|
96
149
|
}
|
|
97
150
|
interface IEnhancedPrompt extends IImageToText {
|
|
98
151
|
}
|
|
99
152
|
interface IUpscaleGan {
|
|
100
|
-
|
|
153
|
+
inputImage: File | string;
|
|
101
154
|
upscaleFactor: number;
|
|
102
|
-
|
|
103
|
-
|
|
155
|
+
outputType?: IOutputType;
|
|
156
|
+
outputFormat?: IOutputFormat;
|
|
157
|
+
includeCost?: boolean;
|
|
104
158
|
}
|
|
105
159
|
type ReconnectingWebsocketProps = {
|
|
106
160
|
addEventListener: (type: string, listener: EventListener, options: any) => void;
|
|
107
161
|
send: (data: any) => void;
|
|
108
162
|
} & WebSocket;
|
|
109
163
|
type UploadImageType = {
|
|
110
|
-
|
|
111
|
-
|
|
164
|
+
imageURL: string;
|
|
165
|
+
imageUUID: string;
|
|
112
166
|
taskUUID: string;
|
|
167
|
+
taskType: ETaskType;
|
|
113
168
|
};
|
|
114
169
|
type GetWithPromiseCallBackType = ({ resolve, reject, intervalId, }: {
|
|
115
170
|
resolve: <T>(value: T) => void;
|
|
@@ -195,10 +250,10 @@ declare class RunwareBase {
|
|
|
195
250
|
_sdkType: SdkType;
|
|
196
251
|
constructor({ apiKey, url }: RunwareBaseType);
|
|
197
252
|
protected isWebsocketReadyState: () => boolean;
|
|
198
|
-
protected addListener({ lis,
|
|
253
|
+
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
199
254
|
lis: (v: any) => any;
|
|
200
|
-
check: (v: any) => any;
|
|
201
255
|
groupKey?: string;
|
|
256
|
+
taskUUID: string;
|
|
202
257
|
}): {
|
|
203
258
|
destroy: () => void;
|
|
204
259
|
};
|
|
@@ -206,7 +261,6 @@ declare class RunwareBase {
|
|
|
206
261
|
protected send: (msg: Object) => any;
|
|
207
262
|
private destroy;
|
|
208
263
|
private uploadImage;
|
|
209
|
-
private uploadUnprocessedImage;
|
|
210
264
|
listenToImages({ onPartialImages, taskUUID, groupKey, }: {
|
|
211
265
|
taskUUID: string;
|
|
212
266
|
onPartialImages?: (images: IImage[], error?: any) => void;
|
|
@@ -214,29 +268,31 @@ declare class RunwareBase {
|
|
|
214
268
|
}): {
|
|
215
269
|
destroy: () => void;
|
|
216
270
|
};
|
|
217
|
-
globalListener({
|
|
218
|
-
responseKey: string;
|
|
219
|
-
taskKey: string;
|
|
271
|
+
globalListener({ taskUUID }: {
|
|
220
272
|
taskUUID: string;
|
|
221
273
|
}): {
|
|
222
274
|
destroy: () => void;
|
|
223
275
|
};
|
|
224
|
-
requestImages({
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
removeImageBackground: ({ imageInitiator, }: IRemoveImageBackground) => Promise<IImage[]>;
|
|
231
|
-
upscaleGan: ({ imageInitiator, upscaleFactor, }: IUpscaleGan) => Promise<IImage[]>;
|
|
232
|
-
enhancePrompt: ({ prompt, promptMaxLength, promptLanguageId, promptVersions, }: IPromptEnhancer) => Promise<IEnhancedPrompt>;
|
|
276
|
+
requestImages({ outputType, outputFormat, uploadEndpoint, checkNsfw, positivePrompt, negativePrompt, seedImage, maskImage, strength, height, width, model, steps, scheduler, seed, CFGScale, clipSkip, usePromptWeighting, numberResults, controlNet, lora, useCache, onPartialImages, includeCost, }: IRequestImage): Promise<IImage[] | undefined>;
|
|
277
|
+
controlNetPreProcess: ({ inputImage, preProcessor, height, width, outputType, outputFormat, highThresholdCanny, lowThresholdCanny, includeHandsAndFaceOpenPose, includeCost, }: IControlNetPreprocess) => Promise<IControlNetImage | null>;
|
|
278
|
+
requestImageToText: ({ inputImage, includeCost, }: IRequestImageToText) => Promise<IImageToText>;
|
|
279
|
+
removeImageBackground: ({ inputImage, outputType, outputFormat, rgba, postProcessMask, returnOnlyMask, alphaMatting, alphaMattingForegroundThreshold, alphaMattingBackgroundThreshold, alphaMattingErodeSize, includeCost, }: IRemoveImageBackground) => Promise<IRemoveImage[]>;
|
|
280
|
+
upscaleGan: ({ inputImage, upscaleFactor, outputType, outputFormat, includeCost, }: IUpscaleGan) => Promise<IImage[]>;
|
|
281
|
+
enhancePrompt: ({ prompt, promptMaxLength, promptVersions, includeCost, }: IPromptEnhancer) => Promise<IEnhancedPrompt[]>;
|
|
233
282
|
ensureConnection(): Promise<void>;
|
|
234
|
-
|
|
283
|
+
getSimilarImages({ taskUUID, numberResults, shouldThrowError, lis, }: {
|
|
235
284
|
taskUUID: string | string[];
|
|
236
|
-
|
|
285
|
+
numberResults: number;
|
|
237
286
|
shouldThrowError?: boolean;
|
|
238
287
|
lis: any;
|
|
239
288
|
}): Promise<IImage[] | IError>;
|
|
289
|
+
getSingleMessage: ({ taskUUID }: {
|
|
290
|
+
taskUUID: string;
|
|
291
|
+
}) => any;
|
|
292
|
+
handleIncompleteImages({ taskUUIDs, error, }: {
|
|
293
|
+
taskUUIDs: string[];
|
|
294
|
+
error: any;
|
|
295
|
+
}): IImage[];
|
|
240
296
|
connected: () => boolean;
|
|
241
297
|
}
|
|
242
298
|
|
|
@@ -257,4 +313,4 @@ declare class RunwareServer extends RunwareBase {
|
|
|
257
313
|
protected heartBeat(): void;
|
|
258
314
|
}
|
|
259
315
|
|
|
260
|
-
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, Environment, GetWithPromiseCallBackType, IControlNet,
|
|
316
|
+
export { EControlMode, EOpenPosePreProcessor, EPreProcessor, EPreProcessorGroup, ETaskType, Environment, GetWithPromiseCallBackType, IControlNet, IControlNetGeneral, IControlNetImage, IControlNetPreprocess, IControlNetWithUUID, IEnhancedPrompt, IError, IImage, IImageToText, IOutputFormat, IOutputType, IPromptEnhancer, IRemoveImage, IRemoveImageBackground, IRequestImage, IRequestImageToText, IUpscaleGan, ListenerType, ReconnectingWebsocketProps, RequireAtLeastOne, RequireOnlyOne, Runware, RunwareBaseType, RunwareServer, SdkType, UploadImageType };
|