n8n-nodes-piapi 0.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/LICENSE.md +19 -0
- package/README.md +41 -0
- package/dist/credentials/PiAPI.credentials.d.ts +8 -0
- package/dist/credentials/PiAPI.credentials.js +46 -0
- package/dist/credentials/PiAPI.credentials.js.map +1 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineExtendVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineExtendVideo.node.js +237 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineExtendVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineImageToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineImageToVideo.node.js +270 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineImageToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineTextToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineTextToVideo.node.js +186 -0
- package/dist/nodes/PiAPI/DreamMachine/DreamMachineTextToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Flux/FluxImageToImage.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Flux/FluxImageToImage.node.js +359 -0
- package/dist/nodes/PiAPI/Flux/FluxImageToImage.node.js.map +1 -0
- package/dist/nodes/PiAPI/Flux/FluxTextToImage.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Flux/FluxTextToImage.node.js +398 -0
- package/dist/nodes/PiAPI/Flux/FluxTextToImage.node.js.map +1 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoImageToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoImageToVideo.node.js +190 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoImageToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoSubjectVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoSubjectVideo.node.js +140 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoSubjectVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoTextToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoTextToVideo.node.js +150 -0
- package/dist/nodes/PiAPI/Hailuo/HailuoTextToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Hailuo/index.d.ts +4 -0
- package/dist/nodes/PiAPI/Hailuo/index.js +10 -0
- package/dist/nodes/PiAPI/Hailuo/index.js.map +1 -0
- package/dist/nodes/PiAPI/Hunyuan/HunyuanImageToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Hunyuan/HunyuanImageToVideo.node.js +227 -0
- package/dist/nodes/PiAPI/Hunyuan/HunyuanImageToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Hunyuan/HunyuanTextToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Hunyuan/HunyuanTextToVideo.node.js +142 -0
- package/dist/nodes/PiAPI/Hunyuan/HunyuanTextToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Hunyuan/index.d.ts +3 -0
- package/dist/nodes/PiAPI/Hunyuan/index.js +8 -0
- package/dist/nodes/PiAPI/Hunyuan/index.js.map +1 -0
- package/dist/nodes/PiAPI/Kling/KlingEffects.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Kling/KlingEffects.node.js +175 -0
- package/dist/nodes/PiAPI/Kling/KlingEffects.node.js.map +1 -0
- package/dist/nodes/PiAPI/Kling/KlingImageToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Kling/KlingImageToVideo.node.js +411 -0
- package/dist/nodes/PiAPI/Kling/KlingImageToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Kling/KlingLipSync.node.d.ts +13 -0
- package/dist/nodes/PiAPI/Kling/KlingLipSync.node.js +276 -0
- package/dist/nodes/PiAPI/Kling/KlingLipSync.node.js.map +1 -0
- package/dist/nodes/PiAPI/Kling/KlingTextToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Kling/KlingTextToVideo.node.js +206 -0
- package/dist/nodes/PiAPI/Kling/KlingTextToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Kling/KlingTryOn.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Kling/KlingTryOn.node.js +426 -0
- package/dist/nodes/PiAPI/Kling/KlingTryOn.node.js.map +1 -0
- package/dist/nodes/PiAPI/Kling/KlingVideoExtend.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Kling/KlingVideoExtend.node.js +93 -0
- package/dist/nodes/PiAPI/Kling/KlingVideoExtend.node.js.map +1 -0
- package/dist/nodes/PiAPI/Skyreels/SkytreelsImageToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Skyreels/SkytreelsImageToVideo.node.js +242 -0
- package/dist/nodes/PiAPI/Skyreels/SkytreelsImageToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/Skyreels/index.d.ts +2 -0
- package/dist/nodes/PiAPI/Skyreels/index.js +6 -0
- package/dist/nodes/PiAPI/Skyreels/index.js.map +1 -0
- package/dist/nodes/PiAPI/TaskStatus/PiAPITaskStatus.node.d.ts +5 -0
- package/dist/nodes/PiAPI/TaskStatus/PiAPITaskStatus.node.js +125 -0
- package/dist/nodes/PiAPI/TaskStatus/PiAPITaskStatus.node.js.map +1 -0
- package/dist/nodes/PiAPI/Trellis/TrellisModelGeneration.node.d.ts +5 -0
- package/dist/nodes/PiAPI/Trellis/TrellisModelGeneration.node.js +262 -0
- package/dist/nodes/PiAPI/Trellis/TrellisModelGeneration.node.js.map +1 -0
- package/dist/nodes/PiAPI/Trellis/index.d.ts +2 -0
- package/dist/nodes/PiAPI/Trellis/index.js +6 -0
- package/dist/nodes/PiAPI/Trellis/index.js.map +1 -0
- package/dist/nodes/PiAPI/WanX/WanXImageToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/WanX/WanXImageToVideo.node.js +227 -0
- package/dist/nodes/PiAPI/WanX/WanXImageToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/WanX/WanXTextToVideo.node.d.ts +5 -0
- package/dist/nodes/PiAPI/WanX/WanXTextToVideo.node.js +129 -0
- package/dist/nodes/PiAPI/WanX/WanXTextToVideo.node.js.map +1 -0
- package/dist/nodes/PiAPI/piapi.svg +5 -0
- package/dist/nodes/PiAPI/shared/Constants.d.ts +30 -0
- package/dist/nodes/PiAPI/shared/Constants.js +262 -0
- package/dist/nodes/PiAPI/shared/Constants.js.map +1 -0
- package/dist/nodes/PiAPI/shared/GenericFunctions.d.ts +3 -0
- package/dist/nodes/PiAPI/shared/GenericFunctions.js +43 -0
- package/dist/nodes/PiAPI/shared/GenericFunctions.js.map +1 -0
- package/dist/nodes/PiAPI/shared/Interfaces.d.ts +102 -0
- package/dist/nodes/PiAPI/shared/Interfaces.js +3 -0
- package/dist/nodes/PiAPI/shared/Interfaces.js.map +1 -0
- package/dist/package.json +95 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.js +6 -0
- package/package.json +95 -0
@@ -0,0 +1,398 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.FluxTextToImage = void 0;
|
4
|
+
const GenericFunctions_1 = require("../shared/GenericFunctions");
|
5
|
+
const Constants_1 = require("../shared/Constants");
|
6
|
+
class FluxTextToImage {
|
7
|
+
constructor() {
|
8
|
+
this.description = {
|
9
|
+
displayName: 'PiAPI Flux Text to Image',
|
10
|
+
name: 'fluxTextToImage',
|
11
|
+
icon: 'file:../piapi.svg',
|
12
|
+
group: ['transform'],
|
13
|
+
version: 1,
|
14
|
+
description: 'Generate images using PiAPI Flux Text-to-Image',
|
15
|
+
defaults: {
|
16
|
+
name: 'Flux Text to Image',
|
17
|
+
},
|
18
|
+
inputs: ["main"],
|
19
|
+
outputs: ["main"],
|
20
|
+
credentials: [
|
21
|
+
{
|
22
|
+
name: 'piAPIApi',
|
23
|
+
required: true,
|
24
|
+
},
|
25
|
+
],
|
26
|
+
properties: [
|
27
|
+
{
|
28
|
+
displayName: 'Model',
|
29
|
+
name: 'model',
|
30
|
+
type: 'options',
|
31
|
+
options: [
|
32
|
+
{
|
33
|
+
name: 'Flux 1 Dev',
|
34
|
+
value: 'Qubico/flux1-dev',
|
35
|
+
},
|
36
|
+
{
|
37
|
+
name: 'Flux 1 Schnell',
|
38
|
+
value: 'Qubico/flux1-schnell',
|
39
|
+
},
|
40
|
+
{
|
41
|
+
name: 'Flux 1 Dev Advanced',
|
42
|
+
value: 'Qubico/flux1-dev-advanced',
|
43
|
+
},
|
44
|
+
],
|
45
|
+
default: 'Qubico/flux1-dev',
|
46
|
+
description: 'The model to use for image generation',
|
47
|
+
},
|
48
|
+
{
|
49
|
+
displayName: 'Prompt',
|
50
|
+
name: 'prompt',
|
51
|
+
type: 'string',
|
52
|
+
typeOptions: {
|
53
|
+
rows: 4,
|
54
|
+
},
|
55
|
+
default: '',
|
56
|
+
required: true,
|
57
|
+
description: 'Text prompt for image generation',
|
58
|
+
},
|
59
|
+
{
|
60
|
+
displayName: 'Negative Prompt',
|
61
|
+
name: 'negativePrompt',
|
62
|
+
type: 'string',
|
63
|
+
typeOptions: {
|
64
|
+
rows: 2,
|
65
|
+
},
|
66
|
+
default: '',
|
67
|
+
description: 'Negative text prompt for image generation',
|
68
|
+
},
|
69
|
+
{
|
70
|
+
displayName: 'Aspect Ratio',
|
71
|
+
name: 'aspectRatio',
|
72
|
+
type: 'options',
|
73
|
+
options: Constants_1.ASPECT_RATIO_OPTIONS,
|
74
|
+
default: '1024:1024',
|
75
|
+
description: 'Select a predefined aspect ratio for the output image',
|
76
|
+
},
|
77
|
+
{
|
78
|
+
displayName: 'Custom Width',
|
79
|
+
name: 'width',
|
80
|
+
type: 'number',
|
81
|
+
displayOptions: {
|
82
|
+
show: {
|
83
|
+
aspectRatio: ['custom'],
|
84
|
+
},
|
85
|
+
},
|
86
|
+
default: 1024,
|
87
|
+
description: 'Custom width of the generated image',
|
88
|
+
},
|
89
|
+
{
|
90
|
+
displayName: 'Custom Height',
|
91
|
+
name: 'height',
|
92
|
+
type: 'number',
|
93
|
+
displayOptions: {
|
94
|
+
show: {
|
95
|
+
aspectRatio: ['custom'],
|
96
|
+
},
|
97
|
+
},
|
98
|
+
default: 1024,
|
99
|
+
description: 'Custom height of the generated image',
|
100
|
+
},
|
101
|
+
{
|
102
|
+
displayName: 'Guidance Scale',
|
103
|
+
name: 'guidanceScale',
|
104
|
+
type: 'number',
|
105
|
+
default: 3,
|
106
|
+
description: 'Guidance scale for image generation. Higher values improve prompt adherence but may reduce image quality.',
|
107
|
+
typeOptions: {
|
108
|
+
minValue: 1.5,
|
109
|
+
maxValue: 5,
|
110
|
+
},
|
111
|
+
},
|
112
|
+
{
|
113
|
+
displayName: 'Batch Size',
|
114
|
+
name: 'batchSize',
|
115
|
+
type: 'number',
|
116
|
+
default: 1,
|
117
|
+
description: 'Number of images to generate. Only works for Flux 1 Schnell model.',
|
118
|
+
typeOptions: {
|
119
|
+
minValue: 1,
|
120
|
+
maxValue: 4,
|
121
|
+
},
|
122
|
+
},
|
123
|
+
{
|
124
|
+
displayName: 'Use LoRA',
|
125
|
+
name: 'useLora',
|
126
|
+
type: 'boolean',
|
127
|
+
default: false,
|
128
|
+
description: 'Whether to use LoRA model for generation (only available with Flux 1 Dev Advanced model)',
|
129
|
+
displayOptions: {
|
130
|
+
show: {
|
131
|
+
model: ['Qubico/flux1-dev-advanced'],
|
132
|
+
},
|
133
|
+
},
|
134
|
+
},
|
135
|
+
{
|
136
|
+
displayName: 'LoRA Type',
|
137
|
+
name: 'loraType',
|
138
|
+
type: 'options',
|
139
|
+
displayOptions: {
|
140
|
+
show: {
|
141
|
+
useLora: [true],
|
142
|
+
},
|
143
|
+
},
|
144
|
+
options: Constants_1.LORA_OPTIONS,
|
145
|
+
default: 'none',
|
146
|
+
description: 'The LoRA model to use for image generation',
|
147
|
+
},
|
148
|
+
{
|
149
|
+
displayName: 'LoRA Strength',
|
150
|
+
name: 'loraStrength',
|
151
|
+
type: 'number',
|
152
|
+
displayOptions: {
|
153
|
+
show: {
|
154
|
+
useLora: [true],
|
155
|
+
},
|
156
|
+
},
|
157
|
+
default: 1,
|
158
|
+
description: 'Strength of the LoRA effect (0.0 to 1.0)',
|
159
|
+
typeOptions: {
|
160
|
+
minValue: 0.1,
|
161
|
+
maxValue: 1,
|
162
|
+
numberPrecision: 2,
|
163
|
+
},
|
164
|
+
},
|
165
|
+
{
|
166
|
+
displayName: 'Use ControlNet',
|
167
|
+
name: 'useControlNet',
|
168
|
+
type: 'boolean',
|
169
|
+
default: false,
|
170
|
+
description: 'Whether to use ControlNet for generation (only available with Flux 1 Dev Advanced model)',
|
171
|
+
displayOptions: {
|
172
|
+
show: {
|
173
|
+
model: ['Qubico/flux1-dev-advanced'],
|
174
|
+
},
|
175
|
+
},
|
176
|
+
},
|
177
|
+
{
|
178
|
+
displayName: 'ControlNet Type',
|
179
|
+
name: 'controlNetType',
|
180
|
+
type: 'options',
|
181
|
+
displayOptions: {
|
182
|
+
show: {
|
183
|
+
useControlNet: [true],
|
184
|
+
},
|
185
|
+
},
|
186
|
+
options: Constants_1.CONTROLNET_TYPES,
|
187
|
+
default: 'none',
|
188
|
+
description: 'The ControlNet type to use for image generation',
|
189
|
+
},
|
190
|
+
{
|
191
|
+
displayName: 'Control Image Source',
|
192
|
+
name: 'controlImageSource',
|
193
|
+
type: 'options',
|
194
|
+
options: [
|
195
|
+
{
|
196
|
+
name: 'URL',
|
197
|
+
value: 'url',
|
198
|
+
},
|
199
|
+
{
|
200
|
+
name: 'Binary Data',
|
201
|
+
value: 'binaryData',
|
202
|
+
},
|
203
|
+
],
|
204
|
+
default: 'url',
|
205
|
+
displayOptions: {
|
206
|
+
show: {
|
207
|
+
useControlNet: [true],
|
208
|
+
},
|
209
|
+
},
|
210
|
+
description: 'The source of the control image',
|
211
|
+
},
|
212
|
+
{
|
213
|
+
displayName: 'Control Image URL',
|
214
|
+
name: 'controlImageUrl',
|
215
|
+
type: 'string',
|
216
|
+
default: '',
|
217
|
+
required: true,
|
218
|
+
displayOptions: {
|
219
|
+
show: {
|
220
|
+
useControlNet: [true],
|
221
|
+
controlImageSource: ['url'],
|
222
|
+
},
|
223
|
+
},
|
224
|
+
description: 'URL of the control image',
|
225
|
+
},
|
226
|
+
{
|
227
|
+
displayName: 'Control Image Binary Property',
|
228
|
+
name: 'controlBinaryPropertyName',
|
229
|
+
type: 'string',
|
230
|
+
default: 'data',
|
231
|
+
required: true,
|
232
|
+
displayOptions: {
|
233
|
+
show: {
|
234
|
+
useControlNet: [true],
|
235
|
+
controlImageSource: ['binaryData'],
|
236
|
+
},
|
237
|
+
},
|
238
|
+
description: 'Name of the binary property containing the control image data',
|
239
|
+
},
|
240
|
+
{
|
241
|
+
displayName: 'Control Strength',
|
242
|
+
name: 'controlStrength',
|
243
|
+
type: 'number',
|
244
|
+
displayOptions: {
|
245
|
+
show: {
|
246
|
+
useControlNet: [true],
|
247
|
+
},
|
248
|
+
},
|
249
|
+
default: 0.5,
|
250
|
+
description: 'Strength of the ControlNet effect (0.0 to 1.0)',
|
251
|
+
typeOptions: {
|
252
|
+
minValue: 0.1,
|
253
|
+
maxValue: 1,
|
254
|
+
numberPrecision: 2,
|
255
|
+
},
|
256
|
+
},
|
257
|
+
{
|
258
|
+
displayName: 'Return Preprocessed Image',
|
259
|
+
name: 'returnPreprocessed',
|
260
|
+
type: 'boolean',
|
261
|
+
displayOptions: {
|
262
|
+
show: {
|
263
|
+
useControlNet: [true],
|
264
|
+
},
|
265
|
+
},
|
266
|
+
default: false,
|
267
|
+
description: 'Whether to return the preprocessed control image',
|
268
|
+
},
|
269
|
+
{
|
270
|
+
displayName: 'Wait for Completion',
|
271
|
+
name: 'waitForCompletion',
|
272
|
+
type: 'boolean',
|
273
|
+
default: false,
|
274
|
+
description: 'Wait for task to complete and return results',
|
275
|
+
},
|
276
|
+
],
|
277
|
+
};
|
278
|
+
}
|
279
|
+
async execute() {
|
280
|
+
var _a;
|
281
|
+
const items = this.getInputData();
|
282
|
+
const returnData = [];
|
283
|
+
for (let i = 0; i < items.length; i++) {
|
284
|
+
const model = this.getNodeParameter('model', i);
|
285
|
+
const prompt = this.getNodeParameter('prompt', i);
|
286
|
+
const negativePrompt = this.getNodeParameter('negativePrompt', i, '');
|
287
|
+
const aspectRatio = this.getNodeParameter('aspectRatio', i);
|
288
|
+
const guidanceScale = this.getNodeParameter('guidanceScale', i, 3);
|
289
|
+
const batchSize = this.getNodeParameter('batchSize', i, 1);
|
290
|
+
const useLora = this.getNodeParameter('useLora', i, false);
|
291
|
+
const loraType = useLora ? this.getNodeParameter('loraType', i, 'none') : 'none';
|
292
|
+
const loraStrength = useLora ? this.getNodeParameter('loraStrength', i, 1) : 1;
|
293
|
+
const useControlNet = this.getNodeParameter('useControlNet', i, false);
|
294
|
+
const controlNetType = useControlNet ? this.getNodeParameter('controlNetType', i, 'none') : 'none';
|
295
|
+
const controlStrength = useControlNet ? this.getNodeParameter('controlStrength', i, 0.5) : 0.5;
|
296
|
+
const returnPreprocessed = useControlNet ? this.getNodeParameter('returnPreprocessed', i, false) : false;
|
297
|
+
const waitForCompletion = this.getNodeParameter('waitForCompletion', i, true);
|
298
|
+
let width = 1024;
|
299
|
+
let height = 1024;
|
300
|
+
if (aspectRatio === 'custom') {
|
301
|
+
width = this.getNodeParameter('width', i, 1024);
|
302
|
+
height = this.getNodeParameter('height', i, 1024);
|
303
|
+
}
|
304
|
+
else if (aspectRatio !== 'square_header' && aspectRatio !== 'landscape_header' && aspectRatio !== 'portrait_header') {
|
305
|
+
const [w, h] = aspectRatio.split(':').map(Number);
|
306
|
+
width = w;
|
307
|
+
height = h;
|
308
|
+
}
|
309
|
+
let controlImageUrl = '';
|
310
|
+
if (useControlNet && controlNetType !== 'none') {
|
311
|
+
const controlImageSource = this.getNodeParameter('controlImageSource', i);
|
312
|
+
if (controlImageSource === 'url') {
|
313
|
+
controlImageUrl = this.getNodeParameter('controlImageUrl', i);
|
314
|
+
}
|
315
|
+
else {
|
316
|
+
const controlBinaryPropertyName = this.getNodeParameter('controlBinaryPropertyName', i);
|
317
|
+
const binaryData = this.helpers.assertBinaryData(i, controlBinaryPropertyName);
|
318
|
+
if (binaryData.mimeType && !binaryData.mimeType.includes('image/')) {
|
319
|
+
throw new Error('The provided binary data is not an image');
|
320
|
+
}
|
321
|
+
if (binaryData.data) {
|
322
|
+
const dataBuffer = Buffer.from(binaryData.data, 'base64');
|
323
|
+
controlImageUrl = `data:${binaryData.mimeType};base64,${dataBuffer.toString('base64')}`;
|
324
|
+
}
|
325
|
+
else if (binaryData.url) {
|
326
|
+
controlImageUrl = binaryData.url;
|
327
|
+
}
|
328
|
+
else {
|
329
|
+
throw new Error('No usable image data found in the provided binary property');
|
330
|
+
}
|
331
|
+
}
|
332
|
+
}
|
333
|
+
let taskType = 'txt2img';
|
334
|
+
if (model === 'Qubico/flux1-dev-advanced') {
|
335
|
+
if (useControlNet && controlNetType !== 'none') {
|
336
|
+
taskType = 'controlnet-lora';
|
337
|
+
}
|
338
|
+
else if (useLora && loraType !== 'none') {
|
339
|
+
taskType = 'txt2img-lora';
|
340
|
+
}
|
341
|
+
}
|
342
|
+
const body = {
|
343
|
+
model,
|
344
|
+
task_type: taskType,
|
345
|
+
input: {
|
346
|
+
prompt,
|
347
|
+
negative_prompt: negativePrompt,
|
348
|
+
width,
|
349
|
+
height,
|
350
|
+
guidance_scale: guidanceScale,
|
351
|
+
batch_size: batchSize,
|
352
|
+
},
|
353
|
+
};
|
354
|
+
if (useLora && loraType !== 'none') {
|
355
|
+
body.input.lora_settings = [
|
356
|
+
{
|
357
|
+
lora_type: loraType,
|
358
|
+
lora_strength: loraStrength,
|
359
|
+
},
|
360
|
+
];
|
361
|
+
}
|
362
|
+
if (useControlNet && controlNetType !== 'none') {
|
363
|
+
body.input.control_net_settings = [
|
364
|
+
{
|
365
|
+
control_type: controlNetType,
|
366
|
+
control_image: controlImageUrl,
|
367
|
+
control_strength: controlStrength,
|
368
|
+
return_preprocessed_image: returnPreprocessed,
|
369
|
+
},
|
370
|
+
];
|
371
|
+
}
|
372
|
+
try {
|
373
|
+
const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', body);
|
374
|
+
let taskResult = response;
|
375
|
+
if (waitForCompletion && ((_a = response.data) === null || _a === void 0 ? void 0 : _a.task_id)) {
|
376
|
+
taskResult = await GenericFunctions_1.waitForTaskCompletion.call(this, response.data.task_id);
|
377
|
+
}
|
378
|
+
returnData.push({
|
379
|
+
json: taskResult,
|
380
|
+
});
|
381
|
+
}
|
382
|
+
catch (error) {
|
383
|
+
if (this.continueOnFail()) {
|
384
|
+
returnData.push({
|
385
|
+
json: {
|
386
|
+
error: error.message,
|
387
|
+
},
|
388
|
+
});
|
389
|
+
continue;
|
390
|
+
}
|
391
|
+
throw error;
|
392
|
+
}
|
393
|
+
}
|
394
|
+
return [returnData];
|
395
|
+
}
|
396
|
+
}
|
397
|
+
exports.FluxTextToImage = FluxTextToImage;
|
398
|
+
//# sourceMappingURL=FluxTextToImage.node.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"FluxTextToImage.node.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/Flux/FluxTextToImage.node.ts"],"names":[],"mappings":";;;AAQA,iEAAiF;AACjF,mDAA2F;AAE3F,MAAa,eAAe;IAA5B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE;gBACT,IAAI,EAAE,oBAAoB;aAC1B;YACD,MAAM,EAAE,QAAyB;YACjC,OAAO,EAAE,QAAyB;YAClC,WAAW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AE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE;4BACL,KAAK,EAAE,KAAK,CAAC,OAAO;yBACpB;qBACD,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAzZD,0CAyZC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
2
|
+
export declare class HailuoImageToVideo implements INodeType {
|
3
|
+
description: INodeTypeDescription;
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
5
|
+
}
|
@@ -0,0 +1,190 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.HailuoImageToVideo = void 0;
|
4
|
+
const GenericFunctions_1 = require("../shared/GenericFunctions");
|
5
|
+
class HailuoImageToVideo {
|
6
|
+
constructor() {
|
7
|
+
this.description = {
|
8
|
+
displayName: 'Hailuo Image to Video',
|
9
|
+
name: 'hailuoImageToVideo',
|
10
|
+
icon: 'file:../piapi.svg',
|
11
|
+
group: ['transform'],
|
12
|
+
version: 1,
|
13
|
+
description: 'Generate video from image using Hailuo API',
|
14
|
+
defaults: {
|
15
|
+
name: 'Hailuo Image to Video',
|
16
|
+
},
|
17
|
+
inputs: ["main"],
|
18
|
+
outputs: ["main"],
|
19
|
+
credentials: [
|
20
|
+
{
|
21
|
+
name: 'piAPIApi',
|
22
|
+
required: true,
|
23
|
+
},
|
24
|
+
],
|
25
|
+
properties: [
|
26
|
+
{
|
27
|
+
displayName: 'Image URL',
|
28
|
+
name: 'imageUrl',
|
29
|
+
type: 'string',
|
30
|
+
default: '',
|
31
|
+
required: true,
|
32
|
+
description: 'URL of input image (JPG/PNG, 300-4096px, aspect ratio 2:5 to 5:2, max 10MB)',
|
33
|
+
},
|
34
|
+
{
|
35
|
+
displayName: 'Model',
|
36
|
+
name: 'model',
|
37
|
+
type: 'options',
|
38
|
+
options: [
|
39
|
+
{
|
40
|
+
name: 'Image to Video (i2v-01)',
|
41
|
+
value: 'i2v-01',
|
42
|
+
description: 'Standard image-to-video model',
|
43
|
+
},
|
44
|
+
{
|
45
|
+
name: 'Image to Video Live (i2v-01-live)',
|
46
|
+
value: 'i2v-01-live',
|
47
|
+
description: 'Image-to-video model with more natural movements',
|
48
|
+
},
|
49
|
+
{
|
50
|
+
name: 'Image to Video Director (i2v-01-director)',
|
51
|
+
value: 'i2v-01-director',
|
52
|
+
description: 'Image-to-video with camera movement control. Use [Pan left], [Push in], etc. in your prompt',
|
53
|
+
},
|
54
|
+
],
|
55
|
+
default: 'i2v-01',
|
56
|
+
description: 'The model to use for image-to-video generation',
|
57
|
+
},
|
58
|
+
{
|
59
|
+
displayName: 'Text Prompt',
|
60
|
+
name: 'prompt',
|
61
|
+
type: 'string',
|
62
|
+
typeOptions: {
|
63
|
+
rows: 4,
|
64
|
+
},
|
65
|
+
default: '',
|
66
|
+
displayOptions: {
|
67
|
+
show: {
|
68
|
+
model: ['i2v-01-director'],
|
69
|
+
},
|
70
|
+
},
|
71
|
+
required: true,
|
72
|
+
description: 'Text prompt for video generation with camera instructions (max 2000 characters)',
|
73
|
+
},
|
74
|
+
{
|
75
|
+
displayName: 'Text Prompt',
|
76
|
+
name: 'prompt',
|
77
|
+
type: 'string',
|
78
|
+
typeOptions: {
|
79
|
+
rows: 4,
|
80
|
+
},
|
81
|
+
default: '',
|
82
|
+
displayOptions: {
|
83
|
+
hide: {
|
84
|
+
model: ['i2v-01-director'],
|
85
|
+
},
|
86
|
+
},
|
87
|
+
required: false,
|
88
|
+
description: 'Optional text prompt to guide video generation (max 2000 characters)',
|
89
|
+
},
|
90
|
+
{
|
91
|
+
displayName: 'Expand Prompt',
|
92
|
+
name: 'expandPrompt',
|
93
|
+
type: 'boolean',
|
94
|
+
default: false,
|
95
|
+
description: 'Whether to expand the input prompt to add details',
|
96
|
+
},
|
97
|
+
{
|
98
|
+
displayName: 'Wait for Completion',
|
99
|
+
name: 'waitForCompletion',
|
100
|
+
type: 'boolean',
|
101
|
+
default: false,
|
102
|
+
description: 'Whether to wait for the video generation to complete',
|
103
|
+
},
|
104
|
+
{
|
105
|
+
displayName: 'Maximum Retries',
|
106
|
+
name: 'maxRetries',
|
107
|
+
type: 'number',
|
108
|
+
displayOptions: {
|
109
|
+
show: {
|
110
|
+
waitForCompletion: [true],
|
111
|
+
},
|
112
|
+
},
|
113
|
+
default: 20,
|
114
|
+
description: 'Maximum number of times to check task status',
|
115
|
+
},
|
116
|
+
{
|
117
|
+
displayName: 'Retry Interval (ms)',
|
118
|
+
name: 'retryInterval',
|
119
|
+
type: 'number',
|
120
|
+
displayOptions: {
|
121
|
+
show: {
|
122
|
+
waitForCompletion: [true],
|
123
|
+
},
|
124
|
+
},
|
125
|
+
default: 3000,
|
126
|
+
description: 'Time to wait between status checks in milliseconds',
|
127
|
+
},
|
128
|
+
],
|
129
|
+
};
|
130
|
+
}
|
131
|
+
async execute() {
|
132
|
+
const items = this.getInputData();
|
133
|
+
const returnData = [];
|
134
|
+
for (let i = 0; i < items.length; i++) {
|
135
|
+
try {
|
136
|
+
const imageUrl = this.getNodeParameter('imageUrl', i);
|
137
|
+
const model = this.getNodeParameter('model', i);
|
138
|
+
const prompt = this.getNodeParameter('prompt', i, '');
|
139
|
+
const expandPrompt = this.getNodeParameter('expandPrompt', i, false);
|
140
|
+
const waitForCompletion = this.getNodeParameter('waitForCompletion', i, true);
|
141
|
+
const maxRetries = waitForCompletion ? this.getNodeParameter('maxRetries', i, 20) : 0;
|
142
|
+
const retryInterval = waitForCompletion ? this.getNodeParameter('retryInterval', i, 3000) : 0;
|
143
|
+
const parameters = {
|
144
|
+
image_url: imageUrl,
|
145
|
+
model,
|
146
|
+
};
|
147
|
+
if (prompt) {
|
148
|
+
parameters.prompt = prompt;
|
149
|
+
}
|
150
|
+
if (expandPrompt) {
|
151
|
+
parameters.expand_prompt = expandPrompt;
|
152
|
+
}
|
153
|
+
const response = await GenericFunctions_1.piApiRequest.call(this, 'POST', '/api/v1/task', {
|
154
|
+
model: 'hailuo',
|
155
|
+
task_type: 'video_generation',
|
156
|
+
input: parameters,
|
157
|
+
config: {
|
158
|
+
service_mode: 'public',
|
159
|
+
},
|
160
|
+
});
|
161
|
+
if (waitForCompletion) {
|
162
|
+
const taskId = response.data.task_id;
|
163
|
+
const taskData = await GenericFunctions_1.waitForTaskCompletion.call(this, taskId, maxRetries, retryInterval);
|
164
|
+
returnData.push({
|
165
|
+
json: taskData,
|
166
|
+
});
|
167
|
+
}
|
168
|
+
else {
|
169
|
+
returnData.push({
|
170
|
+
json: response.data,
|
171
|
+
});
|
172
|
+
}
|
173
|
+
}
|
174
|
+
catch (error) {
|
175
|
+
if (this.continueOnFail()) {
|
176
|
+
returnData.push({
|
177
|
+
json: {
|
178
|
+
error: error.message,
|
179
|
+
},
|
180
|
+
});
|
181
|
+
continue;
|
182
|
+
}
|
183
|
+
throw error;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
return [returnData];
|
187
|
+
}
|
188
|
+
}
|
189
|
+
exports.HailuoImageToVideo = HailuoImageToVideo;
|
190
|
+
//# sourceMappingURL=HailuoImageToVideo.node.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"HailuoImageToVideo.node.js","sourceRoot":"","sources":["../../../../nodes/PiAPI/Hailuo/HailuoImageToVideo.node.ts"],"names":[],"mappings":";;;AAQA,iEAAiF;AAGjF,MAAa,kBAAkB;IAA/B;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,uBAAuB;YACpC,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,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,CACJ,CAAC;gBAEF,IAAI,iBAAiB,EAAE,CAAC;oBAEpB,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;oBACrC,MAAM,QAAQ,GAAG,MAAM,wCAAqB,CAAC,IAAI,CAC7C,IAAI,EACJ,MAAM,EACN,UAAU,EACV,aAAa,CAChB,CAAC;oBACF,UAAU,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,QAAQ;qBACjB,CAAC,CAAC;gBACP,CAAC;qBAAM,CAAC;oBAEJ,UAAU,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,QAAQ,CAAC,IAAI;qBACtB,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBACxB,UAAU,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE;4BACF,KAAK,EAAE,KAAK,CAAC,OAAO;yBACvB;qBACJ,CAAC,CAAC;oBACH,SAAS;gBACb,CAAC;gBACD,MAAM,KAAK,CAAC;YAChB,CAAC;QACL,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;CACJ;AA3MD,gDA2MC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
2
|
+
export declare class HailuoSubjectVideo implements INodeType {
|
3
|
+
description: INodeTypeDescription;
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
5
|
+
}
|