n8n-nodes-tembory 1.0.23 → 1.0.24
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/README.md +7 -1
- package/dist/nodes/Mem0/Mem0Memory.node.js +29 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Node de memoria operacional da Tembory para agentes de IA no n8n.
|
|
4
4
|
|
|
5
|
-
Versao atual: `1.0.
|
|
5
|
+
Versao atual: `1.0.24`.
|
|
6
|
+
|
|
7
|
+
## 1.0.24
|
|
8
|
+
|
|
9
|
+
- Corrige falha `409 Backend LLM/embedder is disabled` no `saveContext` quando o node usa embeddings conectados pelo n8n.
|
|
10
|
+
- Writes legados de transcript/tool markers agora sao best-effort no modo BYO-AI, sem derrubar a execucao do agente.
|
|
11
|
+
- Remove o prefixo tecnico `THREAD:<id>` usado em testes MCP antes de montar query/contexto de memoria.
|
|
6
12
|
|
|
7
13
|
## 1.0.23
|
|
8
14
|
|
|
@@ -70,6 +70,22 @@ const searchClientVectorMemories = async (ctx, embedding, query, body = {}) => {
|
|
|
70
70
|
embedding: await embedQueryCached(embedding, text),
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
|
+
const safePersistLegacyMemory = async (ctx, body, diagnostics = {}) => {
|
|
74
|
+
try {
|
|
75
|
+
return await GenericFunctions_1.mem0ApiRequest.call(ctx, 'POST', '/v1/memories/', body);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
try {
|
|
79
|
+
ctx.logger?.warn('Tembory skipped legacy memory write after BYO-AI vector persistence', {
|
|
80
|
+
...diagnostics,
|
|
81
|
+
message: error.message || String(error),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
catch { }
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const stripThreadTestPrefix = (value = '') => String(value || '').replace(/^THREAD:[A-Za-z0-9_-]+\s+/, '');
|
|
73
89
|
const stableStringify = (value) => {
|
|
74
90
|
if (value === null || typeof value !== 'object')
|
|
75
91
|
return JSON.stringify(value);
|
|
@@ -2616,7 +2632,7 @@ class Mem0Memory {
|
|
|
2616
2632
|
const adv = applyOperationalPreset(readAdvancedOptions(this, itemIndex));
|
|
2617
2633
|
const store = getMemoryStore(this);
|
|
2618
2634
|
const key = userKeyFrom(threadId, adv, project);
|
|
2619
|
-
const input = pickText(inputValues, ['input', 'chatInput', 'text', 'query', 'question']);
|
|
2635
|
+
const input = stripThreadTestPrefix(pickText(inputValues, ['input', 'chatInput', 'text', 'query', 'question']));
|
|
2620
2636
|
const output = pickText(outputValues, ['output', 'response', 'text', 'answer']);
|
|
2621
2637
|
const toolCalls = extractToolCalls(outputValues);
|
|
2622
2638
|
const recentForMem0 = [];
|
|
@@ -2758,7 +2774,7 @@ class Mem0Memory {
|
|
|
2758
2774
|
await saveClientVectorMemories(this, clientMemories, ids);
|
|
2759
2775
|
if (adv.includeRecentMessages !== false && recentForMem0.length) {
|
|
2760
2776
|
for (const recent of recentForMem0) {
|
|
2761
|
-
await
|
|
2777
|
+
await safePersistLegacyMemory(this, {
|
|
2762
2778
|
messages: [{ role: 'system', content: encodeRecentMessage(recent, threadId) }],
|
|
2763
2779
|
infer: false,
|
|
2764
2780
|
user_id: body.user_id,
|
|
@@ -2773,12 +2789,15 @@ class Mem0Memory {
|
|
|
2773
2789
|
project: project || undefined,
|
|
2774
2790
|
source: 'tembory_transcript',
|
|
2775
2791
|
},
|
|
2792
|
+
}, {
|
|
2793
|
+
kind: 'recent_message',
|
|
2794
|
+
user_id: body.user_id,
|
|
2776
2795
|
});
|
|
2777
2796
|
}
|
|
2778
2797
|
}
|
|
2779
2798
|
if (adv.includeToolHistory !== false && toolCalls.length) {
|
|
2780
2799
|
for (const tool of toolCalls) {
|
|
2781
|
-
await
|
|
2800
|
+
await safePersistLegacyMemory(this, {
|
|
2782
2801
|
messages: [{ role: 'system', content: encodeToolCall(tool, threadId) }],
|
|
2783
2802
|
infer: false,
|
|
2784
2803
|
user_id: body.user_id,
|
|
@@ -2798,6 +2817,10 @@ class Mem0Memory {
|
|
|
2798
2817
|
thread_id: threadId,
|
|
2799
2818
|
project: project || undefined,
|
|
2800
2819
|
},
|
|
2820
|
+
}, {
|
|
2821
|
+
kind: 'tool_history',
|
|
2822
|
+
user_id: body.user_id,
|
|
2823
|
+
tool: tool.name,
|
|
2801
2824
|
});
|
|
2802
2825
|
}
|
|
2803
2826
|
}
|
|
@@ -2892,7 +2915,7 @@ class Mem0Memory {
|
|
|
2892
2915
|
const store = getMemoryStore(this);
|
|
2893
2916
|
const key = userKeyFrom(threadId, adv, project);
|
|
2894
2917
|
const queryParam = this.getNodeParameter('query', itemIndex, '');
|
|
2895
|
-
const query = asSearchQuery(queryParam) || asSearchQuery(inputValues.query) || asSearchQuery(inputValues.input) || asSearchQuery(inputValues.chatInput);
|
|
2918
|
+
const query = stripThreadTestPrefix(asSearchQuery(queryParam) || asSearchQuery(inputValues.query) || asSearchQuery(inputValues.input) || asSearchQuery(inputValues.chatInput));
|
|
2896
2919
|
let connectedLanguageModel;
|
|
2897
2920
|
let connectedEmbedding;
|
|
2898
2921
|
const connectedAi = {
|
|
@@ -3517,6 +3540,8 @@ exports.__private = {
|
|
|
3517
3540
|
applyOperationalPreset,
|
|
3518
3541
|
flattenAdvancedGroups,
|
|
3519
3542
|
asSearchQuery,
|
|
3543
|
+
safePersistLegacyMemory,
|
|
3544
|
+
stripThreadTestPrefix,
|
|
3520
3545
|
canonicalToolInput,
|
|
3521
3546
|
buildContextMessages,
|
|
3522
3547
|
inferToolGuard,
|
package/package.json
CHANGED