UNPKG

n8n-nodes-recallio

Version:

RecallioAI Memory node for n8n

78 lines 2.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RecallioMemory = void 0; const RecallioCommunity_1 = require("../../lib/RecallioCommunity"); const n8n_workflow_1 = require("n8n-workflow"); class RecallioMemory { constructor() { this.description = { displayName: 'Recallio Memory', name: 'recallioMemory', icon: 'file:recallio-icon.svg', group: ['transform'], codex: { categories: ['AI'], subcategories: { AI: ['Memory'], Memory: ['Other memories'], } }, version: 1, description: 'Interact with RecallioAI memory API', defaults: { name: 'Recallio Memory', }, inputs: [], outputs: ["ai_memory"], outputNames: ['Memory'], credentials: [ { name: 'recallioApi', required: true, }, ], properties: [ { displayName: 'User ID', name: 'userId', type: 'string', default: '', required: true, description: 'Unique identifier for the user', }, { displayName: 'Project ID', name: 'projectId', type: 'string', default: 'default', description: 'Optional project identifier to namespace memories', }, ], }; } async supplyData(itemIndex) { const credentials = (await this.getCredentials('recallioApi')); const userId = this.getNodeParameter('userId', itemIndex); const projectId = this.getNodeParameter('projectId', itemIndex, 'default'); const sessionId = userId; if (!(credentials === null || credentials === void 0 ? void 0 : credentials.apiKey)) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Missing RecallIO API key'); } if (!userId) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'User ID is required'); } const memory = new RecallioCommunity_1.RecallioMemory({ apiKey: credentials.apiKey, sessionId, projectId, inputKey: 'input', outputKey: 'output', memoryKey: 'chat_history', }, this.helpers.httpRequest); return { response: memory, }; } } exports.RecallioMemory = RecallioMemory; //# sourceMappingURL=RecallioMemory.node.js.map