@n8n/n8n-nodes-langchain 1.119.0 → 1.120.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,7 @@ __export(ChatTrigger_node_exports, {
33
33
  module.exports = __toCommonJS(ChatTrigger_node_exports);
34
34
  var import_pick = __toESM(require("lodash/pick"));
35
35
  var import_n8n_workflow = require("n8n-workflow");
36
+ var a = __toESM(require("node:assert"));
36
37
  var import_constants = require("./constants");
37
38
  var import_GenericFunctions = require("./GenericFunctions");
38
39
  var import_templates = require("./templates");
@@ -569,6 +570,7 @@ class ChatTrigger extends import_n8n_workflow.Node {
569
570
  }
570
571
  async handleFormData(context) {
571
572
  const req = context.getRequestObject();
573
+ a.ok(req.contentType === "multipart/form-data", "Expected multipart/form-data");
572
574
  const options = context.getNodeParameter("options", {});
573
575
  const { data, files } = req.body;
574
576
  const returnItem = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/trigger/ChatTrigger/ChatTrigger.node.ts"],"sourcesContent":["import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';\nimport pick from 'lodash/pick';\nimport {\n\tNode,\n\tNodeConnectionTypes,\n\tNodeOperationError,\n\tassertParamIsBoolean,\n\tvalidateNodeParameters,\n\tassertParamIsString,\n} from 'n8n-workflow';\nimport type {\n\tIDataObject,\n\tIWebhookFunctions,\n\tIWebhookResponseData,\n\tINodeTypeDescription,\n\tMultiPartFormData,\n\tINodeExecutionData,\n\tIBinaryData,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nimport { cssVariables } from './constants';\nimport { validateAuth } from './GenericFunctions';\nimport { createPage } from './templates';\nimport { assertValidLoadPreviousSessionOption } from './types';\n\nconst CHAT_TRIGGER_PATH_IDENTIFIER = 'chat';\nconst allowFileUploadsOption: INodeProperties = {\n\tdisplayName: 'Allow File Uploads',\n\tname: 'allowFileUploads',\n\ttype: 'boolean',\n\tdefault: false,\n\tdescription: 'Whether to allow file uploads in the chat',\n};\nconst allowedFileMimeTypeOption: INodeProperties = {\n\tdisplayName: 'Allowed File Mime Types',\n\tname: 'allowedFilesMimeTypes',\n\ttype: 'string',\n\tdefault: '*',\n\tplaceholder: 'e.g. image/*, text/*, application/pdf',\n\tdescription:\n\t\t'Allowed file types for upload. Comma-separated list of <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\" target=\"_blank\">MIME types</a>.',\n};\n\nconst respondToWebhookResponseMode = {\n\tname: \"Using 'Respond to Webhook' Node\",\n\tvalue: 'responseNode',\n\tdescription: 'Response defined in that node',\n};\n\nconst lastNodeResponseMode = {\n\tname: 'When Last Node Finishes',\n\tvalue: 'lastNode',\n\tdescription: 'Returns data of the last-executed node',\n};\n\nconst streamingResponseMode = {\n\tname: 'Streaming',\n\tvalue: 'streaming',\n\tdescription: 'Streaming response from specified nodes (e.g. Agents)',\n};\n\nconst respondNodesResponseMode = {\n\tname: 'Using Response Nodes',\n\tvalue: 'responseNodes',\n\tdescription:\n\t\t\"Send responses to the chat by using 'Respond to Chat' or 'Respond to Webhook' nodes\",\n};\n\nconst commonOptionsFields: INodeProperties[] = [\n\t// CORS parameters are only valid for when chat is used in hosted or webhook mode\n\t{\n\t\tdisplayName: 'Allowed Origins (CORS)',\n\t\tname: 'allowedOrigins',\n\t\ttype: 'string',\n\t\tdefault: '*',\n\t\tdescription:\n\t\t\t'Comma-separated list of URLs allowed for cross-origin non-preflight requests. Use * (default) to allow all origins.',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat', 'webhook'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\t...allowFileUploadsOption,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\t...allowedFileMimeTypeOption,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Placeholder',\n\t\tname: 'inputPlaceholder',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: 'Type your question..',\n\t\tplaceholder: 'e.g. Type your message here',\n\t\tdescription: 'Shown as placeholder text in the chat input field',\n\t},\n\t{\n\t\tdisplayName: 'Load Previous Session',\n\t\tname: 'loadPreviousSession',\n\t\ttype: 'options',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Off',\n\t\t\t\tvalue: 'notSupported',\n\t\t\t\tdescription: 'Loading messages of previous session is turned off',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'From Memory',\n\t\t\t\tvalue: 'memory',\n\t\t\t\tdescription: 'Load session messages from memory',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Manually',\n\t\t\t\tvalue: 'manually',\n\t\t\t\tdescription: 'Manually return messages of session',\n\t\t\t},\n\t\t],\n\t\tdefault: 'notSupported',\n\t\tdescription: 'If loading messages of a previous session should be enabled',\n\t},\n\t{\n\t\tdisplayName: 'Require Button Click to Start Chat',\n\t\tname: 'showWelcomeScreen',\n\t\ttype: 'boolean',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: false,\n\t\tdescription: 'Whether to show the welcome screen at the start of the chat',\n\t},\n\t{\n\t\tdisplayName: 'Start Conversation Button Text',\n\t\tname: 'getStarted',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tshowWelcomeScreen: [true],\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: 'New Conversation',\n\t\tplaceholder: 'e.g. New Conversation',\n\t\tdescription: 'Shown as part of the welcome screen, in the middle of the chat window',\n\t},\n\t{\n\t\tdisplayName: 'Subtitle',\n\t\tname: 'subtitle',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: \"Start a chat. We're here to help you 24/7.\",\n\t\tplaceholder: \"e.g. We're here for you\",\n\t\tdescription: 'Shown at the top of the chat, under the title',\n\t},\n\t{\n\t\tdisplayName: 'Title',\n\t\tname: 'title',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: 'Hi there! 👋',\n\t\tplaceholder: 'e.g. Welcome',\n\t\tdescription: 'Shown at the top of the chat',\n\t},\n\t{\n\t\tdisplayName: 'Custom Chat Styling',\n\t\tname: 'customCss',\n\t\ttype: 'string',\n\t\ttypeOptions: {\n\t\t\trows: 10,\n\t\t\teditor: 'cssEditor',\n\t\t},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: `\n${cssVariables}\n\n/* You can override any class styles, too. Right-click inspect in Chat UI to find class to override. */\n.chat-message {\n\tmax-width: 50%;\n}\n`.trim(),\n\t\tdescription: 'Override default styling of the public chat interface with CSS',\n\t},\n];\n\nexport class ChatTrigger extends Node {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Chat Trigger',\n\t\tname: 'chatTrigger',\n\t\ticon: 'fa:comments',\n\t\ticonColor: 'black',\n\t\tgroup: ['trigger'],\n\t\tversion: [1, 1.1, 1.2, 1.3, 1.4],\n\t\tdefaultVersion: 1.4,\n\t\tdescription: 'Runs the workflow when an n8n generated webchat is submitted',\n\t\tdefaults: {\n\t\t\tname: 'When chat message received',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['Core Nodes'],\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.chattrigger/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tmaxNodes: 1,\n\t\tinputs: `={{ (() => {\n\t\t\tif (!['hostedChat', 'webhook'].includes($parameter.mode)) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tif ($parameter.options?.loadPreviousSession !== 'memory') {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Memory',\n\t\t\t\t\tmaxConnections: 1,\n\t\t\t\t\ttype: '${NodeConnectionTypes.AiMemory}',\n\t\t\t\t\trequired: true,\n\t\t\t\t}\n\t\t\t];\n\t\t })() }}`,\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed\n\t\t\t\tname: 'httpBasicAuth',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['basicAuth'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\twebhooks: [\n\t\t\t{\n\t\t\t\tname: 'setup',\n\t\t\t\thttpMethod: 'GET',\n\t\t\t\tresponseMode: 'onReceived',\n\t\t\t\tpath: CHAT_TRIGGER_PATH_IDENTIFIER,\n\t\t\t\tndvHideUrl: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'POST',\n\t\t\t\tresponseMode: '={{$parameter.options?.[\"responseMode\"] || \"lastNode\" }}',\n\t\t\t\tpath: CHAT_TRIGGER_PATH_IDENTIFIER,\n\t\t\t\tndvHideMethod: true,\n\t\t\t\tndvHideUrl: '={{ !$parameter.public }}',\n\t\t\t},\n\t\t],\n\t\teventTriggerDescription: 'Waiting for you to submit the chat',\n\t\tactivationMessage: 'You can now make calls to your production chat URL.',\n\t\ttriggerPanel: false,\n\t\tproperties: [\n\t\t\t/**\n\t\t\t * @note If we change this property, also update it in ChatEmbedModal.vue\n\t\t\t */\n\t\t\t{\n\t\t\t\tdisplayName: 'Make Chat Publicly Available',\n\t\t\t\tname: 'public',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether the chat should be publicly available or only accessible through the manual chat interface',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Mode',\n\t\t\t\tname: 'mode',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Hosted Chat',\n\t\t\t\t\t\tvalue: 'hostedChat',\n\t\t\t\t\t\tdescription: 'Chat on a page served by n8n',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Embedded Chat',\n\t\t\t\t\t\tvalue: 'webhook',\n\t\t\t\t\t\tdescription: 'Chat through a widget embedded in another page, or by calling a webhook',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'hostedChat',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Chat will be live at the URL above once you activate this workflow. Live executions will show up in the ‘executions’ tab',\n\t\t\t\tname: 'hostedChatNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Follow the instructions <a href=\"https://www.npmjs.com/package/@n8n/chat\" target=\"_blank\">here</a> to embed chat in a webpage (or just call the webhook URL at the top of this section). Chat will be live once you activate this workflow',\n\t\t\t\tname: 'embeddedChatNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['webhook'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Authentication',\n\t\t\t\tname: 'authentication',\n\t\t\t\ttype: 'options',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Basic Auth',\n\t\t\t\t\t\tvalue: 'basicAuth',\n\t\t\t\t\t\tdescription: 'Simple username and password (the same one for all users)',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\tname: 'n8n User Auth',\n\t\t\t\t\t\tvalue: 'n8nUserAuth',\n\t\t\t\t\t\tdescription: 'Require user to be logged in with their n8n account',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'None',\n\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'none',\n\t\t\t\tdescription: 'The way to authenticate',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Initial Message(s)',\n\t\t\t\tname: 'initialMessages',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t\tdefault: 'Hi there! 👋\\nMy name is Nathan. How can I assist you today?',\n\t\t\t\tdescription: 'Default messages shown at the start of the chat, one per line',\n\t\t\t},\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tdisplayName: 'Make Available in n8n Chat',\n\t\t\t\tname: 'availableInChat',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether to make the agent available in n8n Chat',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.4 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Agent Name',\n\t\t\t\tname: 'agentName',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'The name of the agent on n8n Chat',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tavailableInChat: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Agent Description',\n\t\t\t\tname: 'agentDescription',\n\t\t\t\ttype: 'string',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 2,\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'The description of the agent on n8n Chat',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tavailableInChat: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tpublic: [false],\n\t\t\t\t\t\t'@version': [1, 1.1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [allowFileUploadsOption, allowedFileMimeTypeOption],\n\t\t\t},\n\t\t\t// Options for versions 1.0 and 1.1 (without streaming)\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat', 'webhook'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t\t'@version': [1, 1.1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t...commonOptionsFields,\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, respondToWebhookResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the webhook',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t// Options for version 1.2 (with streaming)\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat', 'webhook'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t\t'@version': [1.2],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t...commonOptionsFields,\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, respondToWebhookResponseMode, streamingResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the webhook',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tpublic: [false],\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.3 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\tallowFileUploadsOption,\n\t\t\t\t\tallowedFileMimeTypeOption,\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, respondNodesResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the chat',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat', 'webhook'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.3 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t...commonOptionsFields,\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, streamingResponseMode, respondToWebhookResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the chat',\n\t\t\t\t\t\tdisplayOptions: { show: { '/mode': ['webhook'] } },\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, streamingResponseMode, respondNodesResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the webhook',\n\t\t\t\t\t\tdisplayOptions: { show: { '/mode': ['hostedChat'] } },\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tprivate async handleFormData(context: IWebhookFunctions) {\n\t\tconst req = context.getRequestObject() as MultiPartFormData.Request;\n\t\tconst options = context.getNodeParameter('options', {}) as IDataObject;\n\t\tconst { data, files } = req.body;\n\n\t\tconst returnItem: INodeExecutionData = {\n\t\t\tjson: data,\n\t\t};\n\n\t\tif (files && Object.keys(files).length) {\n\t\t\treturnItem.json.files = [] as Array<Omit<IBinaryData, 'data'>>;\n\t\t\treturnItem.binary = {};\n\n\t\t\tconst count = 0;\n\t\t\tfor (const fileKey of Object.keys(files)) {\n\t\t\t\tconst processedFiles: MultiPartFormData.File[] = [];\n\t\t\t\tif (Array.isArray(files[fileKey])) {\n\t\t\t\t\tprocessedFiles.push(...files[fileKey]);\n\t\t\t\t} else {\n\t\t\t\t\tprocessedFiles.push(files[fileKey]);\n\t\t\t\t}\n\n\t\t\t\tlet fileIndex = 0;\n\t\t\t\tfor (const file of processedFiles) {\n\t\t\t\t\tlet binaryPropertyName = 'data';\n\n\t\t\t\t\t// Remove the '[]' suffix from the binaryPropertyName if it exists\n\t\t\t\t\tif (binaryPropertyName.endsWith('[]')) {\n\t\t\t\t\t\tbinaryPropertyName = binaryPropertyName.slice(0, -2);\n\t\t\t\t\t}\n\t\t\t\t\tif (options.binaryPropertyName) {\n\t\t\t\t\t\tbinaryPropertyName = `${options.binaryPropertyName.toString()}${count}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst binaryFile = await context.nodeHelpers.copyBinaryFile(\n\t\t\t\t\t\tfile.filepath,\n\t\t\t\t\t\tfile.originalFilename ?? file.newFilename,\n\t\t\t\t\t\tfile.mimetype,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst binaryKey = `${binaryPropertyName}${fileIndex}`;\n\n\t\t\t\t\tconst binaryInfo = {\n\t\t\t\t\t\t...pick(binaryFile, ['fileName', 'fileSize', 'fileType', 'mimeType', 'fileExtension']),\n\t\t\t\t\t\tbinaryKey,\n\t\t\t\t\t};\n\n\t\t\t\t\treturnItem.binary = Object.assign(returnItem.binary ?? {}, {\n\t\t\t\t\t\t[`${binaryKey}`]: binaryFile,\n\t\t\t\t\t});\n\t\t\t\t\treturnItem.json.files = [\n\t\t\t\t\t\t...(returnItem.json.files as Array<Omit<IBinaryData, 'data'>>),\n\t\t\t\t\t\tbinaryInfo,\n\t\t\t\t\t];\n\t\t\t\t\tfileIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn returnItem;\n\t}\n\n\tasync webhook(ctx: IWebhookFunctions): Promise<IWebhookResponseData> {\n\t\tconst res = ctx.getResponseObject();\n\n\t\tconst isPublic = ctx.getNodeParameter('public', false);\n\t\tassertParamIsBoolean('public', isPublic, ctx.getNode());\n\n\t\tconst nodeMode = ctx.getNodeParameter('mode', 'hostedChat');\n\t\tassertParamIsString('mode', nodeMode, ctx.getNode());\n\n\t\tif (!isPublic) {\n\t\t\tres.status(404).end();\n\t\t\treturn {\n\t\t\t\tnoWebhookResponse: true,\n\t\t\t};\n\t\t}\n\n\t\tconst options = ctx.getNodeParameter('options', {});\n\t\tvalidateNodeParameters(\n\t\t\toptions,\n\t\t\t{\n\t\t\t\tgetStarted: { type: 'string' },\n\t\t\t\tinputPlaceholder: { type: 'string' },\n\t\t\t\tloadPreviousSession: { type: 'string' },\n\t\t\t\tshowWelcomeScreen: { type: 'boolean' },\n\t\t\t\tsubtitle: { type: 'string' },\n\t\t\t\ttitle: { type: 'string' },\n\t\t\t\tallowFileUploads: { type: 'boolean' },\n\t\t\t\tallowedFilesMimeTypes: { type: 'string' },\n\t\t\t\tcustomCss: { type: 'string' },\n\t\t\t\tresponseMode: { type: 'string' },\n\t\t\t},\n\t\t\tctx.getNode(),\n\t\t);\n\n\t\tconst loadPreviousSession = options.loadPreviousSession;\n\t\tassertValidLoadPreviousSessionOption(loadPreviousSession, ctx.getNode());\n\n\t\tconst enableStreaming = options.responseMode === 'streaming';\n\n\t\tconst req = ctx.getRequestObject();\n\t\tconst webhookName = ctx.getWebhookName();\n\t\tconst mode = ctx.getMode() === 'manual' ? 'test' : 'production';\n\t\tconst bodyData = ctx.getBodyData() ?? {};\n\n\t\ttry {\n\t\t\tawait validateAuth(ctx);\n\t\t} catch (error) {\n\t\t\tif (error) {\n\t\t\t\tres.writeHead((error as IDataObject).responseCode as number, {\n\t\t\t\t\t'www-authenticate': 'Basic realm=\"Webhook\"',\n\t\t\t\t});\n\t\t\t\tres.end((error as IDataObject).message as string);\n\t\t\t\treturn { noWebhookResponse: true };\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tif (nodeMode === 'hostedChat') {\n\t\t\t// Show the chat on GET request\n\t\t\tif (webhookName === 'setup') {\n\t\t\t\tconst webhookUrlRaw = ctx.getNodeWebhookUrl('default');\n\t\t\t\tif (!webhookUrlRaw) {\n\t\t\t\t\tthrow new NodeOperationError(ctx.getNode(), 'Default webhook url not set');\n\t\t\t\t}\n\n\t\t\t\tconst webhookUrl =\n\t\t\t\t\tmode === 'test' ? webhookUrlRaw.replace('/webhook', '/webhook-test') : webhookUrlRaw;\n\t\t\t\tconst authentication = ctx.getNodeParameter('authentication') as\n\t\t\t\t\t| 'none'\n\t\t\t\t\t| 'basicAuth'\n\t\t\t\t\t| 'n8nUserAuth';\n\t\t\t\tconst initialMessagesRaw = ctx.getNodeParameter('initialMessages', '');\n\t\t\t\tassertParamIsString('initialMessage', initialMessagesRaw, ctx.getNode());\n\t\t\t\tconst instanceId = ctx.getInstanceId();\n\n\t\t\t\tconst i18nConfig: Record<string, string> = {};\n\t\t\t\tconst keys = ['getStarted', 'inputPlaceholder', 'subtitle', 'title'] as const;\n\t\t\t\tfor (const key of keys) {\n\t\t\t\t\tif (options[key] !== undefined) {\n\t\t\t\t\t\ti18nConfig[key] = options[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst page = createPage({\n\t\t\t\t\ti18n: {\n\t\t\t\t\t\ten: i18nConfig,\n\t\t\t\t\t},\n\t\t\t\t\tshowWelcomeScreen: options.showWelcomeScreen,\n\t\t\t\t\tloadPreviousSession,\n\t\t\t\t\tinitialMessages: initialMessagesRaw,\n\t\t\t\t\twebhookUrl,\n\t\t\t\t\tmode,\n\t\t\t\t\tinstanceId,\n\t\t\t\t\tauthentication,\n\t\t\t\t\tallowFileUploads: options.allowFileUploads,\n\t\t\t\t\tallowedFilesMimeTypes: options.allowedFilesMimeTypes,\n\t\t\t\t\tcustomCss: options.customCss,\n\t\t\t\t\tenableStreaming,\n\t\t\t\t});\n\n\t\t\t\tres.status(200).send(page).end();\n\t\t\t\treturn {\n\t\t\t\t\tnoWebhookResponse: true,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif (bodyData.action === 'loadPreviousSession') {\n\t\t\tif (options?.loadPreviousSession === 'memory') {\n\t\t\t\tconst memory = (await ctx.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as\n\t\t\t\t\t| BaseChatMemory\n\t\t\t\t\t| undefined;\n\t\t\t\tconst messages = ((await memory?.chatHistory.getMessages()) ?? [])\n\t\t\t\t\t.filter((message) => !message?.additional_kwargs?.hideFromUI)\n\t\t\t\t\t.map((message) => message?.toJSON());\n\t\t\t\treturn {\n\t\t\t\t\twebhookResponse: { data: messages },\n\t\t\t\t};\n\t\t\t} else if (!options?.loadPreviousSession || options?.loadPreviousSession === 'notSupported') {\n\t\t\t\t// If messages of a previous session should not be loaded, simply return an empty array\n\t\t\t\treturn {\n\t\t\t\t\twebhookResponse: { data: [] },\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tlet returnData: INodeExecutionData[];\n\t\tconst webhookResponse: IDataObject = { status: 200 };\n\n\t\t// Handle streaming responses\n\t\tif (enableStreaming) {\n\t\t\t// Set up streaming response headers\n\t\t\tres.writeHead(200, {\n\t\t\t\t'Content-Type': 'application/json; charset=utf-8',\n\t\t\t\t'Transfer-Encoding': 'chunked',\n\t\t\t\t'Cache-Control': 'no-cache',\n\t\t\t\tConnection: 'keep-alive',\n\t\t\t});\n\n\t\t\t// Flush headers immediately\n\t\t\tres.flushHeaders();\n\n\t\t\tif (req.contentType === 'multipart/form-data') {\n\t\t\t\treturnData = [await this.handleFormData(ctx)];\n\t\t\t} else {\n\t\t\t\treturnData = [{ json: bodyData }];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tworkflowData: [ctx.helpers.returnJsonArray(returnData)],\n\t\t\t\tnoWebhookResponse: true,\n\t\t\t};\n\t\t}\n\n\t\tif (req.contentType === 'multipart/form-data') {\n\t\t\treturnData = [await this.handleFormData(ctx)];\n\t\t\treturn {\n\t\t\t\twebhookResponse,\n\t\t\t\tworkflowData: [returnData],\n\t\t\t};\n\t\t} else {\n\t\t\treturnData = [{ json: bodyData }];\n\t\t}\n\n\t\treturn {\n\t\t\twebhookResponse,\n\t\t\tworkflowData: [ctx.helpers.returnJsonArray(returnData)],\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAiB;AACjB,0BAOO;AAYP,uBAA6B;AAC7B,8BAA6B;AAC7B,uBAA2B;AAC3B,mBAAqD;AAErD,MAAM,+BAA+B;AACrC,MAAM,yBAA0C;AAAA,EAC/C,aAAa;AAAA,E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;AAC5C,aAAO;AAAA,QACN;AAAA,QACA,cAAc,CAAC,UAAU;AAAA,MAC1B;AAAA,IACD,OAAO;AACN,mBAAa,CAAC,EAAE,MAAM,SAAS,CAAC;AAAA,IACjC;AAEA,WAAO;AAAA,MACN;AAAA,MACA,cAAc,CAAC,IAAI,QAAQ,gBAAgB,UAAU,CAAC;AAAA,IACvD;AAAA,EACD;AACD;","names":["pick"]}
1
+ {"version":3,"sources":["../../../../nodes/trigger/ChatTrigger/ChatTrigger.node.ts"],"sourcesContent":["import type { BaseChatMemory } from '@langchain/community/memory/chat_memory';\nimport pick from 'lodash/pick';\nimport {\n\tNode,\n\tNodeConnectionTypes,\n\tNodeOperationError,\n\tassertParamIsBoolean,\n\tvalidateNodeParameters,\n\tassertParamIsString,\n} from 'n8n-workflow';\nimport type {\n\tIDataObject,\n\tIWebhookFunctions,\n\tIWebhookResponseData,\n\tINodeTypeDescription,\n\tMultiPartFormData,\n\tINodeExecutionData,\n\tIBinaryData,\n\tINodeProperties,\n} from 'n8n-workflow';\nimport * as a from 'node:assert';\n\nimport { cssVariables } from './constants';\nimport { validateAuth } from './GenericFunctions';\nimport { createPage } from './templates';\nimport { assertValidLoadPreviousSessionOption } from './types';\n\nconst CHAT_TRIGGER_PATH_IDENTIFIER = 'chat';\nconst allowFileUploadsOption: INodeProperties = {\n\tdisplayName: 'Allow File Uploads',\n\tname: 'allowFileUploads',\n\ttype: 'boolean',\n\tdefault: false,\n\tdescription: 'Whether to allow file uploads in the chat',\n};\nconst allowedFileMimeTypeOption: INodeProperties = {\n\tdisplayName: 'Allowed File Mime Types',\n\tname: 'allowedFilesMimeTypes',\n\ttype: 'string',\n\tdefault: '*',\n\tplaceholder: 'e.g. image/*, text/*, application/pdf',\n\tdescription:\n\t\t'Allowed file types for upload. Comma-separated list of <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\" target=\"_blank\">MIME types</a>.',\n};\n\nconst respondToWebhookResponseMode = {\n\tname: \"Using 'Respond to Webhook' Node\",\n\tvalue: 'responseNode',\n\tdescription: 'Response defined in that node',\n};\n\nconst lastNodeResponseMode = {\n\tname: 'When Last Node Finishes',\n\tvalue: 'lastNode',\n\tdescription: 'Returns data of the last-executed node',\n};\n\nconst streamingResponseMode = {\n\tname: 'Streaming',\n\tvalue: 'streaming',\n\tdescription: 'Streaming response from specified nodes (e.g. Agents)',\n};\n\nconst respondNodesResponseMode = {\n\tname: 'Using Response Nodes',\n\tvalue: 'responseNodes',\n\tdescription:\n\t\t\"Send responses to the chat by using 'Respond to Chat' or 'Respond to Webhook' nodes\",\n};\n\nconst commonOptionsFields: INodeProperties[] = [\n\t// CORS parameters are only valid for when chat is used in hosted or webhook mode\n\t{\n\t\tdisplayName: 'Allowed Origins (CORS)',\n\t\tname: 'allowedOrigins',\n\t\ttype: 'string',\n\t\tdefault: '*',\n\t\tdescription:\n\t\t\t'Comma-separated list of URLs allowed for cross-origin non-preflight requests. Use * (default) to allow all origins.',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat', 'webhook'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\t...allowFileUploadsOption,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\t...allowedFileMimeTypeOption,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Input Placeholder',\n\t\tname: 'inputPlaceholder',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: 'Type your question..',\n\t\tplaceholder: 'e.g. Type your message here',\n\t\tdescription: 'Shown as placeholder text in the chat input field',\n\t},\n\t{\n\t\tdisplayName: 'Load Previous Session',\n\t\tname: 'loadPreviousSession',\n\t\ttype: 'options',\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Off',\n\t\t\t\tvalue: 'notSupported',\n\t\t\t\tdescription: 'Loading messages of previous session is turned off',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'From Memory',\n\t\t\t\tvalue: 'memory',\n\t\t\t\tdescription: 'Load session messages from memory',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Manually',\n\t\t\t\tvalue: 'manually',\n\t\t\t\tdescription: 'Manually return messages of session',\n\t\t\t},\n\t\t],\n\t\tdefault: 'notSupported',\n\t\tdescription: 'If loading messages of a previous session should be enabled',\n\t},\n\t{\n\t\tdisplayName: 'Require Button Click to Start Chat',\n\t\tname: 'showWelcomeScreen',\n\t\ttype: 'boolean',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: false,\n\t\tdescription: 'Whether to show the welcome screen at the start of the chat',\n\t},\n\t{\n\t\tdisplayName: 'Start Conversation Button Text',\n\t\tname: 'getStarted',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tshowWelcomeScreen: [true],\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: 'New Conversation',\n\t\tplaceholder: 'e.g. New Conversation',\n\t\tdescription: 'Shown as part of the welcome screen, in the middle of the chat window',\n\t},\n\t{\n\t\tdisplayName: 'Subtitle',\n\t\tname: 'subtitle',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: \"Start a chat. We're here to help you 24/7.\",\n\t\tplaceholder: \"e.g. We're here for you\",\n\t\tdescription: 'Shown at the top of the chat, under the title',\n\t},\n\t{\n\t\tdisplayName: 'Title',\n\t\tname: 'title',\n\t\ttype: 'string',\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: 'Hi there! 👋',\n\t\tplaceholder: 'e.g. Welcome',\n\t\tdescription: 'Shown at the top of the chat',\n\t},\n\t{\n\t\tdisplayName: 'Custom Chat Styling',\n\t\tname: 'customCss',\n\t\ttype: 'string',\n\t\ttypeOptions: {\n\t\t\trows: 10,\n\t\t\teditor: 'cssEditor',\n\t\t},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\t'/mode': ['hostedChat'],\n\t\t\t},\n\t\t},\n\t\tdefault: `\n${cssVariables}\n\n/* You can override any class styles, too. Right-click inspect in Chat UI to find class to override. */\n.chat-message {\n\tmax-width: 50%;\n}\n`.trim(),\n\t\tdescription: 'Override default styling of the public chat interface with CSS',\n\t},\n];\n\nexport class ChatTrigger extends Node {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Chat Trigger',\n\t\tname: 'chatTrigger',\n\t\ticon: 'fa:comments',\n\t\ticonColor: 'black',\n\t\tgroup: ['trigger'],\n\t\tversion: [1, 1.1, 1.2, 1.3, 1.4],\n\t\tdefaultVersion: 1.4,\n\t\tdescription: 'Runs the workflow when an n8n generated webchat is submitted',\n\t\tdefaults: {\n\t\t\tname: 'When chat message received',\n\t\t},\n\t\tcodex: {\n\t\t\tcategories: ['Core Nodes'],\n\t\t\tresources: {\n\t\t\t\tprimaryDocumentation: [\n\t\t\t\t\t{\n\t\t\t\t\t\turl: 'https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.chattrigger/',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\tmaxNodes: 1,\n\t\tinputs: `={{ (() => {\n\t\t\tif (!['hostedChat', 'webhook'].includes($parameter.mode)) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tif ($parameter.options?.loadPreviousSession !== 'memory') {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Memory',\n\t\t\t\t\tmaxConnections: 1,\n\t\t\t\t\ttype: '${NodeConnectionTypes.AiMemory}',\n\t\t\t\t\trequired: true,\n\t\t\t\t}\n\t\t\t];\n\t\t })() }}`,\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed\n\t\t\t\tname: 'httpBasicAuth',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tauthentication: ['basicAuth'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\twebhooks: [\n\t\t\t{\n\t\t\t\tname: 'setup',\n\t\t\t\thttpMethod: 'GET',\n\t\t\t\tresponseMode: 'onReceived',\n\t\t\t\tpath: CHAT_TRIGGER_PATH_IDENTIFIER,\n\t\t\t\tndvHideUrl: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'default',\n\t\t\t\thttpMethod: 'POST',\n\t\t\t\tresponseMode: '={{$parameter.options?.[\"responseMode\"] || \"lastNode\" }}',\n\t\t\t\tpath: CHAT_TRIGGER_PATH_IDENTIFIER,\n\t\t\t\tndvHideMethod: true,\n\t\t\t\tndvHideUrl: '={{ !$parameter.public }}',\n\t\t\t},\n\t\t],\n\t\teventTriggerDescription: 'Waiting for you to submit the chat',\n\t\tactivationMessage: 'You can now make calls to your production chat URL.',\n\t\ttriggerPanel: false,\n\t\tproperties: [\n\t\t\t/**\n\t\t\t * @note If we change this property, also update it in ChatEmbedModal.vue\n\t\t\t */\n\t\t\t{\n\t\t\t\tdisplayName: 'Make Chat Publicly Available',\n\t\t\t\tname: 'public',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tdescription:\n\t\t\t\t\t'Whether the chat should be publicly available or only accessible through the manual chat interface',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Mode',\n\t\t\t\tname: 'mode',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Hosted Chat',\n\t\t\t\t\t\tvalue: 'hostedChat',\n\t\t\t\t\t\tdescription: 'Chat on a page served by n8n',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Embedded Chat',\n\t\t\t\t\t\tvalue: 'webhook',\n\t\t\t\t\t\tdescription: 'Chat through a widget embedded in another page, or by calling a webhook',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'hostedChat',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Chat will be live at the URL above once you activate this workflow. Live executions will show up in the ‘executions’ tab',\n\t\t\t\tname: 'hostedChatNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Follow the instructions <a href=\"https://www.npmjs.com/package/@n8n/chat\" target=\"_blank\">here</a> to embed chat in a webpage (or just call the webhook URL at the top of this section). Chat will be live once you activate this workflow',\n\t\t\t\tname: 'embeddedChatNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['webhook'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Authentication',\n\t\t\t\tname: 'authentication',\n\t\t\t\ttype: 'options',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Basic Auth',\n\t\t\t\t\t\tvalue: 'basicAuth',\n\t\t\t\t\t\tdescription: 'Simple username and password (the same one for all users)',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\t\t\tname: 'n8n User Auth',\n\t\t\t\t\t\tvalue: 'n8nUserAuth',\n\t\t\t\t\t\tdescription: 'Require user to be logged in with their n8n account',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'None',\n\t\t\t\t\t\tvalue: 'none',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'none',\n\t\t\t\tdescription: 'The way to authenticate',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Initial Message(s)',\n\t\t\t\tname: 'initialMessages',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 3,\n\t\t\t\t},\n\t\t\t\tdefault: 'Hi there! 👋\\nMy name is Nathan. How can I assist you today?',\n\t\t\t\tdescription: 'Default messages shown at the start of the chat, one per line',\n\t\t\t},\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased\n\t\t\t\tdisplayName: 'Make Available in n8n Chat',\n\t\t\t\tname: 'availableInChat',\n\t\t\t\ttype: 'boolean',\n\t\t\t\tdefault: false,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'Whether to make the agent available in n8n Chat',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.4 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Agent Name',\n\t\t\t\tname: 'agentName',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'The name of the agent on n8n Chat',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tavailableInChat: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Agent Description',\n\t\t\t\tname: 'agentDescription',\n\t\t\t\ttype: 'string',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 2,\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdescription: 'The description of the agent on n8n Chat',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tavailableInChat: [true],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tpublic: [false],\n\t\t\t\t\t\t'@version': [1, 1.1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [allowFileUploadsOption, allowedFileMimeTypeOption],\n\t\t\t},\n\t\t\t// Options for versions 1.0 and 1.1 (without streaming)\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat', 'webhook'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t\t'@version': [1, 1.1],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t...commonOptionsFields,\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, respondToWebhookResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the webhook',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t// Options for version 1.2 (with streaming)\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat', 'webhook'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t\t'@version': [1.2],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t...commonOptionsFields,\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, respondToWebhookResponseMode, streamingResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the webhook',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tpublic: [false],\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.3 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\tallowFileUploadsOption,\n\t\t\t\t\tallowedFileMimeTypeOption,\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, respondNodesResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the chat',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\tmode: ['hostedChat', 'webhook'],\n\t\t\t\t\t\tpublic: [true],\n\t\t\t\t\t\t'@version': [{ _cnd: { gte: 1.3 } }],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t...commonOptionsFields,\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, streamingResponseMode, respondToWebhookResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the chat',\n\t\t\t\t\t\tdisplayOptions: { show: { '/mode': ['webhook'] } },\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Mode',\n\t\t\t\t\t\tname: 'responseMode',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [lastNodeResponseMode, streamingResponseMode, respondNodesResponseMode],\n\t\t\t\t\t\tdefault: 'lastNode',\n\t\t\t\t\t\tdescription: 'When and how to respond to the webhook',\n\t\t\t\t\t\tdisplayOptions: { show: { '/mode': ['hostedChat'] } },\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tprivate async handleFormData(context: IWebhookFunctions) {\n\t\tconst req = context.getRequestObject() as MultiPartFormData.Request;\n\t\ta.ok(req.contentType === 'multipart/form-data', 'Expected multipart/form-data');\n\t\tconst options = context.getNodeParameter('options', {}) as IDataObject;\n\t\tconst { data, files } = req.body;\n\n\t\tconst returnItem: INodeExecutionData = {\n\t\t\tjson: data,\n\t\t};\n\n\t\tif (files && Object.keys(files).length) {\n\t\t\treturnItem.json.files = [] as Array<Omit<IBinaryData, 'data'>>;\n\t\t\treturnItem.binary = {};\n\n\t\t\tconst count = 0;\n\t\t\tfor (const fileKey of Object.keys(files)) {\n\t\t\t\tconst processedFiles: MultiPartFormData.File[] = [];\n\t\t\t\tif (Array.isArray(files[fileKey])) {\n\t\t\t\t\tprocessedFiles.push(...files[fileKey]);\n\t\t\t\t} else {\n\t\t\t\t\tprocessedFiles.push(files[fileKey]);\n\t\t\t\t}\n\n\t\t\t\tlet fileIndex = 0;\n\t\t\t\tfor (const file of processedFiles) {\n\t\t\t\t\tlet binaryPropertyName = 'data';\n\n\t\t\t\t\t// Remove the '[]' suffix from the binaryPropertyName if it exists\n\t\t\t\t\tif (binaryPropertyName.endsWith('[]')) {\n\t\t\t\t\t\tbinaryPropertyName = binaryPropertyName.slice(0, -2);\n\t\t\t\t\t}\n\t\t\t\t\tif (options.binaryPropertyName) {\n\t\t\t\t\t\tbinaryPropertyName = `${options.binaryPropertyName.toString()}${count}`;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst binaryFile = await context.nodeHelpers.copyBinaryFile(\n\t\t\t\t\t\tfile.filepath,\n\t\t\t\t\t\tfile.originalFilename ?? file.newFilename,\n\t\t\t\t\t\tfile.mimetype,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst binaryKey = `${binaryPropertyName}${fileIndex}`;\n\n\t\t\t\t\tconst binaryInfo = {\n\t\t\t\t\t\t...pick(binaryFile, ['fileName', 'fileSize', 'fileType', 'mimeType', 'fileExtension']),\n\t\t\t\t\t\tbinaryKey,\n\t\t\t\t\t};\n\n\t\t\t\t\treturnItem.binary = Object.assign(returnItem.binary ?? {}, {\n\t\t\t\t\t\t[`${binaryKey}`]: binaryFile,\n\t\t\t\t\t});\n\t\t\t\t\treturnItem.json.files = [\n\t\t\t\t\t\t...(returnItem.json.files as Array<Omit<IBinaryData, 'data'>>),\n\t\t\t\t\t\tbinaryInfo,\n\t\t\t\t\t];\n\t\t\t\t\tfileIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn returnItem;\n\t}\n\n\tasync webhook(ctx: IWebhookFunctions): Promise<IWebhookResponseData> {\n\t\tconst res = ctx.getResponseObject();\n\n\t\tconst isPublic = ctx.getNodeParameter('public', false);\n\t\tassertParamIsBoolean('public', isPublic, ctx.getNode());\n\n\t\tconst nodeMode = ctx.getNodeParameter('mode', 'hostedChat');\n\t\tassertParamIsString('mode', nodeMode, ctx.getNode());\n\n\t\tif (!isPublic) {\n\t\t\tres.status(404).end();\n\t\t\treturn {\n\t\t\t\tnoWebhookResponse: true,\n\t\t\t};\n\t\t}\n\n\t\tconst options = ctx.getNodeParameter('options', {});\n\t\tvalidateNodeParameters(\n\t\t\toptions,\n\t\t\t{\n\t\t\t\tgetStarted: { type: 'string' },\n\t\t\t\tinputPlaceholder: { type: 'string' },\n\t\t\t\tloadPreviousSession: { type: 'string' },\n\t\t\t\tshowWelcomeScreen: { type: 'boolean' },\n\t\t\t\tsubtitle: { type: 'string' },\n\t\t\t\ttitle: { type: 'string' },\n\t\t\t\tallowFileUploads: { type: 'boolean' },\n\t\t\t\tallowedFilesMimeTypes: { type: 'string' },\n\t\t\t\tcustomCss: { type: 'string' },\n\t\t\t\tresponseMode: { type: 'string' },\n\t\t\t},\n\t\t\tctx.getNode(),\n\t\t);\n\n\t\tconst loadPreviousSession = options.loadPreviousSession;\n\t\tassertValidLoadPreviousSessionOption(loadPreviousSession, ctx.getNode());\n\n\t\tconst enableStreaming = options.responseMode === 'streaming';\n\n\t\tconst req = ctx.getRequestObject();\n\t\tconst webhookName = ctx.getWebhookName();\n\t\tconst mode = ctx.getMode() === 'manual' ? 'test' : 'production';\n\t\tconst bodyData = ctx.getBodyData() ?? {};\n\n\t\ttry {\n\t\t\tawait validateAuth(ctx);\n\t\t} catch (error) {\n\t\t\tif (error) {\n\t\t\t\tres.writeHead((error as IDataObject).responseCode as number, {\n\t\t\t\t\t'www-authenticate': 'Basic realm=\"Webhook\"',\n\t\t\t\t});\n\t\t\t\tres.end((error as IDataObject).message as string);\n\t\t\t\treturn { noWebhookResponse: true };\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tif (nodeMode === 'hostedChat') {\n\t\t\t// Show the chat on GET request\n\t\t\tif (webhookName === 'setup') {\n\t\t\t\tconst webhookUrlRaw = ctx.getNodeWebhookUrl('default');\n\t\t\t\tif (!webhookUrlRaw) {\n\t\t\t\t\tthrow new NodeOperationError(ctx.getNode(), 'Default webhook url not set');\n\t\t\t\t}\n\n\t\t\t\tconst webhookUrl =\n\t\t\t\t\tmode === 'test' ? webhookUrlRaw.replace('/webhook', '/webhook-test') : webhookUrlRaw;\n\t\t\t\tconst authentication = ctx.getNodeParameter('authentication') as\n\t\t\t\t\t| 'none'\n\t\t\t\t\t| 'basicAuth'\n\t\t\t\t\t| 'n8nUserAuth';\n\t\t\t\tconst initialMessagesRaw = ctx.getNodeParameter('initialMessages', '');\n\t\t\t\tassertParamIsString('initialMessage', initialMessagesRaw, ctx.getNode());\n\t\t\t\tconst instanceId = ctx.getInstanceId();\n\n\t\t\t\tconst i18nConfig: Record<string, string> = {};\n\t\t\t\tconst keys = ['getStarted', 'inputPlaceholder', 'subtitle', 'title'] as const;\n\t\t\t\tfor (const key of keys) {\n\t\t\t\t\tif (options[key] !== undefined) {\n\t\t\t\t\t\ti18nConfig[key] = options[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst page = createPage({\n\t\t\t\t\ti18n: {\n\t\t\t\t\t\ten: i18nConfig,\n\t\t\t\t\t},\n\t\t\t\t\tshowWelcomeScreen: options.showWelcomeScreen,\n\t\t\t\t\tloadPreviousSession,\n\t\t\t\t\tinitialMessages: initialMessagesRaw,\n\t\t\t\t\twebhookUrl,\n\t\t\t\t\tmode,\n\t\t\t\t\tinstanceId,\n\t\t\t\t\tauthentication,\n\t\t\t\t\tallowFileUploads: options.allowFileUploads,\n\t\t\t\t\tallowedFilesMimeTypes: options.allowedFilesMimeTypes,\n\t\t\t\t\tcustomCss: options.customCss,\n\t\t\t\t\tenableStreaming,\n\t\t\t\t});\n\n\t\t\t\tres.status(200).send(page).end();\n\t\t\t\treturn {\n\t\t\t\t\tnoWebhookResponse: true,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif (bodyData.action === 'loadPreviousSession') {\n\t\t\tif (options?.loadPreviousSession === 'memory') {\n\t\t\t\tconst memory = (await ctx.getInputConnectionData(NodeConnectionTypes.AiMemory, 0)) as\n\t\t\t\t\t| BaseChatMemory\n\t\t\t\t\t| undefined;\n\t\t\t\tconst messages = ((await memory?.chatHistory.getMessages()) ?? [])\n\t\t\t\t\t.filter((message) => !message?.additional_kwargs?.hideFromUI)\n\t\t\t\t\t.map((message) => message?.toJSON());\n\t\t\t\treturn {\n\t\t\t\t\twebhookResponse: { data: messages },\n\t\t\t\t};\n\t\t\t} else if (!options?.loadPreviousSession || options?.loadPreviousSession === 'notSupported') {\n\t\t\t\t// If messages of a previous session should not be loaded, simply return an empty array\n\t\t\t\treturn {\n\t\t\t\t\twebhookResponse: { data: [] },\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tlet returnData: INodeExecutionData[];\n\t\tconst webhookResponse: IDataObject = { status: 200 };\n\n\t\t// Handle streaming responses\n\t\tif (enableStreaming) {\n\t\t\t// Set up streaming response headers\n\t\t\tres.writeHead(200, {\n\t\t\t\t'Content-Type': 'application/json; charset=utf-8',\n\t\t\t\t'Transfer-Encoding': 'chunked',\n\t\t\t\t'Cache-Control': 'no-cache',\n\t\t\t\tConnection: 'keep-alive',\n\t\t\t});\n\n\t\t\t// Flush headers immediately\n\t\t\tres.flushHeaders();\n\n\t\t\tif (req.contentType === 'multipart/form-data') {\n\t\t\t\treturnData = [await this.handleFormData(ctx)];\n\t\t\t} else {\n\t\t\t\treturnData = [{ json: bodyData }];\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tworkflowData: [ctx.helpers.returnJsonArray(returnData)],\n\t\t\t\tnoWebhookResponse: true,\n\t\t\t};\n\t\t}\n\n\t\tif (req.contentType === 'multipart/form-data') {\n\t\t\treturnData = [await this.handleFormData(ctx)];\n\t\t\treturn {\n\t\t\t\twebhookResponse,\n\t\t\t\tworkflowData: [returnData],\n\t\t\t};\n\t\t} else {\n\t\t\treturnData = [{ json: bodyData }];\n\t\t}\n\n\t\treturn {\n\t\t\twebhookResponse,\n\t\t\tworkflowData: [ctx.helpers.returnJsonArray(returnData)],\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAiB;AACjB,0BAOO;AAWP,QAAmB;AAEnB,uBAA6B;AAC7B,8BAA6B;AAC7B,uBAA2B;AAC3B,mBAAqD;AAErD,MAAM,+BAA+B;AACrC,MAAM,yBAA0C;AAAA,EAC/C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AACd;AACA,MAAM,4BAA6C;AAAA,EAClD,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,aACC;AACF;AAEA,MAAM,+BAA+B;AAAA,EACpC,MAAM;AAAA,EACN,OAAO;AA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gBAAgB,UAAU,CAAC;AAAA,IACvD;AAAA,EACD;AACD;","names":["pick"]}
@@ -0,0 +1,340 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var VectorStoreAzureAISearch_node_exports = {};
20
+ __export(VectorStoreAzureAISearch_node_exports, {
21
+ AZURE_AI_SEARCH_CREDENTIALS: () => AZURE_AI_SEARCH_CREDENTIALS,
22
+ FILTER: () => FILTER,
23
+ INDEX_NAME: () => INDEX_NAME,
24
+ QUERY_TYPE: () => QUERY_TYPE,
25
+ SEMANTIC_CONFIGURATION: () => SEMANTIC_CONFIGURATION,
26
+ VectorStoreAzureAISearch: () => VectorStoreAzureAISearch,
27
+ getIndexName: () => getIndexName
28
+ });
29
+ module.exports = __toCommonJS(VectorStoreAzureAISearch_node_exports);
30
+ var import_azure_aisearch = require("@langchain/community/vectorstores/azure_aisearch");
31
+ var import_search_documents = require("@azure/search-documents");
32
+ var import_n8n_workflow = require("n8n-workflow");
33
+ var import_createVectorStoreNode = require("../shared/createVectorStoreNode/createVectorStoreNode");
34
+ const USER_AGENT_PREFIX = "n8n-azure-ai-search";
35
+ const AZURE_AI_SEARCH_CREDENTIALS = "azureAiSearchApi";
36
+ const INDEX_NAME = "indexName";
37
+ const QUERY_TYPE = "queryType";
38
+ const FILTER = "filter";
39
+ const SEMANTIC_CONFIGURATION = "semanticConfiguration";
40
+ const indexNameField = {
41
+ displayName: "Index Name",
42
+ name: INDEX_NAME,
43
+ type: "string",
44
+ default: "n8n-vectorstore",
45
+ description: "The name of the Azure AI Search index. Will be created automatically if it does not exist.",
46
+ required: true
47
+ };
48
+ const queryTypeField = {
49
+ displayName: "Query Type",
50
+ name: QUERY_TYPE,
51
+ type: "options",
52
+ default: "hybrid",
53
+ description: "The type of search query to perform",
54
+ options: [
55
+ {
56
+ name: "Vector",
57
+ value: "vector",
58
+ description: "Vector similarity search only"
59
+ },
60
+ {
61
+ name: "Hybrid",
62
+ value: "hybrid",
63
+ description: "Combines vector and keyword search (recommended)"
64
+ },
65
+ {
66
+ name: "Semantic Hybrid",
67
+ value: "semanticHybrid",
68
+ description: "Hybrid search with semantic ranking (requires Basic tier or higher)"
69
+ }
70
+ ]
71
+ };
72
+ const filterField = {
73
+ displayName: "Filter",
74
+ name: FILTER,
75
+ type: "string",
76
+ default: "",
77
+ description: 'Filter results using OData syntax. Use metadata/fieldName for metadata fields. <a href="https://learn.microsoft.com/en-us/azure/search/search-query-odata-filter" target="_blank">Learn more</a>.',
78
+ placeholder: "metadata/category eq 'technology' and metadata/author eq 'John'"
79
+ };
80
+ const semanticConfigurationField = {
81
+ displayName: "Semantic Configuration",
82
+ name: SEMANTIC_CONFIGURATION,
83
+ type: "string",
84
+ default: "",
85
+ description: "Name of the semantic configuration for semantic ranking (optional)",
86
+ displayOptions: {
87
+ show: {
88
+ [QUERY_TYPE]: ["semanticHybrid"]
89
+ }
90
+ }
91
+ };
92
+ const sharedFields = [indexNameField];
93
+ const retrieveFields = [
94
+ {
95
+ displayName: "Options",
96
+ name: "options",
97
+ type: "collection",
98
+ placeholder: "Add Option",
99
+ default: {},
100
+ options: [queryTypeField, filterField, semanticConfigurationField]
101
+ }
102
+ ];
103
+ const insertFields = [];
104
+ function isExecutionContext(context) {
105
+ return "addInputData" in context;
106
+ }
107
+ function getParameter(key, context, itemIndex) {
108
+ let value;
109
+ if (isExecutionContext(context)) {
110
+ value = context.getNodeParameter(key, itemIndex, "", { extractValue: true });
111
+ } else {
112
+ value = context.getNodeParameter(key, "", { extractValue: true });
113
+ }
114
+ if (typeof value !== "string") {
115
+ throw new import_n8n_workflow.NodeOperationError(context.getNode(), `Parameter ${key} must be a string`);
116
+ }
117
+ return value;
118
+ }
119
+ const getIndexName = getParameter.bind(null, INDEX_NAME);
120
+ function getOptionValue(name, context, itemIndex, defaultValue) {
121
+ const options = context.getNodeParameter("options", itemIndex, {});
122
+ return options[name] !== void 0 ? options[name] : defaultValue;
123
+ }
124
+ async function getAzureAISearchClient(context, embeddings, itemIndex) {
125
+ const credentials = await context.getCredentials(AZURE_AI_SEARCH_CREDENTIALS);
126
+ try {
127
+ const indexName = getIndexName(context, itemIndex);
128
+ if (!credentials.endpoint || typeof credentials.endpoint !== "string") {
129
+ throw new import_n8n_workflow.NodeOperationError(
130
+ context.getNode(),
131
+ "Azure AI Search endpoint is missing or invalid",
132
+ { itemIndex }
133
+ );
134
+ }
135
+ const endpoint = credentials.endpoint;
136
+ if (!credentials.apiKey || typeof credentials.apiKey !== "string") {
137
+ throw new import_n8n_workflow.NodeOperationError(context.getNode(), "API Key is required for authentication", {
138
+ itemIndex
139
+ });
140
+ }
141
+ const azureCredentials = new import_search_documents.AzureKeyCredential(credentials.apiKey);
142
+ const config = {
143
+ endpoint,
144
+ indexName,
145
+ credentials: azureCredentials,
146
+ search: {},
147
+ // Add custom user agent for usage tracking
148
+ clientOptions: {
149
+ userAgentOptions: { userAgentPrefix: USER_AGENT_PREFIX }
150
+ }
151
+ };
152
+ if (isExecutionContext(context)) {
153
+ const queryType = getQueryType(context, itemIndex);
154
+ const semanticConfiguration = getOptionValue(
155
+ "semanticConfiguration",
156
+ context,
157
+ itemIndex
158
+ );
159
+ const filter = getOptionValue("filter", context, itemIndex);
160
+ config.search.type = queryType;
161
+ if (filter) {
162
+ config.search.filter = filter;
163
+ }
164
+ if (queryType === import_azure_aisearch.AzureAISearchQueryType.SemanticHybrid && semanticConfiguration) {
165
+ config.search.semanticConfigurationName = semanticConfiguration;
166
+ }
167
+ }
168
+ return new import_azure_aisearch.AzureAISearchVectorStore(embeddings, config);
169
+ } catch (error) {
170
+ if (error instanceof import_n8n_workflow.NodeOperationError) {
171
+ throw error;
172
+ }
173
+ context.logger.debug("Azure AI Search connection error:", {
174
+ message: error instanceof Error ? error.message : String(error),
175
+ code: error.code,
176
+ statusCode: error.statusCode,
177
+ details: error.details
178
+ });
179
+ if (error.message?.includes("401") || error.message?.includes("Unauthorized") || error.message?.includes("authentication failed")) {
180
+ throw new import_n8n_workflow.NodeOperationError(
181
+ context.getNode(),
182
+ "Authentication failed - invalid API key or endpoint.",
183
+ {
184
+ itemIndex,
185
+ description: "Please verify your API Key and Search Endpoint are correct in the credentials configuration."
186
+ }
187
+ );
188
+ }
189
+ if (error.message?.includes("403") || error.message?.includes("Forbidden")) {
190
+ throw new import_n8n_workflow.NodeOperationError(
191
+ context.getNode(),
192
+ "Authorization failed - insufficient permissions.",
193
+ {
194
+ itemIndex,
195
+ description: "The API Key does not have sufficient permissions. Ensure the key has the required access level for this operation."
196
+ }
197
+ );
198
+ }
199
+ const errorMessage = error instanceof Error ? error.message : String(error);
200
+ throw new import_n8n_workflow.NodeOperationError(context.getNode(), `Error: ${errorMessage}`, {
201
+ itemIndex,
202
+ description: "Please check your Azure AI Search connection details"
203
+ });
204
+ }
205
+ }
206
+ function getQueryType(context, itemIndex) {
207
+ const queryType = getOptionValue("queryType", context, itemIndex, "hybrid");
208
+ switch (queryType) {
209
+ case "vector":
210
+ return import_azure_aisearch.AzureAISearchQueryType.Similarity;
211
+ case "hybrid":
212
+ return import_azure_aisearch.AzureAISearchQueryType.SimilarityHybrid;
213
+ case "semanticHybrid":
214
+ return import_azure_aisearch.AzureAISearchQueryType.SemanticHybrid;
215
+ default:
216
+ return import_azure_aisearch.AzureAISearchQueryType.SimilarityHybrid;
217
+ }
218
+ }
219
+ class VectorStoreAzureAISearch extends (0, import_createVectorStoreNode.createVectorStoreNode)({
220
+ meta: {
221
+ displayName: "Azure AI Search Vector Store",
222
+ name: "vectorStoreAzureAISearch",
223
+ description: "Work with your data in Azure AI Search Vector Store",
224
+ icon: { light: "file:azure-aisearch.svg", dark: "file:azure-aisearch.svg" },
225
+ docsUrl: "https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreazureaisearch/",
226
+ credentials: [
227
+ {
228
+ name: "azureAiSearchApi",
229
+ required: true
230
+ }
231
+ ],
232
+ operationModes: ["load", "insert", "retrieve", "update", "retrieve-as-tool"]
233
+ },
234
+ sharedFields,
235
+ retrieveFields,
236
+ loadFields: retrieveFields,
237
+ insertFields,
238
+ async getVectorStoreClient(context, _filter, embeddings, itemIndex) {
239
+ const vectorStore = await getAzureAISearchClient(context, embeddings, itemIndex);
240
+ if (isExecutionContext(context)) {
241
+ const filter = getOptionValue("filter", context, itemIndex);
242
+ if (filter) {
243
+ const filterObject = { filterExpression: filter };
244
+ const originalSearchVectorWithScore = vectorStore.similaritySearchVectorWithScore.bind(vectorStore);
245
+ vectorStore.similaritySearchVectorWithScore = async (query, k, additionalFilter) => {
246
+ const mergedFilter = additionalFilter ? { ...filterObject, ...additionalFilter } : filterObject;
247
+ return await originalSearchVectorWithScore(query, k, mergedFilter);
248
+ };
249
+ const originalSearch = vectorStore.similaritySearch.bind(vectorStore);
250
+ vectorStore.similaritySearch = async (query, k) => {
251
+ return await originalSearch(query, k, filterObject);
252
+ };
253
+ const originalSearchWithScore = vectorStore.similaritySearchWithScore.bind(vectorStore);
254
+ vectorStore.similaritySearchWithScore = async (query, k) => {
255
+ return await originalSearchWithScore(query, k, filterObject);
256
+ };
257
+ const originalAsRetriever = vectorStore.asRetriever.bind(vectorStore);
258
+ vectorStore.asRetriever = (kwargs) => {
259
+ return originalAsRetriever({
260
+ ...kwargs,
261
+ filter: filterObject
262
+ });
263
+ };
264
+ }
265
+ }
266
+ return vectorStore;
267
+ },
268
+ async populateVectorStore(context, embeddings, documents, itemIndex) {
269
+ try {
270
+ const vectorStore = await getAzureAISearchClient(context, embeddings, itemIndex);
271
+ await vectorStore.addDocuments(documents);
272
+ } catch (error) {
273
+ context.logger.debug("Azure AI Search error details:", {
274
+ message: error instanceof Error ? error.message : String(error),
275
+ code: error.code,
276
+ statusCode: error.statusCode,
277
+ details: error.details,
278
+ stack: error instanceof Error ? error.stack : void 0
279
+ });
280
+ if (error.message?.includes("401") || error.message?.includes("Unauthorized") || error.message?.includes("authentication failed")) {
281
+ throw new import_n8n_workflow.NodeOperationError(
282
+ context.getNode(),
283
+ "Authentication failed during document upload - invalid API key or endpoint.",
284
+ {
285
+ itemIndex,
286
+ description: "Please verify your API Key and Search Endpoint are correct in the credentials configuration."
287
+ }
288
+ );
289
+ }
290
+ if (error.message?.includes("403") || error.message?.includes("Forbidden") || error.statusCode === 403) {
291
+ throw new import_n8n_workflow.NodeOperationError(
292
+ context.getNode(),
293
+ "Authorization failed - insufficient permissions for document upload.",
294
+ {
295
+ itemIndex,
296
+ description: "The API Key does not have sufficient permissions for write operations. Ensure the key has the required access level."
297
+ }
298
+ );
299
+ }
300
+ if (error.name === "RestError" || error.message?.includes("RestError")) {
301
+ const statusCode = error.statusCode || "unknown";
302
+ const errorCode = error.code || "unknown";
303
+ const errorMessage2 = error instanceof Error ? error.message : String(error);
304
+ throw new import_n8n_workflow.NodeOperationError(
305
+ context.getNode(),
306
+ `Azure AI Search API error (${statusCode}): ${errorMessage2}`,
307
+ {
308
+ itemIndex,
309
+ description: `Error code: ${errorCode}
310
+
311
+ Common causes:
312
+ - Invalid endpoint URL
313
+ - Index doesn't exist
314
+ - Authentication/authorization issues
315
+ - API version mismatch
316
+
317
+ Check the console logs for detailed error information.`
318
+ }
319
+ );
320
+ }
321
+ const errorMessage = error instanceof Error ? error.message : String(error);
322
+ throw new import_n8n_workflow.NodeOperationError(context.getNode(), `Error: ${errorMessage}`, {
323
+ itemIndex,
324
+ description: "Please check your Azure AI Search connection details and index configuration"
325
+ });
326
+ }
327
+ }
328
+ }) {
329
+ }
330
+ // Annotate the CommonJS export names for ESM import in node:
331
+ 0 && (module.exports = {
332
+ AZURE_AI_SEARCH_CREDENTIALS,
333
+ FILTER,
334
+ INDEX_NAME,
335
+ QUERY_TYPE,
336
+ SEMANTIC_CONFIGURATION,
337
+ VectorStoreAzureAISearch,
338
+ getIndexName
339
+ });
340
+ //# sourceMappingURL=VectorStoreAzureAISearch.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/vector_store/VectorStoreAzureAISearch/VectorStoreAzureAISearch.node.ts"],"sourcesContent":["import type { EmbeddingsInterface } from '@langchain/core/embeddings';\nimport {\n\tAzureAISearchVectorStore,\n\tAzureAISearchQueryType,\n} from '@langchain/community/vectorstores/azure_aisearch';\nimport { AzureKeyCredential } from '@azure/search-documents';\nimport {\n\ttype IDataObject,\n\ttype ILoadOptionsFunctions,\n\tNodeOperationError,\n\ttype INodeProperties,\n\ttype IExecuteFunctions,\n\ttype ISupplyDataFunctions,\n} from 'n8n-workflow';\nimport { createVectorStoreNode } from '../shared/createVectorStoreNode/createVectorStoreNode';\n\n// User agent for usage tracking\nconst USER_AGENT_PREFIX = 'n8n-azure-ai-search';\n\nexport const AZURE_AI_SEARCH_CREDENTIALS = 'azureAiSearchApi';\nexport const INDEX_NAME = 'indexName';\nexport const QUERY_TYPE = 'queryType';\nexport const FILTER = 'filter';\nexport const SEMANTIC_CONFIGURATION = 'semanticConfiguration';\n\nconst indexNameField: INodeProperties = {\n\tdisplayName: 'Index Name',\n\tname: INDEX_NAME,\n\ttype: 'string',\n\tdefault: 'n8n-vectorstore',\n\tdescription:\n\t\t'The name of the Azure AI Search index. Will be created automatically if it does not exist.',\n\trequired: true,\n};\n\nconst queryTypeField: INodeProperties = {\n\tdisplayName: 'Query Type',\n\tname: QUERY_TYPE,\n\ttype: 'options',\n\tdefault: 'hybrid',\n\tdescription: 'The type of search query to perform',\n\toptions: [\n\t\t{\n\t\t\tname: 'Vector',\n\t\t\tvalue: 'vector',\n\t\t\tdescription: 'Vector similarity search only',\n\t\t},\n\t\t{\n\t\t\tname: 'Hybrid',\n\t\t\tvalue: 'hybrid',\n\t\t\tdescription: 'Combines vector and keyword search (recommended)',\n\t\t},\n\t\t{\n\t\t\tname: 'Semantic Hybrid',\n\t\t\tvalue: 'semanticHybrid',\n\t\t\tdescription: 'Hybrid search with semantic ranking (requires Basic tier or higher)',\n\t\t},\n\t],\n};\n\nconst filterField: INodeProperties = {\n\tdisplayName: 'Filter',\n\tname: FILTER,\n\ttype: 'string',\n\tdefault: '',\n\tdescription:\n\t\t'Filter results using OData syntax. Use metadata/fieldName for metadata fields. <a href=\"https://learn.microsoft.com/en-us/azure/search/search-query-odata-filter\" target=\"_blank\">Learn more</a>.',\n\tplaceholder: \"metadata/category eq 'technology' and metadata/author eq 'John'\",\n};\n\nconst semanticConfigurationField: INodeProperties = {\n\tdisplayName: 'Semantic Configuration',\n\tname: SEMANTIC_CONFIGURATION,\n\ttype: 'string',\n\tdefault: '',\n\tdescription: 'Name of the semantic configuration for semantic ranking (optional)',\n\tdisplayOptions: {\n\t\tshow: {\n\t\t\t[QUERY_TYPE]: ['semanticHybrid'],\n\t\t},\n\t},\n};\n\nconst sharedFields: INodeProperties[] = [indexNameField];\n\nconst retrieveFields: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Options',\n\t\tname: 'options',\n\t\ttype: 'collection',\n\t\tplaceholder: 'Add Option',\n\t\tdefault: {},\n\t\toptions: [queryTypeField, filterField, semanticConfigurationField],\n\t},\n];\n\nconst insertFields: INodeProperties[] = [];\n\ntype IFunctionsContext = IExecuteFunctions | ISupplyDataFunctions | ILoadOptionsFunctions;\n\nfunction isExecutionContext(\n\tcontext: IFunctionsContext,\n): context is IExecuteFunctions | ISupplyDataFunctions {\n\t// IExecuteFunctions and ISupplyDataFunctions have addInputData method\n\t// ILoadOptionsFunctions does not\n\treturn 'addInputData' in context;\n}\n\nfunction getParameter(key: string, context: IFunctionsContext, itemIndex: number): string {\n\tlet value: unknown;\n\n\tif (isExecutionContext(context)) {\n\t\t// Execution context: includes itemIndex parameter\n\t\tvalue = context.getNodeParameter(key, itemIndex, '', { extractValue: true });\n\t} else {\n\t\t// Load options context: no itemIndex parameter\n\t\tvalue = context.getNodeParameter(key, '', { extractValue: true });\n\t}\n\n\tif (typeof value !== 'string') {\n\t\tthrow new NodeOperationError(context.getNode(), `Parameter ${key} must be a string`);\n\t}\n\treturn value;\n}\n\nexport const getIndexName = getParameter.bind(null, INDEX_NAME);\n\nfunction getOptionValue<T>(\n\tname: string,\n\tcontext: IExecuteFunctions | ISupplyDataFunctions,\n\titemIndex: number,\n\tdefaultValue?: T,\n): T | undefined {\n\tconst options: IDataObject = context.getNodeParameter('options', itemIndex, {});\n\treturn options[name] !== undefined ? (options[name] as T) : defaultValue;\n}\n\nasync function getAzureAISearchClient(\n\tcontext: IFunctionsContext,\n\tembeddings: EmbeddingsInterface,\n\titemIndex: number,\n): Promise<AzureAISearchVectorStore> {\n\tconst credentials = await context.getCredentials(AZURE_AI_SEARCH_CREDENTIALS);\n\n\ttry {\n\t\tconst indexName = getIndexName(context, itemIndex);\n\n\t\tif (!credentials.endpoint || typeof credentials.endpoint !== 'string') {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Azure AI Search endpoint is missing or invalid',\n\t\t\t\t{ itemIndex },\n\t\t\t);\n\t\t}\n\t\tconst endpoint = credentials.endpoint;\n\n\t\t// Validate API Key\n\t\tif (!credentials.apiKey || typeof credentials.apiKey !== 'string') {\n\t\t\tthrow new NodeOperationError(context.getNode(), 'API Key is required for authentication', {\n\t\t\t\titemIndex,\n\t\t\t});\n\t\t}\n\n\t\tconst azureCredentials = new AzureKeyCredential(credentials.apiKey);\n\n\t\t// Pass endpoint, indexName, and credentials to enable automatic index creation\n\t\t// LangChain will create the index automatically if it doesn't exist\n\t\tconst config: any = {\n\t\t\tendpoint,\n\t\t\tindexName,\n\t\t\tcredentials: azureCredentials,\n\t\t\tsearch: {},\n\t\t\t// Add custom user agent for usage tracking\n\t\t\tclientOptions: {\n\t\t\t\tuserAgentOptions: { userAgentPrefix: USER_AGENT_PREFIX },\n\t\t\t},\n\t\t};\n\n\t\t// Set search configuration options only for execution contexts\n\t\tif (isExecutionContext(context)) {\n\t\t\tconst queryType = getQueryType(context, itemIndex);\n\t\t\tconst semanticConfiguration = getOptionValue<string>(\n\t\t\t\t'semanticConfiguration',\n\t\t\t\tcontext,\n\t\t\t\titemIndex,\n\t\t\t);\n\t\t\tconst filter = getOptionValue<string>('filter', context, itemIndex);\n\n\t\t\tconfig.search.type = queryType;\n\n\t\t\tif (filter) {\n\t\t\t\tconfig.search.filter = filter;\n\t\t\t}\n\n\t\t\tif (queryType === AzureAISearchQueryType.SemanticHybrid && semanticConfiguration) {\n\t\t\t\tconfig.search.semanticConfigurationName = semanticConfiguration;\n\t\t\t}\n\t\t}\n\n\t\treturn new AzureAISearchVectorStore(embeddings, config);\n\t} catch (error) {\n\t\tif (error instanceof NodeOperationError) {\n\t\t\tthrow error;\n\t\t}\n\n\t\t// Log the full error for debugging\n\t\tcontext.logger.debug('Azure AI Search connection error:', {\n\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\tcode: (error as any).code,\n\t\t\tstatusCode: (error as any).statusCode,\n\t\t\tdetails: (error as any).details,\n\t\t});\n\n\t\t// Check for authentication errors\n\t\tif (\n\t\t\terror.message?.includes('401') ||\n\t\t\terror.message?.includes('Unauthorized') ||\n\t\t\terror.message?.includes('authentication failed')\n\t\t) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Authentication failed - invalid API key or endpoint.',\n\t\t\t\t{\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Please verify your API Key and Search Endpoint are correct in the credentials configuration.',\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// Check for authorization errors (403)\n\t\tif (error.message?.includes('403') || error.message?.includes('Forbidden')) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tcontext.getNode(),\n\t\t\t\t'Authorization failed - insufficient permissions.',\n\t\t\t\t{\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'The API Key does not have sufficient permissions. Ensure the key has the required access level for this operation.',\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\tthrow new NodeOperationError(context.getNode(), `Error: ${errorMessage}`, {\n\t\t\titemIndex,\n\t\t\tdescription: 'Please check your Azure AI Search connection details',\n\t\t});\n\t}\n}\n\nfunction getQueryType(\n\tcontext: IExecuteFunctions | ISupplyDataFunctions,\n\titemIndex: number,\n): AzureAISearchQueryType {\n\tconst queryType = getOptionValue<string>('queryType', context, itemIndex, 'hybrid');\n\n\tswitch (queryType) {\n\t\tcase 'vector':\n\t\t\treturn AzureAISearchQueryType.Similarity;\n\t\tcase 'hybrid':\n\t\t\treturn AzureAISearchQueryType.SimilarityHybrid;\n\t\tcase 'semanticHybrid':\n\t\t\treturn AzureAISearchQueryType.SemanticHybrid;\n\t\tdefault:\n\t\t\treturn AzureAISearchQueryType.SimilarityHybrid;\n\t}\n}\n\nexport class VectorStoreAzureAISearch extends createVectorStoreNode({\n\tmeta: {\n\t\tdisplayName: 'Azure AI Search Vector Store',\n\t\tname: 'vectorStoreAzureAISearch',\n\t\tdescription: 'Work with your data in Azure AI Search Vector Store',\n\t\ticon: { light: 'file:azure-aisearch.svg', dark: 'file:azure-aisearch.svg' },\n\t\tdocsUrl:\n\t\t\t'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreazureaisearch/',\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'azureAiSearchApi',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\toperationModes: ['load', 'insert', 'retrieve', 'update', 'retrieve-as-tool'],\n\t},\n\tsharedFields,\n\tretrieveFields,\n\tloadFields: retrieveFields,\n\tinsertFields,\n\tasync getVectorStoreClient(context, _filter, embeddings, itemIndex) {\n\t\tconst vectorStore = await getAzureAISearchClient(context, embeddings, itemIndex);\n\n\t\t// Apply OData filter to search methods if specified in options\n\t\tif (isExecutionContext(context)) {\n\t\t\tconst filter = getOptionValue<string>('filter', context, itemIndex);\n\n\t\t\tif (filter) {\n\t\t\t\t// Per LangChain docs, pass filter as 3rd parameter with filterExpression\n\t\t\t\tconst filterObject = { filterExpression: filter };\n\n\t\t\t\t// Override similaritySearchVectorWithScore - this is the method called by n8n base node\n\t\t\t\tconst originalSearchVectorWithScore =\n\t\t\t\t\tvectorStore.similaritySearchVectorWithScore.bind(vectorStore);\n\t\t\t\tvectorStore.similaritySearchVectorWithScore = async (\n\t\t\t\t\tquery: number[],\n\t\t\t\t\tk: number,\n\t\t\t\t\tadditionalFilter?: any,\n\t\t\t\t) => {\n\t\t\t\t\t// Merge our OData filter with any additional filter passed by the caller\n\t\t\t\t\tconst mergedFilter = additionalFilter\n\t\t\t\t\t\t? { ...filterObject, ...additionalFilter }\n\t\t\t\t\t\t: filterObject;\n\t\t\t\t\treturn await originalSearchVectorWithScore(query, k, mergedFilter);\n\t\t\t\t};\n\n\t\t\t\t// Override similaritySearch to pass filter as 3rd parameter\n\t\t\t\tconst originalSearch = vectorStore.similaritySearch.bind(vectorStore);\n\t\t\t\tvectorStore.similaritySearch = async (query: string, k?: number) => {\n\t\t\t\t\treturn await originalSearch(query, k, filterObject);\n\t\t\t\t};\n\n\t\t\t\t// Override similaritySearchWithScore to pass filter as 3rd parameter\n\t\t\t\tconst originalSearchWithScore = vectorStore.similaritySearchWithScore.bind(vectorStore);\n\t\t\t\tvectorStore.similaritySearchWithScore = async (query: string, k?: number) => {\n\t\t\t\t\treturn await originalSearchWithScore(query, k, filterObject);\n\t\t\t\t};\n\n\t\t\t\t// Override asRetriever to inject filter into retriever options\n\t\t\t\tconst originalAsRetriever = vectorStore.asRetriever.bind(vectorStore);\n\t\t\t\tvectorStore.asRetriever = (kwargs?: any) => {\n\t\t\t\t\treturn originalAsRetriever({\n\t\t\t\t\t\t...kwargs,\n\t\t\t\t\t\tfilter: filterObject,\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\treturn vectorStore;\n\t},\n\tasync populateVectorStore(context, embeddings, documents, itemIndex) {\n\t\ttry {\n\t\t\tconst vectorStore = await getAzureAISearchClient(context, embeddings, itemIndex);\n\n\t\t\t// Add documents to Azure AI Search (framework handles batching)\n\t\t\tawait vectorStore.addDocuments(documents);\n\t\t} catch (error) {\n\t\t\t// Log the full error for debugging\n\t\t\tcontext.logger.debug('Azure AI Search error details:', {\n\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t\tcode: (error as any).code,\n\t\t\t\tstatusCode: (error as any).statusCode,\n\t\t\t\tdetails: (error as any).details,\n\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t});\n\n\t\t\t// Check for authentication errors\n\t\t\tif (\n\t\t\t\terror.message?.includes('401') ||\n\t\t\t\terror.message?.includes('Unauthorized') ||\n\t\t\t\terror.message?.includes('authentication failed')\n\t\t\t) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tcontext.getNode(),\n\t\t\t\t\t'Authentication failed during document upload - invalid API key or endpoint.',\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Please verify your API Key and Search Endpoint are correct in the credentials configuration.',\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Check for authorization errors\n\t\t\tif (\n\t\t\t\terror.message?.includes('403') ||\n\t\t\t\terror.message?.includes('Forbidden') ||\n\t\t\t\t(error as any).statusCode === 403\n\t\t\t) {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tcontext.getNode(),\n\t\t\t\t\t'Authorization failed - insufficient permissions for document upload.',\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'The API Key does not have sufficient permissions for write operations. Ensure the key has the required access level.',\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Check for RestError (common Azure SDK error)\n\t\t\tif ((error as any).name === 'RestError' || error.message?.includes('RestError')) {\n\t\t\t\tconst statusCode = (error as any).statusCode || 'unknown';\n\t\t\t\tconst errorCode = (error as any).code || 'unknown';\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tcontext.getNode(),\n\t\t\t\t\t`Azure AI Search API error (${statusCode}): ${errorMessage}`,\n\t\t\t\t\t{\n\t\t\t\t\t\titemIndex,\n\t\t\t\t\t\tdescription: `Error code: ${errorCode}\\n\\nCommon causes:\\n- Invalid endpoint URL\\n- Index doesn't exist\\n- Authentication/authorization issues\\n- API version mismatch\\n\\nCheck the console logs for detailed error information.`,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\tthrow new NodeOperationError(context.getNode(), `Error: ${errorMessage}`, {\n\t\t\t\titemIndex,\n\t\t\t\tdescription: 'Please check your Azure AI Search connection details and index configuration',\n\t\t\t});\n\t\t}\n\t},\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,4BAGO;AACP,8BAAmC;AACnC,0BAOO;AACP,mCAAsC;AAGtC,MAAM,oBAAoB;AAEnB,MAAM,8BAA8B;AACpC,MAAM,aAAa;AACnB,MAAM,aAAa;AACnB,MAAM,SAAS;AACf,MAAM,yBAAyB;AAEtC,MAAM,iBAAk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AAQ;AACzC,cAAMA,gBAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC1E,cAAM,IAAI;AAAA,UACT,QAAQ,QAAQ;AAAA,UAChB,8BAA8B,UAAU,MAAMA,aAAY;AAAA,UAC1D;AAAA,YACC;AAAA,YACA,aAAa,eAAe,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UACtC;AAAA,QACD;AAAA,MACD;AAEA,YAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC1E,YAAM,IAAI,uCAAmB,QAAQ,QAAQ,GAAG,UAAU,YAAY,IAAI;AAAA,QACzE;AAAA,QACA,aAAa;AAAA,MACd,CAAC;AAAA,IACF;AAAA,EACD;AACD,CAAC,EAAE;AAAC;","names":["errorMessage"]}
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18"><defs><linearGradient id="a" x1="9" y1=".36" x2="9" y2="18.31" gradientUnits="userSpaceOnUse"><stop offset=".18" stop-color="#5ea0ef"/><stop offset="1" stop-color="#0078d4"/></linearGradient></defs><path d="M18 11.32a4.12 4.12 0 00-3.51-4 5.15 5.15 0 00-5.25-5 5.25 5.25 0 00-5 3.49A4.86 4.86 0 000 10.59a5 5 0 005.07 4.82h8.65a.78.78 0 00.22 0A4.13 4.13 0 0018 11.32z" fill="url(#a)"/><path d="M12.33 6.59a3.07 3.07 0 00-5.61.85 3.16 3.16 0 00.33 2.27l-2.34 2.37a.79.79 0 000 1.12.78.78 0 00.56.23.76.76 0 00.56-.23l2.33-2.36a3.14 3.14 0 00.81.33 3.08 3.08 0 003.36-4.58zm-.54 2.1a2.16 2.16 0 01-2.09 1.65 1.79 1.79 0 01-.51-.07 1.87 1.87 0 01-.7-.32 2.13 2.13 0 01-.56-.56 2.17 2.17 0 01-.31-1.73A2.14 2.14 0 019.7 6a2.31 2.31 0 01.52.06 2.18 2.18 0 011.32 1 2.13 2.13 0 01.25 1.63z" fill="#f2f2f2"/><ellipse cx="9.69" cy="8.18" rx="2.15" ry="2.16" fill="#83b9f9"/></svg>
@@ -1,5 +1,6 @@
1
1
  [
2
2
  {"name":"anthropicApi","displayName":"Anthropic","documentationUrl":"anthropic","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"string","default":"https://api.anthropic.com","description":"Override the default base URL for the API"},{"displayName":"Add Custom Header","name":"header","type":"boolean","default":false},{"displayName":"Header Name","name":"headerName","type":"string","displayOptions":{"show":{"header":[true]}},"default":""},{"displayName":"Header Value","name":"headerValue","type":"string","typeOptions":{"password":true},"displayOptions":{"show":{"header":[true]}},"default":""}],"test":{"request":{"baseURL":"={{$credentials?.url}}","url":"/v1/messages","method":"POST","headers":{"anthropic-version":"2023-06-01"},"body":{"model":"claude-3-haiku-20240307","messages":[{"role":"user","content":"Hey"}],"max_tokens":1}}},"supportedNodes":["anthropic","lmChatAnthropic"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vendors/Anthropic/anthropic.svg","authenticate":{}},
3
+ {"name":"azureAiSearchApi","displayName":"Azure AI Search API","documentationUrl":"azureaisearch","properties":[{"displayName":"Search Endpoint","name":"endpoint","type":"string","required":true,"default":"","placeholder":"https://your-search-service.search.windows.net"},{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""}],"authenticate":{},"test":{"request":{"baseURL":"={{$credentials.endpoint}}/indexes","url":"","method":"GET","headers":{"accept":"application/json"},"qs":{"api-version":"2024-07-01"}}},"supportedNodes":["vectorStoreAzureAISearch"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreAzureAISearch/azure-aisearch.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/vector_store/VectorStoreAzureAISearch/azure-aisearch.svg"}},
3
4
  {"name":"azureOpenAiApi","displayName":"Azure Open AI","documentationUrl":"azureopenai","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Resource Name","name":"resourceName","type":"string","required":true,"default":""},{"displayName":"API Version","name":"apiVersion","type":"string","required":true,"default":"2025-03-01-preview"},{"displayName":"Endpoint","name":"endpoint","type":"string","placeholder":"https://westeurope.api.cognitive.microsoft.com"}],"authenticate":{"type":"generic","properties":{"headers":{"api-key":"={{$credentials.apiKey}}"}}},"supportedNodes":["embeddingsAzureOpenAi","lmChatAzureOpenAi"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsAzureOpenAi/azure.svg"},
4
5
  {"name":"azureEntraCognitiveServicesOAuth2Api","displayName":"Azure Entra ID (Azure Active Directory) API","extends":["oAuth2Api"],"documentationUrl":"azureentracognitiveservicesoauth2api","properties":[{"displayName":"Grant Type","name":"grantType","type":"hidden","default":"authorizationCode"},{"displayName":"Resource Name","name":"resourceName","type":"string","required":true,"default":""},{"displayName":"API Version","name":"apiVersion","type":"string","required":true,"default":"2025-03-01-preview"},{"displayName":"Endpoint","name":"endpoint","type":"string","placeholder":"https://westeurope.api.cognitive.microsoft.com"},{"displayName":"Tenant ID","name":"tenantId","type":"string","default":"common","description":"Enter your Azure Tenant ID (Directory ID) or keep \"common\" for multi-tenant apps. Using a specific Tenant ID is generally recommended and required for certain authentication flows.","placeholder":"e.g., xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or common"},{"displayName":"Authorization URL","name":"authUrl","type":"hidden","default":"=https://login.microsoftonline.com/{{$self[\"tenantId\"]}}/oauth2/authorize"},{"displayName":"Access Token URL","name":"accessTokenUrl","type":"hidden","default":"=https://login.microsoftonline.com/{{$self[\"tenantId\"]}}/oauth2/token"},{"displayName":"Additional Body Properties","name":"additionalBodyProperties","type":"hidden","default":"{\"grant_type\": \"client_credentials\", \"resource\": \"https://cognitiveservices.azure.com/\"}"},{"displayName":"Authentication","name":"authentication","type":"hidden","default":"body"},{"displayName":"Custom Scopes","name":"customScopes","type":"boolean","default":false,"description":"Define custom scopes. You might need this if the default scopes are not sufficient or if you want to minimize permissions. Ensure you include \"openid\" and \"offline_access\"."},{"displayName":"Auth URI Query Parameters","name":"authQueryParameters","type":"hidden","default":"","description":"For some services additional query parameters have to be set which can be defined here","placeholder":""},{"displayName":"Enabled Scopes","name":"enabledScopes","type":"string","displayOptions":{"show":{"customScopes":[true]}},"default":"openid offline_access","placeholder":"openid offline_access","description":"Space-separated list of scopes to request."},{"displayName":"Scope","name":"scope","type":"hidden","default":"={{ $self.customScopes ? $self.enabledScopes : \"openid offline_access\"}}"}],"supportedNodes":["lmChatAzureOpenAi"],"iconUrl":"icons/@n8n/n8n-nodes-langchain/dist/nodes/llms/LmChatAzureOpenAi/azure.svg"},
5
6
  {"name":"cohereApi","displayName":"CohereApi","documentationUrl":"cohere","properties":[{"displayName":"API Key","name":"apiKey","type":"string","typeOptions":{"password":true},"required":true,"default":""},{"displayName":"Base URL","name":"url","type":"hidden","default":"https://api.cohere.ai"}],"authenticate":{"type":"generic","properties":{"headers":{"Authorization":"=Bearer {{$credentials.apiKey}}"}}},"test":{"request":{"baseURL":"={{ $credentials.url }}","url":"/v1/models?page_size=1"}},"supportedNodes":["embeddingsCohere","lmChatCohere","lmCohere","rerankerCohere"],"iconUrl":{"light":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsCohere/cohere.svg","dark":"icons/@n8n/n8n-nodes-langchain/dist/nodes/embeddings/EmbeddingsCohere/cohere.dark.svg"}},