n8n-nodes-vlm 3.3.1 → 3.3.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.
|
@@ -283,23 +283,35 @@ class VLMComplexityWorkflow {
|
|
|
283
283
|
if (binaryField && item.binary[binaryField]) {
|
|
284
284
|
// Use specified binary field
|
|
285
285
|
const data = item.binary[binaryField];
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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');
|
|
289
291
|
base64Image = `data:${mimeType};base64,${rawBase64}`;
|
|
290
|
-
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}`);
|
|
291
296
|
}
|
|
292
297
|
}
|
|
293
298
|
else {
|
|
294
299
|
// Auto-detect first image (default behavior)
|
|
295
300
|
for (const [binaryKey, binaryData] of Object.entries(item.binary)) {
|
|
296
301
|
const data = binaryData;
|
|
297
|
-
if (data.mimeType && data.mimeType.startsWith('image/')
|
|
302
|
+
if (data.mimeType && data.mimeType.startsWith('image/')) {
|
|
298
303
|
mimeType = data.mimeType;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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
|
+
}
|
|
303
315
|
}
|
|
304
316
|
}
|
|
305
317
|
}
|
|
@@ -337,6 +349,12 @@ class VLMComplexityWorkflow {
|
|
|
337
349
|
};
|
|
338
350
|
// Add base64 to output if field name is specified
|
|
339
351
|
if (outputBase64Field && outputBase64Field.trim() !== '' && outputBase64Value) {
|
|
352
|
+
// Remove the source field to avoid duplication (rename, not duplicate)
|
|
353
|
+
const sourceField = imageSource === 'base64field' ? base64Field : null;
|
|
354
|
+
if (sourceField && sourceField !== outputBase64Field && outputJson[sourceField]) {
|
|
355
|
+
delete outputJson[sourceField];
|
|
356
|
+
this.logger.debug(`VLM DEBUG OUTPUT [${i}]: Removed source field '${sourceField}' to avoid duplication`);
|
|
357
|
+
}
|
|
340
358
|
outputJson[outputBase64Field] = outputBase64Value;
|
|
341
359
|
this.logger.debug(`VLM DEBUG OUTPUT [${i}]: Added '${outputBase64Field}' = '${outputBase64Value.substring(0, 30)}...'`);
|
|
342
360
|
}
|
package/package.json
CHANGED