n8n-nodes-mem0-self 0.2.1 → 0.2.3
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/nodes/Mem0/GenericFunctions.d.ts.map +1 -1
- package/dist/nodes/Mem0/GenericFunctions.js +15 -3
- package/dist/nodes/Mem0/GenericFunctions.js.map +1 -1
- package/dist/nodes/Mem0/Mem0Memory.node.d.ts.map +1 -1
- package/dist/nodes/Mem0/Mem0Memory.node.js +189 -144
- package/dist/nodes/Mem0/Mem0Memory.node.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFunctions.d.ts","sourceRoot":"","sources":["../../../nodes/Mem0/GenericFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EAErB,oBAAoB,EACpB,MAAM,cAAc,CAAC;AAGtB,KAAK,GAAG,GAAG,iBAAiB,GAAG,cAAc,GAAG,qBAAqB,GAAG,oBAAoB,CAAC;AAE7F;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,CAK9C;AAED;;;GAGG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAC9B,EAAE,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC1B,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"GenericFunctions.d.ts","sourceRoot":"","sources":["../../../nodes/Mem0/GenericFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EAErB,oBAAoB,EACpB,MAAM,cAAc,CAAC;AAGtB,KAAK,GAAG,GAAG,iBAAiB,GAAG,cAAc,GAAG,qBAAqB,GAAG,oBAAoB,CAAC;AAE7F;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,CAK9C;AAED;;;GAGG;AACH,wBAAsB,cAAc,CACnC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAC9B,EAAE,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC1B,OAAO,CAAC,GAAG,CAAC,CAmCd"}
|
|
@@ -25,14 +25,26 @@ async function mem0ApiRequest(method, endpoint, body = {}, qs = {}) {
|
|
|
25
25
|
const credentials = await this.getCredentials('mem0SelfHostedApi');
|
|
26
26
|
const baseUrl = credentials.baseUrl.replace(/\/$/, '');
|
|
27
27
|
const resolvedEndpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
|
|
28
|
+
const methodUpper = method.toUpperCase();
|
|
29
|
+
const hasBody = body && Object.keys(body).length > 0 && !['GET', 'DELETE'].includes(methodUpper);
|
|
28
30
|
const options = {
|
|
29
|
-
method:
|
|
30
|
-
body,
|
|
31
|
+
method: methodUpper,
|
|
31
32
|
qs,
|
|
32
33
|
url: `${baseUrl}${resolvedEndpoint}`,
|
|
34
|
+
json: true,
|
|
33
35
|
};
|
|
36
|
+
if (hasBody) {
|
|
37
|
+
options.body = body;
|
|
38
|
+
}
|
|
39
|
+
const headers = {};
|
|
40
|
+
if (hasBody) {
|
|
41
|
+
headers['Content-Type'] = 'application/json';
|
|
42
|
+
}
|
|
34
43
|
if (credentials.apiKey) {
|
|
35
|
-
|
|
44
|
+
headers['X-API-Key'] = credentials.apiKey;
|
|
45
|
+
}
|
|
46
|
+
if (Object.keys(headers).length > 0) {
|
|
47
|
+
options.headers = headers;
|
|
36
48
|
}
|
|
37
49
|
try {
|
|
38
50
|
return await this.helpers.httpRequest(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Mem0/GenericFunctions.ts"],"names":[],"mappings":";;AAgBA,wCAKC;AAMD,
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Mem0/GenericFunctions.ts"],"names":[],"mappings":";;AAgBA,wCAKC;AAMD,wCAyCC;AA7DD,+CAA4C;AAI5C;;;;GAIG;AACH,SAAgB,cAAc,CAAC,GAAQ;IACtC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACnC,IAAI,GAAG,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC;IACnE,IAAI,GAAG;QAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB,OAAO,EAAE,CAAC;AACX,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,cAAc,CAEnC,MAAc,EACd,QAAgB,EAChB,OAA4B,EAAE,EAC9B,KAA0B,EAAE;IAE5B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;IACnE,MAAM,OAAO,GAAI,WAAW,CAAC,OAAkB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,gBAAgB,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC;IAC9E,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAEjG,MAAM,OAAO,GAAwB;QACpC,MAAM,EAAE,WAA4C;QACpD,EAAE;QACF,GAAG,EAAE,GAAG,OAAO,GAAG,gBAAgB,EAAE;QACpC,IAAI,EAAE,IAAI;KACV,CAAC;IACF,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;IAC9C,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC,MAAgB,CAAC;IACrD,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC;QACJ,OAAO,MAAO,IAA0B,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACvE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAY,CAAC,CAAC;IACtD,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mem0Memory.node.d.ts","sourceRoot":"","sources":["../../../nodes/Mem0/Mem0Memory.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Mem0Memory.node.d.ts","sourceRoot":"","sources":["../../../nodes/Mem0/Mem0Memory.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,MAAM,cAAc,CAAC;AAqMtB,qBAAa,UAAW,YAAW,SAAS;IAC3C,WAAW,EAAE,oBAAoB,CAyE/B;IAEI,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA8D9E,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAUvE"}
|
|
@@ -6,45 +6,75 @@ const GenericFunctions_1 = require("./GenericFunctions");
|
|
|
6
6
|
let HumanMessage;
|
|
7
7
|
let AIMessage;
|
|
8
8
|
let SystemMessage;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
let BufferWindowMemory;
|
|
10
|
+
let logWrapper;
|
|
11
|
+
(function loadDeps() {
|
|
12
|
+
const messageCandidates = ['@langchain/core/messages', 'langchain/messages'];
|
|
13
|
+
for (const moduleName of messageCandidates) {
|
|
12
14
|
try {
|
|
13
15
|
const loaded = require(moduleName);
|
|
14
16
|
if (loaded?.HumanMessage && loaded?.AIMessage) {
|
|
15
17
|
HumanMessage = loaded.HumanMessage;
|
|
16
18
|
AIMessage = loaded.AIMessage;
|
|
17
19
|
SystemMessage = loaded.SystemMessage || loaded.HumanMessage;
|
|
18
|
-
|
|
20
|
+
break;
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
catch {
|
|
22
|
-
//
|
|
24
|
+
// continue
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
if (!HumanMessage || !AIMessage) {
|
|
28
|
+
class BaseMessage {
|
|
29
|
+
constructor(content) {
|
|
30
|
+
this.lc_namespace = ['langchain_core', 'messages'];
|
|
31
|
+
this.lc_serializable = true;
|
|
32
|
+
this.additional_kwargs = {};
|
|
33
|
+
this.content = content;
|
|
34
|
+
}
|
|
31
35
|
}
|
|
36
|
+
HumanMessage = class extends BaseMessage {
|
|
37
|
+
_getType() {
|
|
38
|
+
return 'human';
|
|
39
|
+
}
|
|
40
|
+
get type() {
|
|
41
|
+
return 'human';
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
AIMessage = class extends BaseMessage {
|
|
45
|
+
_getType() {
|
|
46
|
+
return 'ai';
|
|
47
|
+
}
|
|
48
|
+
get type() {
|
|
49
|
+
return 'ai';
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
SystemMessage = class extends BaseMessage {
|
|
53
|
+
_getType() {
|
|
54
|
+
return 'system';
|
|
55
|
+
}
|
|
56
|
+
get type() {
|
|
57
|
+
return 'system';
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const memory = require('@langchain/classic/memory');
|
|
63
|
+
BufferWindowMemory = memory.BufferWindowMemory || memory.BufferMemory;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
BufferWindowMemory = null;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const aiUtils = require('@n8n/ai-utilities');
|
|
70
|
+
logWrapper = aiUtils.logWrapper;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
logWrapper = null;
|
|
32
74
|
}
|
|
33
|
-
HumanMessage = class extends BaseMessage {
|
|
34
|
-
_getType() { return 'human'; }
|
|
35
|
-
get type() { return 'human'; }
|
|
36
|
-
};
|
|
37
|
-
AIMessage = class extends BaseMessage {
|
|
38
|
-
_getType() { return 'ai'; }
|
|
39
|
-
get type() { return 'ai'; }
|
|
40
|
-
};
|
|
41
|
-
SystemMessage = class extends BaseMessage {
|
|
42
|
-
_getType() { return 'system'; }
|
|
43
|
-
get type() { return 'system'; }
|
|
44
|
-
};
|
|
45
75
|
})();
|
|
46
76
|
function toMessageContent(memory) {
|
|
47
|
-
return memory?.memory ?? memory?.text ?? memory?.content ??
|
|
77
|
+
return memory?.memory ?? memory?.text ?? memory?.content ?? '';
|
|
48
78
|
}
|
|
49
79
|
function toLangchainMessage(memory) {
|
|
50
80
|
const content = toMessageContent(memory);
|
|
@@ -55,6 +85,84 @@ function toLangchainMessage(memory) {
|
|
|
55
85
|
return new AIMessage(content);
|
|
56
86
|
return new SystemMessage(content);
|
|
57
87
|
}
|
|
88
|
+
function wrapMemoryResponse(memory, ctx) {
|
|
89
|
+
if (typeof logWrapper === 'function') {
|
|
90
|
+
return logWrapper(memory, ctx);
|
|
91
|
+
}
|
|
92
|
+
return memory;
|
|
93
|
+
}
|
|
94
|
+
class Mem0ChatHistory {
|
|
95
|
+
constructor(ctx, scope, options) {
|
|
96
|
+
this.ctx = ctx;
|
|
97
|
+
this.scope = scope;
|
|
98
|
+
this.maxMessageLength = options.maxMessageLength;
|
|
99
|
+
this.contextWindowLength = options.contextWindowLength;
|
|
100
|
+
}
|
|
101
|
+
normalizeRole(message) {
|
|
102
|
+
const role = String(message?.role || message?.type || message?._getType?.() || '').toLowerCase();
|
|
103
|
+
if (role === 'assistant' || role === 'ai')
|
|
104
|
+
return 'assistant';
|
|
105
|
+
return 'user';
|
|
106
|
+
}
|
|
107
|
+
normalizeContent(message) {
|
|
108
|
+
if (typeof message === 'string')
|
|
109
|
+
return message;
|
|
110
|
+
return String(message?.content ?? '');
|
|
111
|
+
}
|
|
112
|
+
normalizeByTimestamp(memories) {
|
|
113
|
+
return [...memories].sort((a, b) => {
|
|
114
|
+
const aTs = new Date(a?.created_at || a?.updated_at || 0).getTime() || 0;
|
|
115
|
+
const bTs = new Date(b?.created_at || b?.updated_at || 0).getTime() || 0;
|
|
116
|
+
return aTs - bTs;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async append(role, content) {
|
|
120
|
+
const normalized = String(content || '').trim();
|
|
121
|
+
if (!normalized)
|
|
122
|
+
return;
|
|
123
|
+
if (normalized.length > this.maxMessageLength) {
|
|
124
|
+
throw new n8n_workflow_1.NodeOperationError(this.ctx.getNode(), `${role === 'user' ? 'User' : 'Assistant'} message is too long. Maximum supported length is ${this.maxMessageLength} characters.`);
|
|
125
|
+
}
|
|
126
|
+
await GenericFunctions_1.mem0ApiRequest.call(this.ctx, 'POST', '/memories', {
|
|
127
|
+
messages: [{ role, content: normalized }],
|
|
128
|
+
infer: false,
|
|
129
|
+
metadata: { source: 'n8n_mem0_memory_safe', role },
|
|
130
|
+
...this.scope,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
async getMessages() {
|
|
134
|
+
const response = await GenericFunctions_1.mem0ApiRequest.call(this.ctx, 'GET', '/memories', {}, this.scope);
|
|
135
|
+
const rawMemories = (0, GenericFunctions_1.extractResults)(response);
|
|
136
|
+
const ordered = this.normalizeByTimestamp(rawMemories);
|
|
137
|
+
// Align with n8n chat-memory behavior: contextWindowLength represents exchanges.
|
|
138
|
+
const maxEntries = Math.max(1, this.contextWindowLength) * 2;
|
|
139
|
+
const windowed = ordered.slice(-maxEntries);
|
|
140
|
+
return windowed.map((entry) => toLangchainMessage(entry));
|
|
141
|
+
}
|
|
142
|
+
async addMessage(message) {
|
|
143
|
+
const role = this.normalizeRole(message);
|
|
144
|
+
const content = this.normalizeContent(message);
|
|
145
|
+
await this.append(role, content);
|
|
146
|
+
}
|
|
147
|
+
async addMessages(messages) {
|
|
148
|
+
for (const message of messages || []) {
|
|
149
|
+
await this.addMessage(message);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async addUserMessage(message) {
|
|
153
|
+
await this.append('user', message);
|
|
154
|
+
}
|
|
155
|
+
async addAIMessage(message) {
|
|
156
|
+
await this.append('assistant', message);
|
|
157
|
+
}
|
|
158
|
+
async addAIChatMessage(message) {
|
|
159
|
+
await this.append('assistant', message);
|
|
160
|
+
}
|
|
161
|
+
// Safe profile: intentionally non-destructive.
|
|
162
|
+
async clear() {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
58
166
|
class Mem0Memory {
|
|
59
167
|
constructor() {
|
|
60
168
|
this.description = {
|
|
@@ -63,7 +171,7 @@ class Mem0Memory {
|
|
|
63
171
|
icon: 'file:mem0.svg',
|
|
64
172
|
group: ['transform'],
|
|
65
173
|
version: 1,
|
|
66
|
-
description: '
|
|
174
|
+
description: 'Persistent chat memory for AI Agent using Mem0 Self-Hosted OSS REST API',
|
|
67
175
|
defaults: { name: 'Mem0 Chat Memory' },
|
|
68
176
|
inputs: [],
|
|
69
177
|
outputs: [n8n_workflow_1.NodeConnectionTypes.AiMemory],
|
|
@@ -94,157 +202,94 @@ class Mem0Memory {
|
|
|
94
202
|
description: 'Optional conversation/session identifier',
|
|
95
203
|
},
|
|
96
204
|
{
|
|
97
|
-
displayName: '
|
|
98
|
-
name: 'defaultQuery',
|
|
99
|
-
type: 'string',
|
|
100
|
-
default: '',
|
|
101
|
-
description: 'Fallback search query when no dynamic input query is available',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
displayName: 'Top K',
|
|
205
|
+
displayName: 'Context Window Length',
|
|
105
206
|
name: 'topK',
|
|
106
207
|
type: 'number',
|
|
107
208
|
default: 10,
|
|
108
209
|
typeOptions: { minValue: 1, maxValue: 50 },
|
|
109
|
-
description: '
|
|
210
|
+
description: 'Number of recent exchanges to inject (internally converted to messages)',
|
|
110
211
|
},
|
|
111
212
|
{
|
|
112
|
-
displayName: '
|
|
113
|
-
name: '
|
|
213
|
+
displayName: 'Infer on Store',
|
|
214
|
+
name: 'infer',
|
|
114
215
|
type: 'boolean',
|
|
115
216
|
default: false,
|
|
116
|
-
description: '
|
|
217
|
+
description: 'Legacy toggle kept for compatibility. Safe profile stores raw chat turns.',
|
|
117
218
|
},
|
|
118
219
|
{
|
|
119
|
-
displayName: '
|
|
120
|
-
name: '
|
|
220
|
+
displayName: 'Default Query (Legacy)',
|
|
221
|
+
name: 'defaultQuery',
|
|
121
222
|
type: 'string',
|
|
122
223
|
default: '',
|
|
123
|
-
description: '
|
|
224
|
+
description: 'Legacy field kept for workflow compatibility (not used in persistent chat mode)',
|
|
124
225
|
},
|
|
125
226
|
{
|
|
126
|
-
displayName: '
|
|
127
|
-
name: '
|
|
227
|
+
displayName: 'Rerank (Legacy)',
|
|
228
|
+
name: 'rerank',
|
|
128
229
|
type: 'boolean',
|
|
129
|
-
default:
|
|
130
|
-
description: '
|
|
230
|
+
default: false,
|
|
231
|
+
description: 'Legacy field kept for workflow compatibility (not used)',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
displayName: 'Fields (Legacy)',
|
|
235
|
+
name: 'fields',
|
|
236
|
+
type: 'string',
|
|
237
|
+
default: '',
|
|
238
|
+
description: 'Legacy field kept for workflow compatibility (not used)',
|
|
131
239
|
},
|
|
132
240
|
],
|
|
133
241
|
};
|
|
134
242
|
}
|
|
135
243
|
async supplyData(itemIndex) {
|
|
136
244
|
const MAX_MESSAGE_LENGTH = 10000;
|
|
137
|
-
const MAX_QUERY_LENGTH = 2000;
|
|
138
|
-
const FALLBACK_QUERY = 'recent conversation context for this user and agent';
|
|
139
|
-
const self = this;
|
|
140
245
|
const userId = String(this.getNodeParameter('userId', itemIndex, '') || '').trim();
|
|
141
246
|
const agentId = String(this.getNodeParameter('agentId', itemIndex, '') || '').trim();
|
|
142
247
|
const runId = String(this.getNodeParameter('runId', itemIndex, '') || '').trim();
|
|
143
|
-
const
|
|
144
|
-
const topK = Math.min(Math.max(1, Math.floor(Number(this.getNodeParameter('topK', itemIndex, 10) || 10))), 50);
|
|
145
|
-
const rerank = Boolean(this.getNodeParameter('rerank', itemIndex, false));
|
|
146
|
-
const fieldsInput = String(this.getNodeParameter('fields', itemIndex, '') || '').trim();
|
|
147
|
-
const infer = Boolean(this.getNodeParameter('infer', itemIndex, true));
|
|
248
|
+
const contextWindowLength = Math.min(50, Math.max(1, Math.floor(Number(this.getNodeParameter('topK', itemIndex, 10) || 10))));
|
|
148
249
|
if (!userId || !agentId) {
|
|
149
250
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'User ID and Agent ID are required.');
|
|
150
251
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const response = await GenericFunctions_1.mem0ApiRequest.call(self, 'POST', '/search', body);
|
|
179
|
-
const results = (0, GenericFunctions_1.extractResults)(response);
|
|
180
|
-
return results.map((entry) => toLangchainMessage(entry));
|
|
181
|
-
}
|
|
182
|
-
async function storeMessage(role, content) {
|
|
183
|
-
const normalized = String(content || '').trim();
|
|
184
|
-
if (!normalized)
|
|
185
|
-
return;
|
|
186
|
-
if (normalized.length > MAX_MESSAGE_LENGTH) {
|
|
187
|
-
throw new n8n_workflow_1.NodeOperationError(self.getNode(), `${role === 'user' ? 'User' : 'Assistant'} message is too long. Maximum supported length is ${MAX_MESSAGE_LENGTH} characters.`);
|
|
188
|
-
}
|
|
189
|
-
const body = {
|
|
190
|
-
messages: [{ role, content: normalized }],
|
|
191
|
-
infer,
|
|
192
|
-
metadata: { source: 'n8n_mem0_memory_safe', role },
|
|
193
|
-
...buildScope(),
|
|
194
|
-
};
|
|
195
|
-
await GenericFunctions_1.mem0ApiRequest.call(self, 'POST', '/memories', body);
|
|
196
|
-
}
|
|
197
|
-
const memoryObject = {
|
|
198
|
-
memoryKeys: ['chat_history'],
|
|
199
|
-
chatHistory: {
|
|
200
|
-
async getMessages() {
|
|
201
|
-
return searchMessages(defaultQuery);
|
|
202
|
-
},
|
|
203
|
-
async addMessage(message) {
|
|
204
|
-
const role = String(message?.role || message?.type || '').toLowerCase();
|
|
205
|
-
const content = String(message?.content ?? '');
|
|
206
|
-
if (role === 'assistant' || role === 'ai') {
|
|
207
|
-
await storeMessage('assistant', content);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
await storeMessage('user', content);
|
|
211
|
-
},
|
|
212
|
-
async addMessages(messages) {
|
|
213
|
-
for (const message of messages || []) {
|
|
214
|
-
await this.addMessage(message);
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
async addUserMessage(message) {
|
|
218
|
-
await storeMessage('user', message);
|
|
219
|
-
},
|
|
220
|
-
async addAIMessage(message) {
|
|
221
|
-
await storeMessage('assistant', message);
|
|
252
|
+
const scope = {
|
|
253
|
+
user_id: userId,
|
|
254
|
+
agent_id: agentId,
|
|
255
|
+
};
|
|
256
|
+
if (runId)
|
|
257
|
+
scope.run_id = runId;
|
|
258
|
+
const chatHistory = new Mem0ChatHistory(this, scope, {
|
|
259
|
+
maxMessageLength: MAX_MESSAGE_LENGTH,
|
|
260
|
+
contextWindowLength,
|
|
261
|
+
});
|
|
262
|
+
const memory = BufferWindowMemory
|
|
263
|
+
? new BufferWindowMemory({
|
|
264
|
+
memoryKey: 'chat_history',
|
|
265
|
+
chatHistory,
|
|
266
|
+
returnMessages: true,
|
|
267
|
+
inputKey: 'input',
|
|
268
|
+
outputKey: 'output',
|
|
269
|
+
k: contextWindowLength,
|
|
270
|
+
})
|
|
271
|
+
: {
|
|
272
|
+
memoryKey: 'chat_history',
|
|
273
|
+
chatHistory,
|
|
274
|
+
returnMessages: true,
|
|
275
|
+
inputKey: 'input',
|
|
276
|
+
outputKey: 'output',
|
|
277
|
+
async loadMemoryVariables() {
|
|
278
|
+
return { chat_history: await chatHistory.getMessages() };
|
|
222
279
|
},
|
|
223
|
-
async
|
|
224
|
-
|
|
280
|
+
async saveContext(inputValues, outputValues) {
|
|
281
|
+
const userInput = String(inputValues?.input || inputValues?.query || inputValues?.human_input || inputValues?.chatInput || '').trim();
|
|
282
|
+
const assistantOutput = String(outputValues?.output || outputValues?.response || outputValues?.text || '').trim();
|
|
283
|
+
if (userInput)
|
|
284
|
+
await chatHistory.addUserMessage(userInput);
|
|
285
|
+
if (assistantOutput)
|
|
286
|
+
await chatHistory.addAIMessage(assistantOutput);
|
|
225
287
|
},
|
|
226
|
-
// Intentionally non-destructive in safe profile.
|
|
227
288
|
async clear() {
|
|
228
289
|
return;
|
|
229
290
|
},
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const query = String(values?.input || values?.query || values?.human_input || values?.chatInput || defaultQuery || '').trim();
|
|
233
|
-
const messages = await searchMessages(query);
|
|
234
|
-
return { chat_history: messages };
|
|
235
|
-
},
|
|
236
|
-
async saveContext(inputValues, outputValues) {
|
|
237
|
-
const userInput = String(inputValues?.input || inputValues?.query || inputValues?.human_input || inputValues?.chatInput || '').trim();
|
|
238
|
-
const assistantOutput = String(outputValues?.output || outputValues?.response || outputValues?.text || '').trim();
|
|
239
|
-
await storeMessage('user', userInput);
|
|
240
|
-
await storeMessage('assistant', assistantOutput);
|
|
241
|
-
},
|
|
242
|
-
// Intentionally non-destructive in safe profile.
|
|
243
|
-
async clear() {
|
|
244
|
-
return;
|
|
245
|
-
},
|
|
246
|
-
};
|
|
247
|
-
return { response: memoryObject };
|
|
291
|
+
};
|
|
292
|
+
return { response: wrapMemoryResponse(memory, this) };
|
|
248
293
|
}
|
|
249
294
|
async execute() {
|
|
250
295
|
const items = this.getInputData();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mem0Memory.node.js","sourceRoot":"","sources":["../../../nodes/Mem0/Mem0Memory.node.ts"],"names":[],"mappings":";;;AAQA,+CAAuE;AACvE,yDAAoE;AAIpE,IAAI,YAAiB,CAAC;AACtB,IAAI,SAAc,CAAC;AACnB,IAAI,aAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Mem0Memory.node.js","sourceRoot":"","sources":["../../../nodes/Mem0/Mem0Memory.node.ts"],"names":[],"mappings":";;;AAQA,+CAAu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