Skip to content

Commit 55ae549

Browse files
committed
chore: bump version to 2.2.5 in package.json and refactor VlmRun node descriptions for improved readability
1 parent a747cc7 commit 55ae549

File tree

4 files changed

+70
-76
lines changed

4 files changed

+70
-76
lines changed

nodes/VlmRun/VlmRun.node.ts

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ export class VlmRun implements INodeType {
4545
{
4646
name: 'Analyze Audio',
4747
value: 'audio',
48-
description: 'Analyze audio files for transcription, speaker identification, sentiment analysis, and more',
48+
description:
49+
'Analyze audio files for transcription, speaker identification, sentiment analysis, and more',
4950
action: 'Analyze audio',
5051
},
5152
{
5253
name: 'Analyze Document',
5354
value: 'document',
54-
description: 'Extract structured data from documents such as resumes, invoices, presentations, and more',
55+
description:
56+
'Extract structured data from documents such as resumes, invoices, presentations, and more',
5557
action: 'Analyze document',
5658
},
5759
{
@@ -129,24 +131,6 @@ export class VlmRun implements INodeType {
129131
description: 'File data from previous node',
130132
},
131133
// Common Properties
132-
{
133-
displayName: 'Model',
134-
name: 'model',
135-
type: 'options',
136-
displayOptions: {
137-
show: {
138-
operation: ['document', 'image', 'audio', 'video'],
139-
},
140-
},
141-
options: [
142-
{
143-
name: 'VLM-1',
144-
value: 'vlm-1',
145-
},
146-
],
147-
default: 'vlm-1',
148-
description: 'Model to use for analysis',
149-
},
150134
{
151135
displayName: 'Domain Name or ID',
152136
name: 'domain',
@@ -160,7 +144,8 @@ export class VlmRun implements INodeType {
160144
},
161145
},
162146
default: '',
163-
description: 'Domain to use for analysis. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
147+
description:
148+
'Domain to use for analysis. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
164149
},
165150
{
166151
displayName: 'Process Asynchronously',
@@ -216,12 +201,14 @@ export class VlmRun implements INodeType {
216201
case 'document':
217202
case 'audio':
218203
case 'video': {
219-
const model = this.getNodeParameter('model', 0) as string;
204+
const model = 'vlm-1'; // Use hardcoded model value
220205
const file = this.getNodeParameter('file', i) as string;
221206
const { buffer, fileName } = await processFile(this, items[i], i, file);
222207
const domain = this.getNodeParameter('domain', 0) as string;
223208
const batch = this.getNodeParameter('processAsynchronously', 0) as boolean;
224-
const callbackUrl = batch ? this.getNodeParameter('callbackUrl', 0) as string : undefined;
209+
const callbackUrl = batch
210+
? (this.getNodeParameter('callbackUrl', 0) as string)
211+
: undefined;
225212

226213
const fileResponse = await ApiService.uploadFile(this, buffer, fileName);
227214
this.sendMessageToUI('File uploaded...');
@@ -234,11 +221,12 @@ export class VlmRun implements INodeType {
234221
callbackUrl,
235222
};
236223

237-
response = operation === 'document'
238-
? await ApiService.generateDocumentRequest(this, request)
239-
: operation === 'audio'
240-
? await ApiService.generateAudioRequest(this, request)
241-
: await ApiService.generateVideoRequest(this, request);
224+
response =
225+
operation === 'document'
226+
? await ApiService.generateDocumentRequest(this, request)
227+
: operation === 'audio'
228+
? await ApiService.generateAudioRequest(this, request)
229+
: await ApiService.generateVideoRequest(this, request);
242230
break;
243231
}
244232

@@ -288,4 +276,3 @@ export class VlmRun implements INodeType {
288276
return [returnData];
289277
}
290278
}
291-
Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
1-
import {
2-
IExecuteFunctions,
3-
INodeExecutionData,
4-
NodeOperationError,
5-
} from 'n8n-workflow';
1+
import { IExecuteFunctions, INodeExecutionData, NodeOperationError } from 'n8n-workflow';
62

73
export interface ProcessedFile {
8-
buffer: any;
9-
fileName: string;
4+
buffer: any;
5+
fileName: string;
106
}
117

128
export async function processFile(
13-
ef: IExecuteFunctions,
14-
nodeData: INodeExecutionData,
15-
index: number,
16-
binaryPropertyName = 'data',
9+
ef: IExecuteFunctions,
10+
nodeData: INodeExecutionData,
11+
index: number,
12+
binaryPropertyName = 'data',
1713
): Promise<ProcessedFile> {
18-
if (!nodeData.binary) {
19-
throw new NodeOperationError(ef.getNode(), 'No binary data exists on item!');
20-
}
14+
if (!nodeData.binary) {
15+
throw new NodeOperationError(ef.getNode(), 'No binary data exists on item!');
16+
}
2117

22-
const binaryData = nodeData.binary[binaryPropertyName];
18+
const binaryData = nodeData.binary[binaryPropertyName];
2319

24-
if (binaryData === undefined) {
25-
throw new NodeOperationError(
26-
ef.getNode(),
27-
`Binary data property "${binaryPropertyName}" does not exist on item!`,
28-
);
29-
}
20+
if (binaryData === undefined) {
21+
throw new NodeOperationError(
22+
ef.getNode(),
23+
`Binary data property "${binaryPropertyName}" does not exist on item!`,
24+
);
25+
}
3026

31-
const fileName = binaryData.fileName || 'unnamed_file';
32-
const buffer = await ef.helpers.getBinaryDataBuffer(index, binaryPropertyName);
27+
const fileName = binaryData.fileName || 'unnamed_file';
28+
const buffer = await ef.helpers.getBinaryDataBuffer(index, binaryPropertyName);
3329

34-
return { buffer, fileName };
35-
}
30+
return { buffer, fileName };
31+
}
Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
import {
2-
IExecuteFunctions,
3-
INodeExecutionData,
4-
NodeOperationError,
5-
IBinaryData,
2+
IExecuteFunctions,
3+
INodeExecutionData,
4+
NodeOperationError,
5+
IBinaryData,
66
} from 'n8n-workflow';
77
import { ImageRequest } from '../types';
88
import { ApiService } from '../ApiService';
99

10-
async function processImage(ef: IExecuteFunctions, item: INodeExecutionData, binaryPropertyName = 'data'): Promise<IBinaryData> {
11-
const binaryData = item.binary?.[binaryPropertyName];
10+
async function processImage(
11+
ef: IExecuteFunctions,
12+
item: INodeExecutionData,
13+
binaryPropertyName = 'data',
14+
): Promise<IBinaryData> {
15+
const binaryData = item.binary?.[binaryPropertyName];
1216

13-
if (!binaryData) {
14-
throw new NodeOperationError(ef.getNode(), `No binary data found for property "${binaryPropertyName}"!`);
15-
}
16-
return binaryData;
17+
if (!binaryData) {
18+
throw new NodeOperationError(
19+
ef.getNode(),
20+
`No binary data found for property "${binaryPropertyName}"!`,
21+
);
22+
}
23+
return binaryData;
1724
}
1825

19-
export async function processImageRequest(ef: IExecuteFunctions, item: INodeExecutionData, binaryPropertyName = 'data'): Promise<any> {
20-
const model = ef.getNodeParameter('model', 0) as string;
21-
const domain = ef.getNodeParameter('domain', 0) as string;
26+
export async function processImageRequest(
27+
ef: IExecuteFunctions,
28+
item: INodeExecutionData,
29+
binaryPropertyName = 'data',
30+
): Promise<any> {
31+
const model = 'vlm-1';
32+
const domain = ef.getNodeParameter('domain', 0) as string;
2233

23-
const binaryData = await processImage(ef, item, binaryPropertyName);
24-
const imageRequest: ImageRequest = {
25-
image: binaryData.data,
26-
mimeType: binaryData.mimeType,
27-
model,
28-
domain,
29-
};
34+
const binaryData = await processImage(ef, item, binaryPropertyName);
35+
const imageRequest: ImageRequest = {
36+
image: binaryData.data,
37+
mimeType: binaryData.mimeType,
38+
model,
39+
domain,
40+
};
3041

31-
return await ApiService.generateImageRequest(ef, imageRequest);
42+
return await ApiService.generateImageRequest(ef, imageRequest);
3243
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vlm-run/n8n-nodes-vlmrun",
3-
"version": "2.2.4",
3+
"version": "2.2.5",
44
"description": "VLM Run Nodes for n8n",
55
"keywords": [
66
"n8n-community-node-package"

0 commit comments

Comments
 (0)