n8n-nodes-vlm 3.3.0 → 3.3.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.
|
@@ -181,12 +181,7 @@ class VLMComplexityWorkflow {
|
|
|
181
181
|
},
|
|
182
182
|
],
|
|
183
183
|
default: 'raw',
|
|
184
|
-
description: 'Format of the base64 in the output field',
|
|
185
|
-
displayOptions: {
|
|
186
|
-
hide: {
|
|
187
|
-
outputBase64Field: [''],
|
|
188
|
-
},
|
|
189
|
-
},
|
|
184
|
+
description: 'Format of the base64 in the output field. Only used when Output Base64 Field is set.',
|
|
190
185
|
},
|
|
191
186
|
// ═══════════════════════════════════════════════════════════════
|
|
192
187
|
// ADVANCED OPTIONS
|
|
@@ -288,23 +283,35 @@ class VLMComplexityWorkflow {
|
|
|
288
283
|
if (binaryField && item.binary[binaryField]) {
|
|
289
284
|
// Use specified binary field
|
|
290
285
|
const data = item.binary[binaryField];
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
286
|
+
mimeType = data.mimeType || 'image/png';
|
|
287
|
+
try {
|
|
288
|
+
// Use getBinaryDataBuffer for n8n filesystem binary mode compatibility
|
|
289
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryField);
|
|
290
|
+
rawBase64 = buffer.toString('base64');
|
|
294
291
|
base64Image = `data:${mimeType};base64,${rawBase64}`;
|
|
295
|
-
this.logger.debug(`VLM DEBUG INPUT [${i}]: Using specified binary field '${binaryField}' (${mimeType})`);
|
|
292
|
+
this.logger.debug(`VLM DEBUG INPUT [${i}]: Using specified binary field '${binaryField}' (${mimeType}), size=${buffer.length}`);
|
|
293
|
+
}
|
|
294
|
+
catch (err) {
|
|
295
|
+
this.logger.warn(`VLM WARNING [${i}]: Failed to read binary field '${binaryField}': ${err}`);
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
else {
|
|
299
299
|
// Auto-detect first image (default behavior)
|
|
300
300
|
for (const [binaryKey, binaryData] of Object.entries(item.binary)) {
|
|
301
301
|
const data = binaryData;
|
|
302
|
-
if (data.mimeType && data.mimeType.startsWith('image/')
|
|
302
|
+
if (data.mimeType && data.mimeType.startsWith('image/')) {
|
|
303
303
|
mimeType = data.mimeType;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
try {
|
|
305
|
+
// Use getBinaryDataBuffer for n8n filesystem binary mode compatibility
|
|
306
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryKey);
|
|
307
|
+
rawBase64 = buffer.toString('base64');
|
|
308
|
+
base64Image = `data:${mimeType};base64,${rawBase64}`;
|
|
309
|
+
this.logger.debug(`VLM DEBUG INPUT [${i}]: Auto-detected image from binary '${binaryKey}' (${mimeType}), size=${buffer.length}`);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
this.logger.warn(`VLM WARNING [${i}]: Failed to read binary '${binaryKey}': ${err}`);
|
|
314
|
+
}
|
|
308
315
|
}
|
|
309
316
|
}
|
|
310
317
|
}
|
|
@@ -327,21 +334,27 @@ class VLMComplexityWorkflow {
|
|
|
327
334
|
this.logger.debug(`VLM DEBUG OUTPUT [${i}]: format='${outputBase64Format}', choosing ${outputBase64Format === 'raw' ? 'rawBase64' : 'base64Image'}`);
|
|
328
335
|
const outputBase64Value = outputBase64Format === 'raw' ? rawBase64 : base64Image;
|
|
329
336
|
this.logger.debug(`VLM DEBUG OUTPUT [${i}]: outputBase64Value prefix='${outputBase64Value === null || outputBase64Value === void 0 ? void 0 : outputBase64Value.substring(0, 40)}...'`);
|
|
337
|
+
this.logger.debug(`VLM DEBUG OUTPUT [${i}]: Will add to JSON? outputBase64Field='${outputBase64Field}' (truthy=${!!outputBase64Field}), hasValue=${!!outputBase64Value}`);
|
|
338
|
+
// Build base JSON output
|
|
339
|
+
const outputJson = {
|
|
340
|
+
// Classification results (top level for visibility)
|
|
341
|
+
complexityClass: classification.complexity,
|
|
342
|
+
complexityConfidence: classification.confidence,
|
|
343
|
+
processingTime: classification.processingTime,
|
|
344
|
+
modelUsed: classification.modelUsed,
|
|
345
|
+
// Original JSON data merged in
|
|
346
|
+
...item.json,
|
|
347
|
+
// Item tracking
|
|
348
|
+
_itemIndex: i,
|
|
349
|
+
};
|
|
350
|
+
// Add base64 to output if field name is specified
|
|
351
|
+
if (outputBase64Field && outputBase64Field.trim() !== '' && outputBase64Value) {
|
|
352
|
+
outputJson[outputBase64Field] = outputBase64Value;
|
|
353
|
+
this.logger.debug(`VLM DEBUG OUTPUT [${i}]: Added '${outputBase64Field}' = '${outputBase64Value.substring(0, 30)}...'`);
|
|
354
|
+
}
|
|
330
355
|
// Build output item with BOTH json AND binary
|
|
331
356
|
const outputItem = {
|
|
332
|
-
json:
|
|
333
|
-
// Classification results (top level for visibility)
|
|
334
|
-
complexityClass: classification.complexity,
|
|
335
|
-
complexityConfidence: classification.confidence,
|
|
336
|
-
processingTime: classification.processingTime,
|
|
337
|
-
modelUsed: classification.modelUsed,
|
|
338
|
-
// Original JSON data merged in
|
|
339
|
-
...item.json,
|
|
340
|
-
// Item tracking
|
|
341
|
-
_itemIndex: i,
|
|
342
|
-
// Optional: include base64 in output JSON (format depends on outputBase64Format)
|
|
343
|
-
...(outputBase64Field && outputBase64Value ? { [outputBase64Field]: outputBase64Value } : {}),
|
|
344
|
-
},
|
|
357
|
+
json: outputJson,
|
|
345
358
|
// ALWAYS preserve binary data
|
|
346
359
|
binary: item.binary,
|
|
347
360
|
};
|
package/package.json
CHANGED