n8n-nodes-tembory 1.1.34 → 1.1.35
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
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.1.
|
|
5
|
+
Versao atual: `1.1.35`.
|
|
6
|
+
|
|
7
|
+
## 1.1.35
|
|
8
|
+
|
|
9
|
+
- Corrige a chave default de memoria do runtime para `chat_history`, que e o placeholder usado pelo AI Agent do n8n.
|
|
10
|
+
- Mantem compatibilidade com `chatHistory`, devolvendo aliases para workflows antigos.
|
|
11
|
+
- Faz o contexto operacional do Tembory entrar no prompt principal do Agent em modo simples.
|
|
6
12
|
|
|
7
13
|
## 1.1.34
|
|
8
14
|
|
|
@@ -9,6 +9,7 @@ try {
|
|
|
9
9
|
}
|
|
10
10
|
catch { }
|
|
11
11
|
const MAX_TEXT = 12000;
|
|
12
|
+
const DEFAULT_MEMORY_KEY = 'chat_history';
|
|
12
13
|
const nowIso = () => new Date().toISOString();
|
|
13
14
|
const safeStringify = (value) => {
|
|
14
15
|
try {
|
|
@@ -3113,7 +3114,7 @@ const wrapTemboryMemory = (memory, ctx, memoryKey, itemIndex = 0) => new Proxy(m
|
|
|
3113
3114
|
]);
|
|
3114
3115
|
try {
|
|
3115
3116
|
const response = await target.loadMemoryVariables(values);
|
|
3116
|
-
const memoryMessages = response[memoryKey] || response.chatHistory || [];
|
|
3117
|
+
const memoryMessages = response[memoryKey] || response.chat_history || response.chatHistory || [];
|
|
3117
3118
|
const messages = Array.isArray(memoryMessages) ? memoryMessages.length : 0;
|
|
3118
3119
|
ctx.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, index, [
|
|
3119
3120
|
[{
|
|
@@ -3764,7 +3765,7 @@ class TemboryMemory {
|
|
|
3764
3765
|
// For AI connections, n8n reads from supplyData. The AI Agent expects a
|
|
3765
3766
|
// memory-like object, not raw JSON, so expose the LangChain memory contract.
|
|
3766
3767
|
async supplyData(itemIndex) {
|
|
3767
|
-
const memoryKey = this.getNodeParameter('memoryKey', itemIndex,
|
|
3768
|
+
const memoryKey = this.getNodeParameter('memoryKey', itemIndex, DEFAULT_MEMORY_KEY);
|
|
3768
3769
|
let currentMessages = [];
|
|
3769
3770
|
const loadCache = new Map();
|
|
3770
3771
|
const recordMemoryEvent = (action, payload = {}, error) => {
|
|
@@ -3780,7 +3781,7 @@ class TemboryMemory {
|
|
|
3780
3781
|
]);
|
|
3781
3782
|
};
|
|
3782
3783
|
const memory = {
|
|
3783
|
-
memoryKeys: [memoryKey],
|
|
3784
|
+
memoryKeys: Array.from(new Set([memoryKey, DEFAULT_MEMORY_KEY])),
|
|
3784
3785
|
inputKey: 'input',
|
|
3785
3786
|
outputKey: 'output',
|
|
3786
3787
|
returnMessages: true,
|
|
@@ -3827,11 +3828,18 @@ class TemboryMemory {
|
|
|
3827
3828
|
loadCache.delete(firstKey);
|
|
3828
3829
|
}
|
|
3829
3830
|
}
|
|
3830
|
-
const chatHistory = (result.response[memoryKey] || []).map(toBaseMessage);
|
|
3831
|
+
const chatHistory = (result.response[memoryKey] || result.response.chat_history || result.response.chatHistory || []).map(toBaseMessage);
|
|
3831
3832
|
currentMessages = chatHistory;
|
|
3832
3833
|
const variables = {
|
|
3833
3834
|
[memoryKey]: chatHistory,
|
|
3834
3835
|
};
|
|
3836
|
+
if (memoryKey !== DEFAULT_MEMORY_KEY) {
|
|
3837
|
+
Object.defineProperty(variables, DEFAULT_MEMORY_KEY, {
|
|
3838
|
+
value: chatHistory,
|
|
3839
|
+
enumerable: true,
|
|
3840
|
+
configurable: true,
|
|
3841
|
+
});
|
|
3842
|
+
}
|
|
3835
3843
|
if (memoryKey !== 'chatHistory') {
|
|
3836
3844
|
Object.defineProperty(variables, 'chatHistory', {
|
|
3837
3845
|
value: chatHistory,
|
|
@@ -4381,7 +4389,7 @@ class TemboryMemory {
|
|
|
4381
4389
|
}
|
|
4382
4390
|
async loadMemoryVariablesForItem(itemIndex, inputValues = {}) {
|
|
4383
4391
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4384
|
-
const memoryKey = this.getNodeParameter('memoryKey', itemIndex,
|
|
4392
|
+
const memoryKey = this.getNodeParameter('memoryKey', itemIndex, DEFAULT_MEMORY_KEY);
|
|
4385
4393
|
const requestedRetrievalMode = this.getNodeParameter('retrievalMode', itemIndex, 'basic');
|
|
4386
4394
|
let payloadFormat = this.getNodeParameter('payloadFormat', itemIndex, 'structured');
|
|
4387
4395
|
const threadId = this.getNodeParameter('threadId', itemIndex);
|
|
@@ -5014,6 +5022,7 @@ class TemboryMemory {
|
|
|
5014
5022
|
return {
|
|
5015
5023
|
response: {
|
|
5016
5024
|
[memoryKey]: payload,
|
|
5025
|
+
chat_history: payload,
|
|
5017
5026
|
chatHistory: payload,
|
|
5018
5027
|
},
|
|
5019
5028
|
};
|
|
@@ -5023,7 +5032,7 @@ class TemboryMemory {
|
|
|
5023
5032
|
const returnData = [];
|
|
5024
5033
|
const count = Math.max(items.length, 1);
|
|
5025
5034
|
for (let i = 0; i < count; i++) {
|
|
5026
|
-
const memoryKey = this.getNodeParameter('memoryKey', i,
|
|
5035
|
+
const memoryKey = this.getNodeParameter('memoryKey', i, DEFAULT_MEMORY_KEY);
|
|
5027
5036
|
const requestedRetrievalMode = this.getNodeParameter('retrievalMode', i, 'basic');
|
|
5028
5037
|
const threadId = this.getNodeParameter('threadId', i);
|
|
5029
5038
|
const project = this.getNodeParameter('project', i, '');
|
|
@@ -5088,6 +5097,8 @@ class TemboryMemory {
|
|
|
5088
5097
|
}
|
|
5089
5098
|
const json = {};
|
|
5090
5099
|
json[memoryKey] = payload;
|
|
5100
|
+
json.chat_history = payload;
|
|
5101
|
+
json.chatHistory = payload;
|
|
5091
5102
|
returnData.push({ json });
|
|
5092
5103
|
}
|
|
5093
5104
|
return [returnData];
|
package/package.json
CHANGED