feat(Custom n8n Workflow Tool Node): Add support for tool input schema (#9470)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
oleg
2024-05-22 14:29:32 +02:00
committed by GitHub
parent ef9d4aba90
commit 2fa46b6faa
14 changed files with 373 additions and 108 deletions

View File

@@ -1,5 +1,70 @@
import type { INodeProperties } from 'n8n-workflow';
export const schemaTypeField: INodeProperties = {
displayName: 'Schema Type',
name: 'schemaType',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Generate From JSON Example',
value: 'fromJson',
description: 'Generate a schema from an example JSON object',
},
{
name: 'Define Below',
value: 'manual',
description: 'Define the JSON schema manually',
},
],
default: 'fromJson',
description: 'How to specify the schema for the function',
};
export const jsonSchemaExampleField: INodeProperties = {
displayName: 'JSON Example',
name: 'jsonSchemaExample',
type: 'json',
default: `{
"some_input": "some_value"
}`,
noDataExpression: true,
typeOptions: {
rows: 10,
},
displayOptions: {
show: {
schemaType: ['fromJson'],
},
},
description: 'Example JSON object to use to generate the schema',
};
export const inputSchemaField: INodeProperties = {
displayName: 'Input Schema',
name: 'inputSchema',
type: 'json',
default: `{
"type": "object",
"properties": {
"some_input": {
"type": "string",
"description": "Some input to the function"
}
}
}`,
noDataExpression: true,
typeOptions: {
rows: 10,
},
displayOptions: {
show: {
schemaType: ['manual'],
},
},
description: 'Schema to use for the function',
};
export const promptTypeOptions: INodeProperties = {
displayName: 'Prompt',
name: 'promptType',