UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

50 lines 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.description = void 0; exports.execute = execute; const n8n_workflow_1 = require("n8n-workflow"); const transport_1 = require("../../../transport"); const descriptions_1 = require("../descriptions"); const properties = [ { displayName: 'Conversation ID', name: 'conversationId', type: 'string', default: '', placeholder: 'conv_1234567890', description: 'The ID of the conversation to update', required: true, }, { ...descriptions_1.metadataProperty, required: true }, ]; const displayOptions = { show: { operation: ['update'], resource: ['conversation'], }, }; exports.description = (0, n8n_workflow_1.updateDisplayOptions)(displayOptions, properties); async function execute(i) { const conversationId = this.getNodeParameter('conversationId', i, ''); const metadata = this.getNodeParameter('metadata', i, ''); if (!conversationId) { throw new Error('Conversation ID is required'); } if (!metadata) { throw new Error('Metadata is required'); } const body = {}; body.metadata = (0, n8n_workflow_1.jsonParse)(metadata, { errorMessage: 'Invalid JSON in metadata field', }); const response = await transport_1.apiRequest.call(this, 'POST', `/conversations/${conversationId}`, { body, }); return [ { json: response, pairedItem: { item: i }, }, ]; } //# sourceMappingURL=update.operation.js.map