UNPKG

@wiro-ai/n8n-nodes-wiroai

Version:

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

174 lines 7.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChatterboxMultilingual = void 0; const n8n_workflow_1 = require("n8n-workflow"); const auth_1 = require("../utils/auth"); const polling_1 = require("../utils/polling"); class ChatterboxMultilingual { constructor() { this.description = { displayName: 'Wiro - Chatterbox Multilingual', name: 'chatterboxMultilingual', icon: { light: 'file:wiro.svg', dark: 'file:wiro.svg' }, group: ['transform'], version: 1, description: 'Generate expressive, natural speech in 23 languages. Features instant voice cloning from short', defaults: { name: 'Wiro - Chatterbox Multilingual', }, inputs: [n8n_workflow_1.NodeConnectionTypes.Main], outputs: [n8n_workflow_1.NodeConnectionTypes.Main], usableAsTool: true, credentials: [ { name: 'wiroApi', required: true, }, ], properties: [ { displayName: 'Input Audio (Optional) URL', name: 'inputAudioUrl', type: 'string', default: '', description: 'Supported audio formats: .wav, .m4a, .mp3, .ogg, .opus and webm', }, { displayName: 'Prompt', name: 'prompt', type: 'string', default: '', required: true, description: 'Prompt-help', }, { displayName: 'Language', name: 'language', type: 'options', default: 'ar', required: true, description: 'Select option for language', options: [ { name: 'Arabic', value: 'ar' }, { name: 'Chinese', value: 'zh' }, { name: 'Danish', value: 'da' }, { name: 'Dutch', value: 'nl' }, { name: 'English', value: 'en' }, { name: 'Finnish', value: 'fi' }, { name: 'French', value: 'fr' }, { name: 'German', value: 'de' }, { name: 'Greek', value: 'el' }, { name: 'Hebrew', value: 'he' }, { name: 'Hindi', value: 'hi' }, { name: 'Italian', value: 'it' }, { name: 'Japanese', value: 'ja' }, { name: 'Korean', value: 'ko' }, { name: 'Malay', value: 'ms' }, { name: 'Norwegian', value: 'no' }, { name: 'Polish', value: 'pl' }, { name: 'Portuguese', value: 'pt' }, { name: 'Ruussian', value: 'ru' }, { name: 'Spanish', value: 'es' }, { name: 'Swahili', value: 'sw' }, { name: 'Swedish', value: 'sv' }, { name: 'Turkish', value: 'tr' }, ], }, { displayName: 'Exaggeration', name: 'exaggeration', type: 'number', default: 0, required: true, description: 'Controls speech expressiveness (0.25-2.0, neutral=0.5, extreme values may be unstable)', }, { displayName: 'Cfg Weight', name: 'cfg_weight', type: 'number', default: 0, required: true, description: 'CFG/Pace weight controlling generation guidance (0.2-1.0). Use 0.5 for balanced results, 0 for language transfer.', }, { displayName: 'Temperature', name: 'temperature', type: 'number', default: 0, required: true, description: 'Controls randomness in generation (0.05-5.0, higher=more varied)', }, { displayName: 'Top P', name: 'topP', type: 'number', default: 0, required: true, description: 'Ensures that when selecting the next token in the model, it only chooses from among the most probable tokens that reach the cumulative probability p value', }, ], }; } async execute() { const returnData = []; const inputAudioUrl = this.getNodeParameter('inputAudioUrl', 0, ''); const prompt = this.getNodeParameter('prompt', 0); const language = this.getNodeParameter('language', 0); const exaggeration = this.getNodeParameter('exaggeration', 0); const cfg_weight = this.getNodeParameter('cfg_weight', 0); const temperature = this.getNodeParameter('temperature', 0); const topP = this.getNodeParameter('topP', 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/ resemble-ai/chatterbox-multilingual ', headers: { ...headers, 'Content-Type': 'application/json', }, body: { inputAudioUrl, prompt, language, exaggeration, cfg_weight, temperature, topP, }, }); 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.ChatterboxMultilingual = ChatterboxMultilingual; //# sourceMappingURL=ChatterboxMultilingual.node.js.map