n8n-nodes-vlm 2.0.0 → 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.
@@ -177,10 +177,13 @@ class VLMComplexityClassifier {
177
177
  const filterComplexity = this.getNodeParameter('filterComplexity', 0, 'both');
178
178
  const additionalOptions = this.getNodeParameter('additionalOptions', 0, {});
179
179
  const timeout = (_a = additionalOptions.timeout) !== null && _a !== void 0 ? _a : 30000;
180
- // Verify server has classifier capability
180
+ // Verify server has classifier capability (optional check)
181
181
  const status = await (0, vlm_logic_1.checkServerStatus)(this, serverUrl, timeout);
182
- if (!status.hasClassifier) {
183
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Server at ${serverUrl} does not support VLM classification.\nMake sure /api/status returns has_classifier: true`);
182
+ if (status.status === 'error') {
183
+ this.logger.warn(`Could not verify server capabilities at ${serverUrl}/api/status. Proceeding anyway...`);
184
+ }
185
+ else if (!status.hasClassifier) {
186
+ this.logger.warn(`Server at ${serverUrl} does not explicitly report VLM classifier support. Proceeding anyway...`);
184
187
  }
185
188
  /**
186
189
  * Classifier Provider Object
@@ -17,7 +17,7 @@ class VLMComplexityWorkflow {
17
17
  icon: 'file:vlm.svg',
18
18
  group: ['transform'],
19
19
  version: 1,
20
- subtitle: '={{$parameter["operation"]}}',
20
+ subtitle: '={{$parameter["model"]}}',
21
21
  description: 'Classify document complexity using Vision-Language Models',
22
22
  defaults: {
23
23
  name: 'VLM Complexity Workflow',
@@ -251,19 +251,42 @@ class VLMComplexityWorkflow {
251
251
  const additionalOptions = this.getNodeParameter('additionalOptions', 0, {});
252
252
  const timeout = (_a = additionalOptions.timeout) !== null && _a !== void 0 ? _a : 30000;
253
253
  const outputFormat = (_b = additionalOptions.outputFormat) !== null && _b !== void 0 ? _b : 'documents';
254
- // Verify server has classifier capability
254
+ // Verify server has classifier capability (optional check)
255
255
  const status = await (0, vlm_logic_1.checkServerStatus)(this, serverUrl, timeout);
256
- if (!status.hasClassifier) {
257
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Server at ${serverUrl} does not support VLM classification.\nMake sure /api/status returns has_classifier: true`);
256
+ if (status.status === 'error') {
257
+ this.logger.warn(`Could not verify server capabilities at ${serverUrl}/api/status. Proceeding anyway...`);
258
+ }
259
+ else if (!status.hasClassifier) {
260
+ this.logger.warn(`Server at ${serverUrl} does not explicitly report VLM classifier support. Proceeding anyway...`);
258
261
  }
259
262
  // Extract documents based on source
260
263
  let documents = [];
261
264
  if (documentSource === 'items') {
262
265
  // Use all items as documents
263
- documents = items.map((item, index) => ({
264
- pageContent: JSON.stringify(item.json),
265
- metadata: { _itemIndex: index },
266
- }));
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
+ });
267
290
  }
268
291
  else if (documentSource === 'field') {
269
292
  // Extract from field
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-vlm",
3
- "version": "2.0.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",