@wiro-ai/n8n-nodes-wiroai
Version:
n8n community node for Wiro AI — 290+ AI models: video, image, audio, LLM, 3D, and more.
198 lines • 7.97 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Vace = void 0;
const n8n_workflow_1 = require("n8n-workflow");
const auth_1 = require("../utils/auth");
const polling_1 = require("../utils/polling");
class Vace {
constructor() {
this.description = {
displayName: 'Wiro - Vace',
name: 'vace',
icon: { light: 'file:wiro.svg', dark: 'file:wiro.svg' },
group: ['transform'],
version: 1,
description: 'Vace powered by Pruna AI',
defaults: {
name: 'Wiro - Vace',
},
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
usableAsTool: true,
credentials: [
{
name: 'wiroApi',
required: true,
},
],
properties: [
{
displayName: 'Prompt',
name: 'prompt',
type: 'string',
default: '',
required: true,
description: 'Text input for prompt',
},
{
displayName: 'Images URL',
name: 'inputImageUrl',
type: 'string',
default: '',
description: 'Optional. Use 1-3 clear, high-quality images for character consistency.',
},
{
displayName: 'Resolution',
name: 'resolution',
type: 'options',
default: '480p',
description: 'Select option for resolution',
options: [
{ name: '480p', value: '480p' },
{ name: '720p', value: '720p' },
],
},
{
displayName: 'Aspect Ratio',
name: 'ratio',
type: 'options',
default: '16:9',
description: 'Auto will calculate from reference image, if no image provided it will set 16:9 by default',
options: [
{ name: '16:9 (Landscape)', value: '16:9' },
{ name: '9:16 (Portrait)', value: '9:16' },
{ name: 'Auto (From Image)', value: 'auto' },
],
},
{
displayName: 'Frame Number',
name: 'frameNum',
type: 'string',
default: '',
description: 'Number of frames to generate',
},
{
displayName: 'Speed Mode',
name: 'speedMode',
type: 'options',
default: 'Extra Juiced 🚀 (even more speed)',
description: 'Balance between speed and quality',
options: [
{ name: 'Extra Juiced 🚀 (Fastest)', value: 'Extra Juiced 🚀 (even more speed)' },
{ name: 'Juiced 🔥 (Balanced)', value: 'Juiced 🔥 (more speed)' },
{ name: 'Lightly Juiced 🍊 (Best Quality)', value: 'Lightly Juiced 🍊 (more consistent)' },
],
},
{
displayName: 'Sample Steps',
name: 'sampleSteps',
type: 'string',
default: '',
description: 'Higher values = better quality, slower generation',
},
{
displayName: 'Sample Solver',
name: 'sampleSolver',
type: 'options',
default: 'dpm++',
description: 'Sampling algorithm',
options: [
{ name: 'DPM++', value: 'dpm++' },
{ name: 'UniPC', value: 'unipc' },
],
},
{
displayName: 'Guidance Scale',
name: 'guidanceScale',
type: 'string',
default: '',
description: 'How closely to follow the prompt (higher = stricter)',
},
{
displayName: 'Sample Shift',
name: 'sampleShift',
type: 'string',
default: '',
description: 'Sample shift parameter for fine-tuning',
},
{
displayName: 'Seed',
name: 'seed',
type: 'string',
default: '',
description: 'Random seed for reproducibility. Use 0 for random seed.',
},
],
};
}
async execute() {
const returnData = [];
const prompt = this.getNodeParameter('prompt', 0);
const inputImageUrl = this.getNodeParameter('inputImageUrl', 0, '');
const resolution = this.getNodeParameter('resolution', 0, '');
const ratio = this.getNodeParameter('ratio', 0, '');
const frameNum = this.getNodeParameter('frameNum', 0, '');
const speedMode = this.getNodeParameter('speedMode', 0, '');
const sampleSteps = this.getNodeParameter('sampleSteps', 0, '');
const sampleSolver = this.getNodeParameter('sampleSolver', 0, '');
const guidanceScale = this.getNodeParameter('guidanceScale', 0, '');
const sampleShift = this.getNodeParameter('sampleShift', 0, '');
const seed = this.getNodeParameter('seed', 0, '');
const credentials = await this.getCredentials('wiroApi');
const apiKey = credentials.apiKey;
const apiSecret = credentials.apiSecret;
const headers = (0, auth_1.generateWiroAuthHeaders)(apiKey, apiSecret);
const response = await this.helpers.httpRequest({
method: 'POST',
url: 'https://api.wiro.ai/v1/Run/pruna/vace',
headers: {
...headers,
'Content-Type': 'application/json',
},
body: {
prompt,
inputImageUrl,
resolution,
ratio,
frameNum,
speedMode,
sampleSteps,
sampleSolver,
guidanceScale,
sampleShift,
seed,
},
});
if (!(response === null || response === void 0 ? void 0 : response.taskid) || !(response === null || response === void 0 ? void 0 : response.socketaccesstoken)) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
message: 'Wiro API did not return a valid task ID or socket access token ' +
JSON.stringify(response),
});
}
const taskid = response.taskid;
const socketaccesstoken = response.socketaccesstoken;
const result = await polling_1.pollTaskUntilComplete.call(this, socketaccesstoken, headers);
const responseJSON = {
taskid: taskid,
url: '',
status: '',
};
switch (result) {
case '-1':
case '-2':
case '-3':
case '-4':
responseJSON.status = 'failed';
break;
default:
responseJSON.status = 'completed';
responseJSON.url = result !== null && result !== void 0 ? result : '';
}
returnData.push({
json: responseJSON,
});
return [returnData];
}
}
exports.Vace = Vace;
//# sourceMappingURL=Vace.node.js.map