UNPKG

n8n-nodes-octavehq

Version:

Octave is the AI-powered messaging brain for B2B go-to-market teams, helping articulate product value, synthesize customer interaction data, and deploy consistent, effective messaging across all channels.

99 lines 3.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.exportedProperties = void 0; exports.execute = execute; const n8n_workflow_1 = require("n8n-workflow"); const OctaveApiRequest_1 = require("../../transport/OctaveApiRequest"); const utils_1 = require("../utils"); const properties = [ { displayName: 'Sources', name: 'sources', type: 'fixedCollection', placeholder: 'Add Source', typeOptions: { multipleValues: true }, default: {}, description: 'Source materials to apply brand voice to (at least one required)', options: [ { displayName: 'Source', name: 'source', values: [ { displayName: 'Type', name: 'type', type: 'options', options: [ { name: 'Text', value: 'TEXT' }, { name: 'URL', value: 'URL' }, { name: 'Resource', value: 'RESOURCE' }, ], default: 'TEXT', }, { displayName: 'Value', name: 'value', type: 'string', default: '', description: 'The source content (text, URL, or resource OId)', typeOptions: { rows: 3 }, }, ], }, ], }, { displayName: 'Brand Voice OId', name: 'brandVoiceOId', type: 'string', default: '', description: 'Brand Voice OId to apply. If not provided, uses workspace default.', }, { displayName: 'Model Type', name: 'modelType', type: 'options', options: [ { name: 'Chorus', value: 'CHORUS' }, { name: 'Echo (20 Credits)', value: 'ECHO' }, { name: 'Harmony', value: 'HARMONY' }, { name: 'Note (5 Credits)', value: 'NOTE' }, { name: 'Pulse (10 Credits)', value: 'PULSE' }, { name: 'Symphony', value: 'SYMPHONY' }, ], default: 'PULSE', description: 'Model quality tier', }, { displayName: 'Include Original', name: 'includeOriginal', type: 'boolean', default: false, description: 'Whether to include the original expanded content in the response', }, ]; const displayOptions = { show: { resource: ['brandVoice'], operation: ['apply'], }, }; exports.exportedProperties = (0, utils_1.applyDisplayOptions)(displayOptions, properties); async function execute(itemIndex) { const sourcesRaw = this.getNodeParameter('sources', itemIndex); const sources = (sourcesRaw === null || sourcesRaw === void 0 ? void 0 : sourcesRaw.source) || []; if (sources.length === 0) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'At least one source is required.', { itemIndex }); } const body = { sources }; const brandVoiceOId = this.getNodeParameter('brandVoiceOId', itemIndex); if (brandVoiceOId) body.brandVoiceOId = brandVoiceOId; const modelType = this.getNodeParameter('modelType', itemIndex); if (modelType) body.modelType = modelType; body.includeOriginal = this.getNodeParameter('includeOriginal', itemIndex); const responseData = await OctaveApiRequest_1.octaveApiRequest.call(this, 'POST', '/api/v2/brand-voice/apply', body); return [this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([responseData]), { itemData: { item: itemIndex } })]; } //# sourceMappingURL=apply.operation.js.map