n8n-nodes-vlm 2.0.2 → 2.0.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.
@@ -266,7 +266,10 @@ class VLMComplexityWorkflow {
266
266
  documents = items.map((item, index) => {
267
267
  const doc = {
268
268
  pageContent: JSON.stringify(item.json),
269
- metadata: { _itemIndex: index },
269
+ metadata: {
270
+ _itemIndex: index,
271
+ _originalBinary: item.binary, // Preserve original binary data
272
+ },
270
273
  };
271
274
  // Extract binary image data from n8n item.binary
272
275
  if (item.binary) {
@@ -279,6 +282,7 @@ class VLMComplexityWorkflow {
279
282
  // Add base64 image with data URI format
280
283
  if (base64Data) {
281
284
  doc.base64Image = `data:${data.mimeType};base64,${base64Data}`;
285
+ doc.metadata._binaryKey = binaryKey; // Remember which binary key was used
282
286
  this.logger.debug(`Extracted image from binary '${binaryKey}' (${data.mimeType}) for item ${index}`);
283
287
  break; // Use first image found
284
288
  }
@@ -332,7 +336,19 @@ class VLMComplexityWorkflow {
332
336
  // Format output based on outputFormat option
333
337
  if (outputFormat === 'items') {
334
338
  // Return each document as a separate item
335
- return [classifiedDocs.map((doc) => ({ json: doc }))];
339
+ return [
340
+ classifiedDocs.map((doc) => {
341
+ const outputItem = { json: doc };
342
+ // Restore original binary data if it was preserved
343
+ if (doc.metadata && doc.metadata._originalBinary) {
344
+ outputItem.binary = doc.metadata._originalBinary;
345
+ // Clean up internal metadata from output JSON
346
+ delete doc.metadata._originalBinary;
347
+ delete doc.metadata._binaryKey;
348
+ }
349
+ return outputItem;
350
+ }),
351
+ ];
336
352
  }
337
353
  else if (outputFormat === 'original') {
338
354
  // Maintain original structure but add classifications
@@ -341,6 +357,7 @@ class VLMComplexityWorkflow {
341
357
  ...item.json,
342
358
  _classifications: classifiedDocs,
343
359
  },
360
+ binary: item.binary, // Preserve original binaries
344
361
  }));
345
362
  return [outputItems];
346
363
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-vlm",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Vision-Language Models for n8n - Lightweight specialized VLMs for document analysis and classification",
5
5
  "main": "index.js",
6
6
  "author": "Gabriel BRUMENT",