@n8n/n8n-nodes-langchain 0.2.0 → 0.3.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.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/known/credentials.json +2 -0
- package/dist/known/nodes.json +28 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.js +7 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/description.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js +2 -0
- package/dist/nodes/agents/Agent/agents/ConversationalAgent/execute.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.js +7 -0
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/description.js.map +1 -1
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js +2 -0
- package/dist/nodes/agents/Agent/agents/OpenAiFunctionsAgent/execute.js.map +1 -1
- package/dist/nodes/chains/ChainLLM/ChainLlm.node.js +84 -11
- package/dist/nodes/chains/ChainLLM/ChainLlm.node.js.map +1 -1
- package/dist/nodes/chains/ChainSummarization/ChainSummarization.node.js +1 -1
- package/dist/nodes/chains/ChainSummarization/ChainSummarization.node.js.map +1 -1
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.d.ts +3 -0
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js +19 -0
- package/dist/nodes/document_loaders/DocumentBinaryInputLoader/DocumentBinaryInputLoader.node.js.map +1 -1
- package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js +16 -0
- package/dist/nodes/document_loaders/DocumentJSONInputLoader/DocumentJsonInputLoader.node.js.map +1 -1
- package/dist/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.d.ts +5 -0
- package/dist/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.js +120 -0
- package/dist/nodes/embeddings/EmbeddingsAwsBedrock/EmbeddingsAwsBedrock.node.js.map +1 -0
- package/dist/nodes/embeddings/EmbeddingsAwsBedrock/bedrock.svg +18 -0
- package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js +19 -0
- package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/EmbeddingsHuggingFaceInference.node.js.map +1 -1
- package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/HuggingFaceEmbeddings.d.ts +19 -0
- package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/HuggingFaceEmbeddings.js +32 -0
- package/dist/nodes/embeddings/EmbeddingsHuggingFaceInference/HuggingFaceEmbeddings.js.map +1 -0
- package/dist/nodes/llms/LMOpenHuggingFaceInference/HuggingFaceInferenceEndpoints.d.ts +31 -0
- package/dist/nodes/llms/LMOpenHuggingFaceInference/HuggingFaceInferenceEndpoints.js +90 -0
- package/dist/nodes/llms/LMOpenHuggingFaceInference/HuggingFaceInferenceEndpoints.js.map +1 -0
- package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js +7 -0
- package/dist/nodes/llms/LMOpenHuggingFaceInference/LmOpenHuggingFaceInference.node.js.map +1 -1
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.d.ts +5 -0
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js +147 -0
- package/dist/nodes/llms/LmChatAwsBedrock/LmChatAwsBedrock.node.js.map +1 -0
- package/dist/nodes/llms/LmChatAwsBedrock/bedrock.svg +18 -0
- package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js +43 -8
- package/dist/nodes/output_parser/OutputParserStructured/OutputParserStructured.node.js.map +1 -1
- package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.js +4 -0
- package/dist/nodes/tools/ToolWorkflow/ToolWorkflow.node.js.map +1 -1
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.d.ts +5 -0
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js +189 -0
- package/dist/nodes/trigger/ChatTrigger/ChatTrigger.node.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/GenericFunctions.d.ts +2 -0
- package/dist/nodes/trigger/ChatTrigger/GenericFunctions.js +51 -0
- package/dist/nodes/trigger/ChatTrigger/GenericFunctions.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/error.d.ts +4 -0
- package/dist/nodes/trigger/ChatTrigger/error.js +20 -0
- package/dist/nodes/trigger/ChatTrigger/error.js.map +1 -0
- package/dist/nodes/trigger/ChatTrigger/templates.d.ts +10 -0
- package/dist/nodes/trigger/ChatTrigger/templates.js +55 -0
- package/dist/nodes/trigger/ChatTrigger/templates.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.d.ts +7 -0
- package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js +55 -0
- package/dist/nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js +9 -8
- package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js.map +1 -1
- package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js +2 -1
- package/dist/nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.js.map +1 -1
- package/dist/nodes/vector_store/VectorStorePinecone/VectorStorePinecone.node.d.ts +7 -0
- package/dist/nodes/vector_store/VectorStorePinecone/VectorStorePinecone.node.js +115 -0
- package/dist/nodes/vector_store/VectorStorePinecone/VectorStorePinecone.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStorePinecone/pinecone.svg +1 -0
- package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js +4 -4
- package/dist/nodes/vector_store/VectorStorePineconeInsert/VectorStorePineconeInsert.node.js.map +1 -1
- package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js +16 -4
- package/dist/nodes/vector_store/VectorStorePineconeLoad/VectorStorePineconeLoad.node.js.map +1 -1
- package/dist/nodes/vector_store/VectorStoreSupabase/VectorStoreSupabase.node.d.ts +7 -0
- package/dist/nodes/vector_store/VectorStoreSupabase/VectorStoreSupabase.node.js +99 -0
- package/dist/nodes/vector_store/VectorStoreSupabase/VectorStoreSupabase.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreSupabase/supabase.svg +15 -0
- package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js +2 -1
- package/dist/nodes/vector_store/VectorStoreSupabaseInsert/VectorStoreSupabaseInsert.node.js.map +1 -1
- package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js +8 -16
- package/dist/nodes/vector_store/VectorStoreSupabaseLoad/VectorStoreSupabaseLoad.node.js.map +1 -1
- package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.d.ts +7 -0
- package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.js +98 -0
- package/dist/nodes/vector_store/VectorStoreZep/VectorStoreZep.node.js.map +1 -0
- package/dist/nodes/vector_store/VectorStoreZep/zep.png +0 -0
- package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js +3 -2
- package/dist/nodes/vector_store/VectorStoreZepInsert/VectorStoreZepInsert.node.js.map +1 -1
- package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js +5 -0
- package/dist/nodes/vector_store/VectorStoreZepLoad/VectorStoreZepLoad.node.js.map +1 -1
- package/dist/nodes/vector_store/shared/createVectorStoreNode.d.ts +29 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode.js +182 -0
- package/dist/nodes/vector_store/shared/createVectorStoreNode.js.map +1 -0
- package/dist/nodes/vector_store/shared/processDocuments.d.ts +14 -1
- package/dist/nodes/vector_store/shared/processDocuments.js +22 -2
- package/dist/nodes/vector_store/shared/processDocuments.js.map +1 -1
- package/dist/types/nodes.json +20 -14
- package/dist/utils/N8nBinaryLoader.d.ts +2 -1
- package/dist/utils/N8nBinaryLoader.js +76 -60
- package/dist/utils/N8nBinaryLoader.js.map +1 -1
- package/dist/utils/N8nJsonLoader.d.ts +2 -1
- package/dist/utils/N8nJsonLoader.js +27 -13
- package/dist/utils/N8nJsonLoader.js.map +1 -1
- package/dist/utils/helpers.d.ts +2 -0
- package/dist/utils/helpers.js +12 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/logWrapper.js +18 -1
- package/dist/utils/logWrapper.js.map +1 -1
- package/dist/utils/sharedFields.d.ts +2 -0
- package/dist/utils/sharedFields.js +36 -0
- package/dist/utils/sharedFields.js.map +1 -0
- package/package.json +18 -13
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatTrigger = void 0;
|
|
4
|
+
const templates_1 = require("./templates");
|
|
5
|
+
const GenericFunctions_1 = require("./GenericFunctions");
|
|
6
|
+
const CHAT_TRIGGER_PATH_IDENTIFIER = 'chat';
|
|
7
|
+
class ChatTrigger {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.description = {
|
|
10
|
+
displayName: 'Chat Trigger',
|
|
11
|
+
name: 'chatTrigger',
|
|
12
|
+
icon: 'fa:comments',
|
|
13
|
+
group: ['trigger'],
|
|
14
|
+
version: 1,
|
|
15
|
+
description: 'Runs the flow when an n8n generated webchat is submitted',
|
|
16
|
+
defaults: {
|
|
17
|
+
name: 'Chat Trigger',
|
|
18
|
+
},
|
|
19
|
+
inputs: [],
|
|
20
|
+
outputs: ['main'],
|
|
21
|
+
credentials: [
|
|
22
|
+
{
|
|
23
|
+
name: 'httpBasicAuth',
|
|
24
|
+
required: true,
|
|
25
|
+
displayOptions: {
|
|
26
|
+
show: {
|
|
27
|
+
authentication: ['basicAuth'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
webhooks: [
|
|
33
|
+
{
|
|
34
|
+
name: 'setup',
|
|
35
|
+
httpMethod: 'GET',
|
|
36
|
+
responseMode: 'onReceived',
|
|
37
|
+
path: CHAT_TRIGGER_PATH_IDENTIFIER,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'default',
|
|
41
|
+
httpMethod: 'POST',
|
|
42
|
+
responseMode: 'responseNode',
|
|
43
|
+
path: CHAT_TRIGGER_PATH_IDENTIFIER,
|
|
44
|
+
ndvHideMethod: true,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
eventTriggerDescription: 'Waiting for you to submit the chat',
|
|
48
|
+
activationMessage: 'You can now make calls to your production Chat URL.',
|
|
49
|
+
triggerPanel: {
|
|
50
|
+
header: 'Pull in a test chat submission',
|
|
51
|
+
executionsHelp: {
|
|
52
|
+
inactive: "Chat Trigger have two modes: test and production. <br /> <br /> <b>Use test mode while you build your workflow</b>. Click the 'Test Step' button, then fill out the test chat that opens in a popup tab. The executions will show up in the editor.<br /> <br /> <b>Use production mode to run your workflow automatically</b>. <a data-key=\"activate\">Activate</a> the workflow, then make requests to the production URL. Then every time there's a chat submission via the Production Chat URL, the workflow will execute. These executions will show up in the executions list, but not in the editor.",
|
|
53
|
+
active: "Chat Trigger have two modes: test and production. <br /> <br /> <b>Use test mode while you build your workflow</b>. Click the 'Test Step' button, then fill out the test chat that opens in a popup tab. The executions will show up in the editor.<br /> <br /> <b>Use production mode to run your workflow automatically</b>. <a data-key=\"activate\">Activate</a> the workflow, then make requests to the production URL. Then every time there's a chat submission via the Production Chat URL, the workflow will execute. These executions will show up in the executions list, but not in the editor.",
|
|
54
|
+
},
|
|
55
|
+
activationHint: '<a data-key="activate">Activate</a> this workflow to have it also run automatically for new chat messages created via the Production URL.',
|
|
56
|
+
},
|
|
57
|
+
properties: [
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Authentication',
|
|
60
|
+
name: 'authentication',
|
|
61
|
+
type: 'options',
|
|
62
|
+
options: [
|
|
63
|
+
{
|
|
64
|
+
name: 'Basic Auth',
|
|
65
|
+
value: 'basicAuth',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'Header Auth',
|
|
69
|
+
value: 'headerAuth',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'None',
|
|
73
|
+
value: 'none',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
default: 'none',
|
|
77
|
+
description: 'The way to authenticate',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Initial Messages',
|
|
81
|
+
name: 'initialMessages',
|
|
82
|
+
type: 'string',
|
|
83
|
+
typeOptions: {
|
|
84
|
+
rows: 3,
|
|
85
|
+
},
|
|
86
|
+
placeholder: 'Add Message',
|
|
87
|
+
default: '',
|
|
88
|
+
description: 'Default messages shown at the start of the chat, one per line',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
displayName: 'Options',
|
|
92
|
+
name: 'options',
|
|
93
|
+
type: 'collection',
|
|
94
|
+
placeholder: 'Add Field',
|
|
95
|
+
default: {},
|
|
96
|
+
options: [
|
|
97
|
+
{
|
|
98
|
+
displayName: 'Get Started',
|
|
99
|
+
name: 'getStarted',
|
|
100
|
+
type: 'string',
|
|
101
|
+
default: 'New Conversation',
|
|
102
|
+
placeholder: 'e.g. New Conversation',
|
|
103
|
+
description: 'Shown at the start of the chat, in the middle of the chat window',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
displayName: 'Input Placeholder',
|
|
107
|
+
name: 'inputPlaceholder',
|
|
108
|
+
type: 'string',
|
|
109
|
+
default: 'Type your question..',
|
|
110
|
+
placeholder: 'e.g. Type your message here',
|
|
111
|
+
description: 'Shown as placeholder text in the chat input field',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
displayName: 'Subtitle',
|
|
115
|
+
name: 'subtitle',
|
|
116
|
+
type: 'string',
|
|
117
|
+
default: "Start a chat. We're here to help you 24/7.",
|
|
118
|
+
placeholder: "e.g. We're here for you",
|
|
119
|
+
description: 'Shown at the top of the chat, under the title',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
displayName: 'Title',
|
|
123
|
+
name: 'title',
|
|
124
|
+
type: 'string',
|
|
125
|
+
default: 'Hi there! 👋',
|
|
126
|
+
placeholder: 'e.g. Welcome',
|
|
127
|
+
description: 'Shown at the top of the chat',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
async webhook() {
|
|
135
|
+
var _a;
|
|
136
|
+
const webhookName = this.getWebhookName();
|
|
137
|
+
const mode = this.getMode() === 'manual' ? 'test' : 'production';
|
|
138
|
+
const res = this.getResponseObject();
|
|
139
|
+
try {
|
|
140
|
+
await (0, GenericFunctions_1.validateAuth)(this);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
if (error) {
|
|
144
|
+
res.writeHead(error.responseCode, { 'WWW-Authenticate': 'Basic realm="Webhook"' });
|
|
145
|
+
res.end(error.message);
|
|
146
|
+
return { noWebhookResponse: true };
|
|
147
|
+
}
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
if (webhookName === 'setup') {
|
|
151
|
+
const webhookUrlRaw = this.getNodeWebhookUrl('default');
|
|
152
|
+
const webhookUrl = mode === 'test' ? webhookUrlRaw.replace('/webhook', '/webhook-test') : webhookUrlRaw;
|
|
153
|
+
const authentication = this.getNodeParameter('authentication');
|
|
154
|
+
const options = this.getNodeParameter('options', {});
|
|
155
|
+
const initialMessagesRaw = this.getNodeParameter('initialMessages', '');
|
|
156
|
+
const initialMessages = initialMessagesRaw
|
|
157
|
+
.split('\n')
|
|
158
|
+
.filter((line) => line)
|
|
159
|
+
.map((line) => line.trim());
|
|
160
|
+
const instanceId = this.getInstanceId();
|
|
161
|
+
const page = (0, templates_1.createPage)({
|
|
162
|
+
i18n: {
|
|
163
|
+
en: options,
|
|
164
|
+
},
|
|
165
|
+
initialMessages,
|
|
166
|
+
webhookUrl,
|
|
167
|
+
mode,
|
|
168
|
+
instanceId,
|
|
169
|
+
authentication,
|
|
170
|
+
});
|
|
171
|
+
res.status(200).send(page).end();
|
|
172
|
+
return {
|
|
173
|
+
noWebhookResponse: true,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const bodyData = (_a = this.getBodyData()) !== null && _a !== void 0 ? _a : {};
|
|
177
|
+
const returnData = {};
|
|
178
|
+
returnData.sessionId = bodyData.sessionId;
|
|
179
|
+
returnData.action = bodyData.action;
|
|
180
|
+
returnData.message = bodyData.message;
|
|
181
|
+
const webhookResponse = { status: 200 };
|
|
182
|
+
return {
|
|
183
|
+
webhookResponse,
|
|
184
|
+
workflowData: [this.helpers.returnJsonArray(returnData)],
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
exports.ChatTrigger = ChatTrigger;
|
|
189
|
+
//# sourceMappingURL=ChatTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatTrigger.node.js","sourceRoot":"","sources":["../../../../nodes/trigger/ChatTrigger/ChatTrigger.node.ts"],"names":[],"mappings":";;;AAOA,2CAAyC;AACzC,yDAAkD;AAElD,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAE5C,MAAa,WAAW;IAAxB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,0DAA0D;YACvE,QAAQ,EAAE;gBACT,IAAI,EAAE,cAAc;aACpB;YACD,MAAM,EAAE,EAAE;YACV,OAAO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aACd,CAAC,CAAC;YAEH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;YACjC,OAAO;gBACN,iBAAiB,EAAE,IAAI;aACvB,CAAC;SACF;QAED,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,WAAW,EAAE,mCAAI,EAAE,CAAC;QAC1C,MAAM,UAAU,GAAgB,EAAE,CAAC;QACnC,UAAU,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QAC1C,UAAU,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QACpC,UAAU,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QAEtC,MAAM,eAAe,GAAgB,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;QACrD,OAAO;YACN,eAAe;YACf,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;SACxD,CAAC;IACH,CAAC;CACD;AAhMD,kCAgMC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateAuth = void 0;
|
|
7
|
+
const error_1 = require("./error");
|
|
8
|
+
const basic_auth_1 = __importDefault(require("basic-auth"));
|
|
9
|
+
async function validateAuth(context) {
|
|
10
|
+
const authentication = context.getNodeParameter('authentication');
|
|
11
|
+
const req = context.getRequestObject();
|
|
12
|
+
const headers = context.getHeaderData();
|
|
13
|
+
if (authentication === 'none') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
else if (authentication === 'basicAuth') {
|
|
17
|
+
let expectedAuth;
|
|
18
|
+
try {
|
|
19
|
+
expectedAuth = await context.getCredentials('httpBasicAuth');
|
|
20
|
+
}
|
|
21
|
+
catch { }
|
|
22
|
+
if (expectedAuth === undefined || !expectedAuth.user || !expectedAuth.password) {
|
|
23
|
+
throw new error_1.ChatTriggerAuthorizationError(500, 'No authentication data defined on node!');
|
|
24
|
+
}
|
|
25
|
+
const providedAuth = (0, basic_auth_1.default)(req);
|
|
26
|
+
if (!providedAuth)
|
|
27
|
+
throw new error_1.ChatTriggerAuthorizationError(401);
|
|
28
|
+
if (providedAuth.name !== expectedAuth.user || providedAuth.pass !== expectedAuth.password) {
|
|
29
|
+
throw new error_1.ChatTriggerAuthorizationError(403);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (authentication === 'headerAuth') {
|
|
33
|
+
const webhookName = context.getWebhookName();
|
|
34
|
+
function getCookie(name) {
|
|
35
|
+
var _a;
|
|
36
|
+
const value = `; ${headers.cookie}`;
|
|
37
|
+
const parts = value.split(`; ${name}=`);
|
|
38
|
+
if (parts.length === 2) {
|
|
39
|
+
return (_a = parts.pop()) === null || _a === void 0 ? void 0 : _a.split(';').shift();
|
|
40
|
+
}
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
const authCookie = getCookie('n8n-auth');
|
|
44
|
+
if (!authCookie && webhookName !== 'setup') {
|
|
45
|
+
throw new error_1.ChatTriggerAuthorizationError(500, 'User not authenticated!');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
exports.validateAuth = validateAuth;
|
|
51
|
+
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../../nodes/trigger/ChatTrigger/GenericFunctions.ts"],"names":[],"mappings":";;;;;;AACA,mCAAwD;AACxD,4DAAmC;AAE5B,KAAK,UAAU,YAAY,CAAC,OAA0B;IAC5D,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,gBAAgB,CAAW,CAAC;I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EAAE,CAAC;QACX,CAAC;QAED,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,IAAI,WAAW,KAAK,OAAO,EAAE;YAE3C,MAAM,IAAI,qCAA6B,CAAC,GAAG,EAAE,yBAAyB,CAAC,CAAC;SACxE;KACD;IAED,OAAO;AACR,CAAC;AAhDD,oCAgDC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatTriggerAuthorizationError = void 0;
|
|
4
|
+
class ChatTriggerAuthorizationError extends Error {
|
|
5
|
+
constructor(responseCode, message) {
|
|
6
|
+
if (message === undefined) {
|
|
7
|
+
message = 'Authorization problem!';
|
|
8
|
+
if (responseCode === 401) {
|
|
9
|
+
message = 'Authorization is required!';
|
|
10
|
+
}
|
|
11
|
+
else if (responseCode === 403) {
|
|
12
|
+
message = 'Authorization data is wrong!';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
super(message);
|
|
16
|
+
this.responseCode = responseCode;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ChatTriggerAuthorizationError = ChatTriggerAuthorizationError;
|
|
20
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../nodes/trigger/ChatTrigger/error.ts"],"names":[],"mappings":";;;AAAA,MAAa,6BAA8B,SAAQ,KAAK;IACvD,YACU,YAAoB,EAC7B,OAAgB;QAEhB,IAAI,OAAO,KAAK,SAAS,EAAE;YAC1B,OAAO,GAAG,wBAAwB,CAAC;YACnC,IAAI,YAAY,KAAK,GAAG,EAAE;gBACzB,OAAO,GAAG,4BAA4B,CAAC;aACvC;iBAAM,IAAI,YAAY,KAAK,GAAG,EAAE;gBAChC,OAAO,GAAG,8BAA8B,CAAC;aACzC;SACD;QACD,KAAK,CAAC,OAAO,CAAC,CAAC;QAXN,iBAAY,GAAZ,YAAY,CAAQ;IAY9B,CAAC;CACD;AAfD,sEAeC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function createPage({ instanceId, webhookUrl, i18n: { en }, initialMessages, authentication, }: {
|
|
2
|
+
instanceId: string;
|
|
3
|
+
webhookUrl?: string;
|
|
4
|
+
i18n: {
|
|
5
|
+
en: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
initialMessages: string[];
|
|
8
|
+
mode: 'test' | 'production';
|
|
9
|
+
authentication: 'none' | 'basicAuth' | 'headerAuth';
|
|
10
|
+
}): string;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPage = void 0;
|
|
4
|
+
function createPage({ instanceId, webhookUrl, i18n: { en }, initialMessages, authentication, }) {
|
|
5
|
+
return `<doctype html>
|
|
6
|
+
<html lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<meta charset="utf-8">
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
|
+
<title>Chat</title>
|
|
11
|
+
<link href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.min.css" rel="stylesheet" />
|
|
12
|
+
<link href="https://cdn.jsdelivr.net/npm/@n8n/chat/style.css" rel="stylesheet" />
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<script type="module">
|
|
16
|
+
import { createChat } from 'https://cdn.jsdelivr.net/npm/@n8n/chat/chat.bundle.es.js';
|
|
17
|
+
|
|
18
|
+
(async function () {
|
|
19
|
+
const authentication = '${authentication}';
|
|
20
|
+
if (authentication === 'headerAuth') {
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetch('/rest/login', {
|
|
23
|
+
method: 'GET'
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (response.status !== 200) {
|
|
27
|
+
throw new Error('Not logged in');
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
window.location.href = '/signin';
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
createChat({
|
|
36
|
+
mode: 'fullscreen',
|
|
37
|
+
webhookUrl: '${webhookUrl}',
|
|
38
|
+
webhookConfig: {
|
|
39
|
+
headers: {
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
'X-Instance-Id': '${instanceId}',
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
i18n: {
|
|
45
|
+
${en ? `en: ${JSON.stringify(en)},` : ''}
|
|
46
|
+
},
|
|
47
|
+
${initialMessages.length ? `initialMessages: ${JSON.stringify(initialMessages)},` : ''}
|
|
48
|
+
});
|
|
49
|
+
})();
|
|
50
|
+
</script>
|
|
51
|
+
</body>
|
|
52
|
+
</html>`;
|
|
53
|
+
}
|
|
54
|
+
exports.createPage = createPage;
|
|
55
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../../nodes/trigger/ChatTrigger/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAC,EAC1B,UAAU,EACV,UAAU,EACV,IAAI,EAAE,EAAE,EAAE,EAAE,EACZ,eAAe,EACf,cAAc,GAUd;IACA,OAAO;;;;;;;;;;;;;;+BAcuB,cAAc;;;;;;;;;;;;;;;;;;qBAkBxB,UAAU;;;;4BAIH,UAAU;;;;SAI7B,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;;QAEvC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;;;;;SAKnF,CAAC;AACV,CAAC;AAhED,gCAgEC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const VectorStoreInMemory: {
|
|
2
|
+
new (): {
|
|
3
|
+
description: import("n8n-workflow").INodeTypeDescription;
|
|
4
|
+
execute(this: import("n8n-workflow").IExecuteFunctions): Promise<import("n8n-workflow").INodeExecutionData[][]>;
|
|
5
|
+
supplyData(this: import("n8n-workflow").IExecuteFunctions, itemIndex: number): Promise<import("n8n-workflow").SupplyData>;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VectorStoreInMemory = void 0;
|
|
4
|
+
const createVectorStoreNode_1 = require("../shared/createVectorStoreNode");
|
|
5
|
+
const MemoryVectorStoreManager_1 = require("../shared/MemoryVectorStoreManager");
|
|
6
|
+
const insertFields = [
|
|
7
|
+
{
|
|
8
|
+
displayName: 'The embbded data are stored in the server memory, so they will be lost when the server is restarted. Additionally, if the amount of data is too large, it may cause the server to crash due to insufficient memory.',
|
|
9
|
+
name: 'notice',
|
|
10
|
+
type: 'notice',
|
|
11
|
+
default: '',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Clear Store',
|
|
15
|
+
name: 'clearStore',
|
|
16
|
+
type: 'boolean',
|
|
17
|
+
default: false,
|
|
18
|
+
description: 'Whether to clear the store before inserting new data',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
exports.VectorStoreInMemory = (0, createVectorStoreNode_1.createVectorStoreNode)({
|
|
22
|
+
meta: {
|
|
23
|
+
displayName: 'In-Memory Vector Store',
|
|
24
|
+
name: 'vectorStoreInMemory',
|
|
25
|
+
description: 'Work with your data in In-Memory Vector Store',
|
|
26
|
+
icon: 'fa:database',
|
|
27
|
+
docsUrl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemory/',
|
|
28
|
+
},
|
|
29
|
+
sharedFields: [
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Memory Key',
|
|
32
|
+
name: 'memoryKey',
|
|
33
|
+
type: 'string',
|
|
34
|
+
default: 'vector_store_key',
|
|
35
|
+
description: 'The key to use to store the vector memory in the workflow data. The key will be prefixed with the workflow ID to avoid collisions.',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
insertFields,
|
|
39
|
+
loadFields: [],
|
|
40
|
+
retrieveFields: [],
|
|
41
|
+
async getVectorStoreClient(context, _filter, embeddings, itemIndex) {
|
|
42
|
+
const workflowId = context.getWorkflow().id;
|
|
43
|
+
const memoryKey = context.getNodeParameter('memoryKey', itemIndex);
|
|
44
|
+
const vectorStoreSingleton = MemoryVectorStoreManager_1.MemoryVectorStoreManager.getInstance(embeddings);
|
|
45
|
+
return vectorStoreSingleton.getVectorStore(`${workflowId}__${memoryKey}`);
|
|
46
|
+
},
|
|
47
|
+
async populateVectorStore(context, embeddings, documents, itemIndex) {
|
|
48
|
+
const memoryKey = context.getNodeParameter('memoryKey', itemIndex);
|
|
49
|
+
const clearStore = context.getNodeParameter('clearStore', itemIndex);
|
|
50
|
+
const workflowId = context.getWorkflow().id;
|
|
51
|
+
const vectorStoreInstance = MemoryVectorStoreManager_1.MemoryVectorStoreManager.getInstance(embeddings);
|
|
52
|
+
void vectorStoreInstance.addDocuments(`${workflowId}__${memoryKey}`, documents, clearStore);
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=VectorStoreInMemory.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VectorStoreInMemory.node.js","sourceRoot":"","sources":["../../../../nodes/vector_store/VectorStoreInMemory/VectorStoreInMemory.node.ts"],"names":[],"mappings":";;;AACA,2EAAwE;AACxE,iFAA8E;AAE9E,MAAM,YAAY,GAAsB;IACvC;QACC,WAAW,EACV,qNAAqN;QACtN,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,E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AW,EAAE,CAAC,EAAE,CAAC;QAC5C,MAAM,mBAAmB,GAAG,mDAAwB,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAE7E,KAAK,mBAAmB,CAAC,YAAY,CAAC,GAAG,UAAU,KAAK,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAC7F,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -11,6 +11,7 @@ class VectorStoreInMemoryInsert {
|
|
|
11
11
|
icon: 'fa:database',
|
|
12
12
|
group: ['transform'],
|
|
13
13
|
version: 1,
|
|
14
|
+
hidden: true,
|
|
14
15
|
description: 'Insert data into an in-memory vector store',
|
|
15
16
|
defaults: {
|
|
16
17
|
name: 'In Memory Vector Store Insert',
|
|
@@ -23,7 +24,7 @@ class VectorStoreInMemoryInsert {
|
|
|
23
24
|
resources: {
|
|
24
25
|
primaryDocumentation: [
|
|
25
26
|
{
|
|
26
|
-
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/
|
|
27
|
+
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstoreinmemoryinsert/',
|
|
27
28
|
},
|
|
28
29
|
],
|
|
29
30
|
},
|
|
@@ -51,13 +52,6 @@ class VectorStoreInMemoryInsert {
|
|
|
51
52
|
type: 'notice',
|
|
52
53
|
default: '',
|
|
53
54
|
},
|
|
54
|
-
{
|
|
55
|
-
displayName: 'Memory Key',
|
|
56
|
-
name: 'memoryKey',
|
|
57
|
-
type: 'string',
|
|
58
|
-
default: 'vector_store_key',
|
|
59
|
-
description: 'The key to use to store the vector memory in the workflow data. The key will be prefixed with the workflow ID to avoid collisions.',
|
|
60
|
-
},
|
|
61
55
|
{
|
|
62
56
|
displayName: 'Clear Store',
|
|
63
57
|
name: 'clearStore',
|
|
@@ -65,6 +59,13 @@ class VectorStoreInMemoryInsert {
|
|
|
65
59
|
default: false,
|
|
66
60
|
description: 'Whether to clear the store before inserting new data',
|
|
67
61
|
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Memory Key',
|
|
64
|
+
name: 'memoryKey',
|
|
65
|
+
type: 'string',
|
|
66
|
+
default: 'vector_store_key',
|
|
67
|
+
description: 'The key to use to store the vector memory in the workflow data. The key will be prefixed with the workflow ID to avoid collisions.',
|
|
68
|
+
},
|
|
68
69
|
],
|
|
69
70
|
};
|
|
70
71
|
}
|
package/dist/nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorStoreInMemoryInsert.node.js","sourceRoot":"","sources":["../../../../nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.ts"],"names":[],"mappings":";;;AAWA,iEAA8D;AAC9D,iFAA8E;
|
|
1
|
+
{"version":3,"file":"VectorStoreInMemoryInsert.node.js","sourceRoot":"","sources":["../../../../nodes/vector_store/VectorStoreInMemoryInsert/VectorStoreInMemoryInsert.node.ts"],"names":[],"mappings":";;;AAWA,iEAA8D;AAC9D,iFAA8E;AAG9E,MAAa,yBAAyB;IAAtC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,+BAA+B;YAC5C,IAAI,EAAE,2BAA2B;YACjC,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE;gBACT,IAAI,EAAE,+BAA+B;aACrC;YACD,KAAK,EAAE;gBACN,UAAU,EAAE,CAAC,IAAI,CAAC;gBAClB,aAAa,EAAE;oBACd,EAAE,EAAE,CAAC,eAAe,CAAC;iBACrB;gBACD,SAAS,EAAE;oBACV,oBAAoB,EAAE;wBACrB;4BACC,GAAG,EAAE,kHAAkH;yBACvH;qBACD;iBACD;aACD;YAED,MAAM,EAAE;;gBAEP;oBACC,WAAW,EAAE,UAAU;oBACvB,cAAc,EAAE,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C,EAAE,CAAC;QAEzC,MAAM,mBAAmB,GAAG,mDAAwB,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC7E,MAAM,mBAAmB,CAAC,YAAY,CACrC,GAAG,UAAU,KAAK,SAAS,EAAE,EAC7B,kBAAkB,EAClB,UAAU,CACV,CAAC;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IACpD,CAAC;CACD;AAjGD,8DAiGC"}
|
|
@@ -11,6 +11,7 @@ class VectorStoreInMemoryLoad {
|
|
|
11
11
|
icon: 'fa:database',
|
|
12
12
|
group: ['transform'],
|
|
13
13
|
version: 1,
|
|
14
|
+
hidden: true,
|
|
14
15
|
description: 'Load embedded data from an in-memory vector store',
|
|
15
16
|
defaults: {
|
|
16
17
|
name: 'In Memory Vector Store Load',
|
|
@@ -23,7 +24,7 @@ class VectorStoreInMemoryLoad {
|
|
|
23
24
|
resources: {
|
|
24
25
|
primaryDocumentation: [
|
|
25
26
|
{
|
|
26
|
-
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.
|
|
27
|
+
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.vectorstoreinmemoryload/',
|
|
27
28
|
},
|
|
28
29
|
],
|
|
29
30
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorStoreInMemoryLoad.node.js","sourceRoot":"","sources":["../../../../nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.ts"],"names":[],"mappings":";;;AASA,iFAA8E;AAC9E,0DAAuD;
|
|
1
|
+
{"version":3,"file":"VectorStoreInMemoryLoad.node.js","sourceRoot":"","sources":["../../../../nodes/vector_store/VectorStoreInMemoryLoad/VectorStoreInMemoryLoad.node.ts"],"names":[],"mappings":";;;AASA,iFAA8E;AAC9E,0DAAuD;AAGvD,MAAa,uBAAuB;IAApC;QACC,gBAAW,GAAyB;YACnC,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,CACpE,GAAG,UAAU,KAAK,SAAS,EAAE,CAC7B,CAAC;QAEF,OAAO;YACN,QAAQ,EAAE,IAAA,uBAAU,EAAC,mBAAmB,EAAE,IAAI,CAAC;SAC/C,CAAC;IACH,CAAC;CACD;AAlED,0DAkEC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const VectorStorePinecone: {
|
|
2
|
+
new (): {
|
|
3
|
+
description: import("n8n-workflow").INodeTypeDescription;
|
|
4
|
+
execute(this: import("n8n-workflow").IExecuteFunctions): Promise<import("n8n-workflow").INodeExecutionData[][]>;
|
|
5
|
+
supplyData(this: import("n8n-workflow").IExecuteFunctions, itemIndex: number): Promise<import("n8n-workflow").SupplyData>;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VectorStorePinecone = void 0;
|
|
4
|
+
const pinecone_1 = require("langchain/vectorstores/pinecone");
|
|
5
|
+
const pinecone_2 = require("@pinecone-database/pinecone");
|
|
6
|
+
const createVectorStoreNode_1 = require("../shared/createVectorStoreNode");
|
|
7
|
+
const sharedFields_1 = require("../../../utils/sharedFields");
|
|
8
|
+
const sharedFields = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Pinecone Index',
|
|
11
|
+
name: 'pineconeIndex',
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: '',
|
|
14
|
+
required: true,
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
const retrieveFields = [
|
|
18
|
+
{
|
|
19
|
+
displayName: 'Options',
|
|
20
|
+
name: 'options',
|
|
21
|
+
type: 'collection',
|
|
22
|
+
placeholder: 'Add Option',
|
|
23
|
+
default: {},
|
|
24
|
+
options: [
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Pinecone Namespace',
|
|
27
|
+
name: 'pineconeNamespace',
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'Partition the records in an index into namespaces. Queries and other operations are then limited to one namespace, so different requests can search different subsets of your index.',
|
|
30
|
+
default: '',
|
|
31
|
+
},
|
|
32
|
+
sharedFields_1.metadataFilterField,
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
const insertFields = [
|
|
37
|
+
{
|
|
38
|
+
displayName: 'Options',
|
|
39
|
+
name: 'options',
|
|
40
|
+
type: 'collection',
|
|
41
|
+
placeholder: 'Add Option',
|
|
42
|
+
default: {},
|
|
43
|
+
options: [
|
|
44
|
+
{
|
|
45
|
+
displayName: 'Clear Namespace',
|
|
46
|
+
name: 'clearNamespace',
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
default: false,
|
|
49
|
+
description: 'Whether to clear the namespace before inserting new data',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Pinecone Namespace',
|
|
53
|
+
name: 'pineconeNamespace',
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'Partition the records in an index into namespaces. Queries and other operations are then limited to one namespace, so different requests can search different subsets of your index.',
|
|
56
|
+
default: '',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
exports.VectorStorePinecone = (0, createVectorStoreNode_1.createVectorStoreNode)({
|
|
62
|
+
meta: {
|
|
63
|
+
displayName: 'Pinecone Vector Store',
|
|
64
|
+
name: 'vectorStorePinecone',
|
|
65
|
+
description: 'Work with your data in Pinecone Vector Store',
|
|
66
|
+
icon: 'file:pinecone.svg',
|
|
67
|
+
docsUrl: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.vectorstorepinecone/',
|
|
68
|
+
credentials: [
|
|
69
|
+
{
|
|
70
|
+
name: 'pineconeApi',
|
|
71
|
+
required: true,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
retrieveFields,
|
|
76
|
+
loadFields: retrieveFields,
|
|
77
|
+
insertFields,
|
|
78
|
+
sharedFields,
|
|
79
|
+
async getVectorStoreClient(context, filter, embeddings, itemIndex) {
|
|
80
|
+
var _a;
|
|
81
|
+
const index = context.getNodeParameter('pineconeIndex', itemIndex);
|
|
82
|
+
const options = context.getNodeParameter('options', itemIndex, {});
|
|
83
|
+
const credentials = await context.getCredentials('pineconeApi');
|
|
84
|
+
const client = new pinecone_2.Pinecone({
|
|
85
|
+
apiKey: credentials.apiKey,
|
|
86
|
+
environment: credentials.environment,
|
|
87
|
+
});
|
|
88
|
+
const pineconeIndex = client.Index(index);
|
|
89
|
+
const config = {
|
|
90
|
+
namespace: (_a = options.pineconeNamespace) !== null && _a !== void 0 ? _a : undefined,
|
|
91
|
+
pineconeIndex,
|
|
92
|
+
filter,
|
|
93
|
+
};
|
|
94
|
+
return pinecone_1.PineconeStore.fromExistingIndex(embeddings, config);
|
|
95
|
+
},
|
|
96
|
+
async populateVectorStore(context, embeddings, documents, itemIndex) {
|
|
97
|
+
var _a;
|
|
98
|
+
const index = context.getNodeParameter('pineconeIndex', itemIndex);
|
|
99
|
+
const options = context.getNodeParameter('options', itemIndex, {});
|
|
100
|
+
const credentials = await context.getCredentials('pineconeApi');
|
|
101
|
+
const client = new pinecone_2.Pinecone({
|
|
102
|
+
apiKey: credentials.apiKey,
|
|
103
|
+
environment: credentials.environment,
|
|
104
|
+
});
|
|
105
|
+
const pineconeIndex = client.Index(index);
|
|
106
|
+
if (options.pineconeNamespace && options.clearNamespace) {
|
|
107
|
+
await pineconeIndex.namespace(options.pineconeNamespace).deleteAll();
|
|
108
|
+
}
|
|
109
|
+
await pinecone_1.PineconeStore.fromDocuments(documents, embeddings, {
|
|
110
|
+
namespace: (_a = options.pineconeNamespace) !== null && _a !== void 0 ? _a : undefined,
|
|
111
|
+
pineconeIndex,
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=VectorStorePinecone.node.js.map
|