n8n-nodes-vlm 2.0.1 → 2.0.2
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.
|
@@ -263,10 +263,30 @@ class VLMComplexityWorkflow {
|
|
|
263
263
|
let documents = [];
|
|
264
264
|
if (documentSource === 'items') {
|
|
265
265
|
// Use all items as documents
|
|
266
|
-
documents = items.map((item, index) =>
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
documents = items.map((item, index) => {
|
|
267
|
+
const doc = {
|
|
268
|
+
pageContent: JSON.stringify(item.json),
|
|
269
|
+
metadata: { _itemIndex: index },
|
|
270
|
+
};
|
|
271
|
+
// Extract binary image data from n8n item.binary
|
|
272
|
+
if (item.binary) {
|
|
273
|
+
// Find first image in binary data
|
|
274
|
+
for (const [binaryKey, binaryData] of Object.entries(item.binary)) {
|
|
275
|
+
const data = binaryData;
|
|
276
|
+
if (data.mimeType && data.mimeType.startsWith('image/')) {
|
|
277
|
+
// n8n stores binary data as base64 in data.data
|
|
278
|
+
const base64Data = data.data;
|
|
279
|
+
// Add base64 image with data URI format
|
|
280
|
+
if (base64Data) {
|
|
281
|
+
doc.base64Image = `data:${data.mimeType};base64,${base64Data}`;
|
|
282
|
+
this.logger.debug(`Extracted image from binary '${binaryKey}' (${data.mimeType}) for item ${index}`);
|
|
283
|
+
break; // Use first image found
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return doc;
|
|
289
|
+
});
|
|
270
290
|
}
|
|
271
291
|
else if (documentSource === 'field') {
|
|
272
292
|
// Extract from field
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-vlm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
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",
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
"dev": "tsc --watch",
|
|
26
26
|
"lint": "eslint . --ext .ts",
|
|
27
27
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
28
|
+
"lint-staged": "lint-staged",
|
|
28
29
|
"test": "jest",
|
|
30
|
+
"test:pre-commit": "jest --bail --findRelatedTests",
|
|
31
|
+
"build:check": "tsc --noEmit",
|
|
29
32
|
"format": "prettier --write \"**/*.{ts,js,json,md}\"",
|
|
30
33
|
"format:check": "prettier --check \"**/*.{ts,js,json,md}\"",
|
|
31
34
|
"prepare": "cd .. && husky custom-nodes/.husky"
|
|
@@ -50,6 +53,8 @@
|
|
|
50
53
|
"credentials": []
|
|
51
54
|
},
|
|
52
55
|
"devDependencies": {
|
|
56
|
+
"@commitlint/cli": "^20.1.0",
|
|
57
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
53
58
|
"@types/jest": "^29.0.0",
|
|
54
59
|
"@types/node": "^18.0.0",
|
|
55
60
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|