feat(OpenAI Node): Allow to select Image analyze model & improve types (#9660)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
@@ -6,8 +6,13 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import { updateDisplayOptions, NodeOperationError } from 'n8n-workflow';
|
||||
import { apiRequest } from '../../transport';
|
||||
import { modelRLC } from '../descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
...modelRLC('imageModelSearch'),
|
||||
displayOptions: { show: { '@version': [{ _cnd: { gte: 1.4 } }] } },
|
||||
},
|
||||
{
|
||||
displayName: 'Text Input',
|
||||
name: 'text',
|
||||
@@ -123,7 +128,11 @@ const displayOptions = {
|
||||
export const description = updateDisplayOptions(displayOptions, properties);
|
||||
|
||||
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
|
||||
const model = 'gpt-4-vision-preview';
|
||||
let model = 'gpt-4-vision-preview';
|
||||
if (this.getNode().typeVersion >= 1.4) {
|
||||
model = this.getNodeParameter('modelId', i, 'gpt-4o', { extractValue: true }) as string;
|
||||
}
|
||||
|
||||
const text = this.getNodeParameter('text', i, '') as string;
|
||||
const inputType = this.getNodeParameter('inputType', i) as string;
|
||||
const options = this.getNodeParameter('options', i, {});
|
||||
|
||||
Reference in New Issue
Block a user