n8n-nodes-tembory 1.1.12 → 1.1.13
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.
|
@@ -2254,6 +2254,23 @@ const invokeConnectedModelSummary = async (connectedLanguageModel, summaryInput,
|
|
|
2254
2254
|
]);
|
|
2255
2255
|
return cleanModelSummaryText(response, Number(adv.connectedModelSummaryMaxChars || 1200));
|
|
2256
2256
|
};
|
|
2257
|
+
const compactMemoryEventPayload = (payload = {}) => {
|
|
2258
|
+
const compact = { ...(payload || {}) };
|
|
2259
|
+
if (Array.isArray(compact.toolCalls)) {
|
|
2260
|
+
compact.toolCallsCaptured = compact.toolCalls.length;
|
|
2261
|
+
compact.toolNames = compact.toolCalls
|
|
2262
|
+
.map((tool) => (tool && (tool.name || tool.tool_name || tool.tool)) || '')
|
|
2263
|
+
.filter(Boolean)
|
|
2264
|
+
.slice(0, 20);
|
|
2265
|
+
delete compact.toolCalls;
|
|
2266
|
+
}
|
|
2267
|
+
for (const key of ['input', 'output', 'values', 'chatHistory', 'context', 'contextText', 'diagnostics']) {
|
|
2268
|
+
if (compact[key] !== undefined)
|
|
2269
|
+
compact[`${key}Chars`] = typeof compact[key] === 'string' ? compact[key].length : safeStringify(compact[key]).length;
|
|
2270
|
+
delete compact[key];
|
|
2271
|
+
}
|
|
2272
|
+
return compact;
|
|
2273
|
+
};
|
|
2257
2274
|
const contextSizeOfMessages = (messages = []) => {
|
|
2258
2275
|
const perMessage = (messages || []).map((message, index) => {
|
|
2259
2276
|
const content = String(message.content || '');
|
|
@@ -2851,7 +2868,7 @@ class TemboryMemory {
|
|
|
2851
2868
|
return;
|
|
2852
2869
|
}
|
|
2853
2870
|
this.addOutputData(n8n_workflow_1.NodeConnectionTypes.AiMemory, index, [
|
|
2854
|
-
[{ json: { action, ...payload } }],
|
|
2871
|
+
[{ json: { action, ...compactMemoryEventPayload(payload) } }],
|
|
2855
2872
|
]);
|
|
2856
2873
|
};
|
|
2857
2874
|
const memory = {
|
|
@@ -4042,4 +4059,5 @@ exports.__private = {
|
|
|
4042
4059
|
buildConnectedModelSummaryInput,
|
|
4043
4060
|
cleanModelSummaryText,
|
|
4044
4061
|
invokeConnectedModelSummary,
|
|
4062
|
+
compactMemoryEventPayload,
|
|
4045
4063
|
};
|
package/package.json
CHANGED