@runware/sdk-js 1.0.29 → 1.1.0
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 +118 -61
- package/dist/index.d.ts +118 -61
- package/dist/index.js +278 -338
- package/dist/index.mjs +277 -338
- package/package.json +2 -2
- package/readme.md +193 -73
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,55 +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;
|
|
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;
|
|
80
111
|
}
|
|
81
112
|
interface IRequestImageToText {
|
|
82
|
-
|
|
113
|
+
inputImage?: File | string;
|
|
114
|
+
includeCost?: boolean;
|
|
83
115
|
}
|
|
84
116
|
interface IImageToText {
|
|
117
|
+
taskType: ETaskType;
|
|
85
118
|
taskUUID: string;
|
|
86
119
|
text: string;
|
|
120
|
+
cost?: number;
|
|
87
121
|
}
|
|
88
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;
|
|
89
143
|
}
|
|
90
144
|
interface IPromptEnhancer {
|
|
91
145
|
promptMaxLength?: number;
|
|
92
|
-
promptLanguageId?: number;
|
|
93
146
|
promptVersions?: number;
|
|
94
147
|
prompt: string;
|
|
148
|
+
includeCost?: boolean;
|
|
95
149
|
}
|
|
96
150
|
interface IEnhancedPrompt extends IImageToText {
|
|
97
151
|
}
|
|
98
152
|
interface IUpscaleGan {
|
|
99
|
-
|
|
153
|
+
inputImage: File | string;
|
|
100
154
|
upscaleFactor: number;
|
|
101
|
-
|
|
102
|
-
|
|
155
|
+
outputType?: IOutputType;
|
|
156
|
+
outputFormat?: IOutputFormat;
|
|
157
|
+
includeCost?: boolean;
|
|
103
158
|
}
|
|
104
159
|
type ReconnectingWebsocketProps = {
|
|
105
160
|
addEventListener: (type: string, listener: EventListener, options: any) => void;
|
|
106
161
|
send: (data: any) => void;
|
|
107
162
|
} & WebSocket;
|
|
108
163
|
type UploadImageType = {
|
|
109
|
-
|
|
110
|
-
|
|
164
|
+
imageURL: string;
|
|
165
|
+
imageUUID: string;
|
|
111
166
|
taskUUID: string;
|
|
167
|
+
taskType: ETaskType;
|
|
112
168
|
};
|
|
113
169
|
type GetWithPromiseCallBackType = ({ resolve, reject, intervalId, }: {
|
|
114
170
|
resolve: <T>(value: T) => void;
|
|
@@ -194,10 +250,10 @@ declare class RunwareBase {
|
|
|
194
250
|
_sdkType: SdkType;
|
|
195
251
|
constructor({ apiKey, url }: RunwareBaseType);
|
|
196
252
|
protected isWebsocketReadyState: () => boolean;
|
|
197
|
-
protected addListener({ lis,
|
|
253
|
+
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
198
254
|
lis: (v: any) => any;
|
|
199
|
-
check: (v: any) => any;
|
|
200
255
|
groupKey?: string;
|
|
256
|
+
taskUUID: string;
|
|
201
257
|
}): {
|
|
202
258
|
destroy: () => void;
|
|
203
259
|
};
|
|
@@ -205,7 +261,6 @@ declare class RunwareBase {
|
|
|
205
261
|
protected send: (msg: Object) => any;
|
|
206
262
|
private destroy;
|
|
207
263
|
private uploadImage;
|
|
208
|
-
private uploadUnprocessedImage;
|
|
209
264
|
listenToImages({ onPartialImages, taskUUID, groupKey, }: {
|
|
210
265
|
taskUUID: string;
|
|
211
266
|
onPartialImages?: (images: IImage[], error?: any) => void;
|
|
@@ -213,29 +268,31 @@ declare class RunwareBase {
|
|
|
213
268
|
}): {
|
|
214
269
|
destroy: () => void;
|
|
215
270
|
};
|
|
216
|
-
globalListener({
|
|
217
|
-
responseKey: string;
|
|
218
|
-
taskKey: string;
|
|
271
|
+
globalListener({ taskUUID }: {
|
|
219
272
|
taskUUID: string;
|
|
220
273
|
}): {
|
|
221
274
|
destroy: () => void;
|
|
222
275
|
};
|
|
223
|
-
requestImages({
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
removeImageBackground: ({ imageInitiator, }: IRemoveImageBackground) => Promise<IImage[]>;
|
|
230
|
-
upscaleGan: ({ imageInitiator, upscaleFactor, }: IUpscaleGan) => Promise<IImage[]>;
|
|
231
|
-
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[]>;
|
|
232
282
|
ensureConnection(): Promise<void>;
|
|
233
|
-
|
|
283
|
+
getSimilarImages({ taskUUID, numberResults, shouldThrowError, lis, }: {
|
|
234
284
|
taskUUID: string | string[];
|
|
235
|
-
|
|
285
|
+
numberResults: number;
|
|
236
286
|
shouldThrowError?: boolean;
|
|
237
287
|
lis: any;
|
|
238
288
|
}): Promise<IImage[] | IError>;
|
|
289
|
+
getSingleMessage: ({ taskUUID }: {
|
|
290
|
+
taskUUID: string;
|
|
291
|
+
}) => any;
|
|
292
|
+
handleIncompleteImages({ taskUUIDs, error, }: {
|
|
293
|
+
taskUUIDs: string[];
|
|
294
|
+
error: any;
|
|
295
|
+
}): IImage[];
|
|
239
296
|
connected: () => boolean;
|
|
240
297
|
}
|
|
241
298
|
|
|
@@ -256,4 +313,4 @@ declare class RunwareServer extends RunwareBase {
|
|
|
256
313
|
protected heartBeat(): void;
|
|
257
314
|
}
|
|
258
315
|
|
|
259
|
-
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,55 +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;
|
|
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;
|
|
80
111
|
}
|
|
81
112
|
interface IRequestImageToText {
|
|
82
|
-
|
|
113
|
+
inputImage?: File | string;
|
|
114
|
+
includeCost?: boolean;
|
|
83
115
|
}
|
|
84
116
|
interface IImageToText {
|
|
117
|
+
taskType: ETaskType;
|
|
85
118
|
taskUUID: string;
|
|
86
119
|
text: string;
|
|
120
|
+
cost?: number;
|
|
87
121
|
}
|
|
88
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;
|
|
89
143
|
}
|
|
90
144
|
interface IPromptEnhancer {
|
|
91
145
|
promptMaxLength?: number;
|
|
92
|
-
promptLanguageId?: number;
|
|
93
146
|
promptVersions?: number;
|
|
94
147
|
prompt: string;
|
|
148
|
+
includeCost?: boolean;
|
|
95
149
|
}
|
|
96
150
|
interface IEnhancedPrompt extends IImageToText {
|
|
97
151
|
}
|
|
98
152
|
interface IUpscaleGan {
|
|
99
|
-
|
|
153
|
+
inputImage: File | string;
|
|
100
154
|
upscaleFactor: number;
|
|
101
|
-
|
|
102
|
-
|
|
155
|
+
outputType?: IOutputType;
|
|
156
|
+
outputFormat?: IOutputFormat;
|
|
157
|
+
includeCost?: boolean;
|
|
103
158
|
}
|
|
104
159
|
type ReconnectingWebsocketProps = {
|
|
105
160
|
addEventListener: (type: string, listener: EventListener, options: any) => void;
|
|
106
161
|
send: (data: any) => void;
|
|
107
162
|
} & WebSocket;
|
|
108
163
|
type UploadImageType = {
|
|
109
|
-
|
|
110
|
-
|
|
164
|
+
imageURL: string;
|
|
165
|
+
imageUUID: string;
|
|
111
166
|
taskUUID: string;
|
|
167
|
+
taskType: ETaskType;
|
|
112
168
|
};
|
|
113
169
|
type GetWithPromiseCallBackType = ({ resolve, reject, intervalId, }: {
|
|
114
170
|
resolve: <T>(value: T) => void;
|
|
@@ -194,10 +250,10 @@ declare class RunwareBase {
|
|
|
194
250
|
_sdkType: SdkType;
|
|
195
251
|
constructor({ apiKey, url }: RunwareBaseType);
|
|
196
252
|
protected isWebsocketReadyState: () => boolean;
|
|
197
|
-
protected addListener({ lis,
|
|
253
|
+
protected addListener({ lis, groupKey, taskUUID, }: {
|
|
198
254
|
lis: (v: any) => any;
|
|
199
|
-
check: (v: any) => any;
|
|
200
255
|
groupKey?: string;
|
|
256
|
+
taskUUID: string;
|
|
201
257
|
}): {
|
|
202
258
|
destroy: () => void;
|
|
203
259
|
};
|
|
@@ -205,7 +261,6 @@ declare class RunwareBase {
|
|
|
205
261
|
protected send: (msg: Object) => any;
|
|
206
262
|
private destroy;
|
|
207
263
|
private uploadImage;
|
|
208
|
-
private uploadUnprocessedImage;
|
|
209
264
|
listenToImages({ onPartialImages, taskUUID, groupKey, }: {
|
|
210
265
|
taskUUID: string;
|
|
211
266
|
onPartialImages?: (images: IImage[], error?: any) => void;
|
|
@@ -213,29 +268,31 @@ declare class RunwareBase {
|
|
|
213
268
|
}): {
|
|
214
269
|
destroy: () => void;
|
|
215
270
|
};
|
|
216
|
-
globalListener({
|
|
217
|
-
responseKey: string;
|
|
218
|
-
taskKey: string;
|
|
271
|
+
globalListener({ taskUUID }: {
|
|
219
272
|
taskUUID: string;
|
|
220
273
|
}): {
|
|
221
274
|
destroy: () => void;
|
|
222
275
|
};
|
|
223
|
-
requestImages({
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
removeImageBackground: ({ imageInitiator, }: IRemoveImageBackground) => Promise<IImage[]>;
|
|
230
|
-
upscaleGan: ({ imageInitiator, upscaleFactor, }: IUpscaleGan) => Promise<IImage[]>;
|
|
231
|
-
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[]>;
|
|
232
282
|
ensureConnection(): Promise<void>;
|
|
233
|
-
|
|
283
|
+
getSimilarImages({ taskUUID, numberResults, shouldThrowError, lis, }: {
|
|
234
284
|
taskUUID: string | string[];
|
|
235
|
-
|
|
285
|
+
numberResults: number;
|
|
236
286
|
shouldThrowError?: boolean;
|
|
237
287
|
lis: any;
|
|
238
288
|
}): Promise<IImage[] | IError>;
|
|
289
|
+
getSingleMessage: ({ taskUUID }: {
|
|
290
|
+
taskUUID: string;
|
|
291
|
+
}) => any;
|
|
292
|
+
handleIncompleteImages({ taskUUIDs, error, }: {
|
|
293
|
+
taskUUIDs: string[];
|
|
294
|
+
error: any;
|
|
295
|
+
}): IImage[];
|
|
239
296
|
connected: () => boolean;
|
|
240
297
|
}
|
|
241
298
|
|
|
@@ -256,4 +313,4 @@ declare class RunwareServer extends RunwareBase {
|
|
|
256
313
|
protected heartBeat(): void;
|
|
257
314
|
}
|
|
258
315
|
|
|
259
|
-
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 };
|