UNPKG

@wiro-ai/n8n-nodes-wiroai

Version:

n8n community node for Wiro AI — 290+ AI models: video, image, audio, LLM, 3D, and more.

175 lines 6.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TextToImageFluxLoraFast = void 0; const n8n_workflow_1 = require("n8n-workflow"); const auth_1 = require("../utils/auth"); const polling_1 = require("../utils/polling"); class TextToImageFluxLoraFast { constructor() { this.description = { displayName: 'Wiro - Text To Image Flux Lora Fast', name: 'textToImageFluxLoraFast', icon: { light: 'file:wiro.svg', dark: 'file:wiro.svg' }, group: ['transform'], version: 1, description: 'Flux is a tool that generates images from text descriptions. With LoRA models, you can enhance', defaults: { name: 'Wiro - Text To Image Flux Lora Fast', }, inputs: [n8n_workflow_1.NodeConnectionTypes.Main], outputs: [n8n_workflow_1.NodeConnectionTypes.Main], usableAsTool: true, credentials: [ { name: 'wiroApi', required: true, }, ], properties: [ { displayName: 'Select Lora Model', name: 'selectedLoraModel', type: 'options', default: '', description: 'Select-lora-model-help', options: [ { name: '', value: '' }, ], }, { displayName: 'Select Lora Model Private', name: 'selectedLoraModelPrivate', type: 'options', default: '', description: 'Select-lora-model-private-help', options: [], }, { displayName: 'Lo RA Model Url', name: 'selectedLoraModelPrivateUrl', type: 'string', default: '', description: 'You can provide a direct URL to a LoRA model (.safetensors). We’ll apply it during generation. You can also use links from platforms like Google Drive, AWS S3, or any publicly accessible file host', }, { displayName: 'Prompt', name: 'prompt', type: 'string', default: '', required: true, description: 'Prompt-help', }, { displayName: 'Inferencesteps', name: 'steps', type: 'number', default: 0, description: 'Inferencesteps-help', }, { displayName: 'Guidancescale', name: 'scale', type: 'number', default: 0, description: 'Guidancescale-help', }, { displayName: 'Samples', name: 'samples', type: 'number', default: 0, description: 'Number of samples to process or generate', }, { displayName: 'Seed', name: 'seed', type: 'string', default: '', description: 'Seed-help', }, { displayName: 'Width', name: 'width', type: 'number', default: 0, description: 'Width-help', }, { displayName: 'Height', name: 'height', type: 'number', default: 0, description: 'Height-help', }, ], }; } async execute() { const returnData = []; const selectedLoraModel = this.getNodeParameter('selectedLoraModel', 0, ''); const selectedLoraModelPrivate = this.getNodeParameter('selectedLoraModelPrivate', 0, ''); const selectedLoraModelPrivateUrl = this.getNodeParameter('selectedLoraModelPrivateUrl', 0, ''); const prompt = this.getNodeParameter('prompt', 0); const steps = this.getNodeParameter('steps', 0, 0); const scale = this.getNodeParameter('scale', 0, 0); const samples = this.getNodeParameter('samples', 0, 0); const seed = this.getNodeParameter('seed', 0, ''); const width = this.getNodeParameter('width', 0, 0); const height = this.getNodeParameter('height', 0, 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/wiro/text-to-image-flux-lora-fast', headers: { ...headers, 'Content-Type': 'application/json', }, body: { selectedLoraModel, selectedLoraModelPrivate, selectedLoraModelPrivateUrl, prompt, steps, scale, samples, seed, width, height, }, }); 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.TextToImageFluxLoraFast = TextToImageFluxLoraFast; //# sourceMappingURL=TextToImageFluxLoraFast.node.js.map