mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Migrate NodeConnectionType to const object type (no-changelog) (#14078)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import type {
|
||||
INodeInputConfiguration,
|
||||
INodeInputFilter,
|
||||
@@ -7,6 +7,7 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
INodeProperties,
|
||||
NodeConnectionType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { promptTypeOptions, textFromPreviousNode, textInput } from '@utils/descriptions';
|
||||
@@ -85,7 +86,7 @@ function getInputs(
|
||||
if (agent === 'conversationalAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
filter: {
|
||||
nodes: [
|
||||
'@n8n/n8n-nodes-langchain.lmChatAnthropic',
|
||||
@@ -103,19 +104,19 @@ function getInputs(
|
||||
},
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: 'ai_memory',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'toolsAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
filter: {
|
||||
nodes: [
|
||||
'@n8n/n8n-nodes-langchain.lmChatAnthropic',
|
||||
@@ -133,20 +134,20 @@ function getInputs(
|
||||
},
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: 'ai_memory',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'openAiFunctionsAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
filter: {
|
||||
nodes: [
|
||||
'@n8n/n8n-nodes-langchain.lmChatOpenAi',
|
||||
@@ -155,57 +156,55 @@ function getInputs(
|
||||
},
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: 'ai_memory',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'reActAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'sqlAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiMemory,
|
||||
type: 'ai_memory',
|
||||
},
|
||||
];
|
||||
} else if (agent === 'planAndExecuteAgent') {
|
||||
specialInputs = [
|
||||
{
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiTool,
|
||||
type: 'ai_tool',
|
||||
},
|
||||
{
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (hasOutputParser === false) {
|
||||
specialInputs = specialInputs.filter(
|
||||
(input) => input.type !== NodeConnectionType.AiOutputParser,
|
||||
);
|
||||
specialInputs = specialInputs.filter((input) => input.type !== 'ai_outputParser');
|
||||
}
|
||||
return [NodeConnectionType.Main, ...getInputData(specialInputs)];
|
||||
return ['main', ...getInputData(specialInputs)];
|
||||
}
|
||||
|
||||
const agentTypeProperty: INodeProperties = {
|
||||
@@ -290,7 +289,7 @@ export class Agent implements INodeType {
|
||||
return getInputs(agent, hasOutputParser)
|
||||
})($parameter.agent, $parameter.hasOutputParser === undefined || $parameter.hasOutputParser === true)
|
||||
}}`,
|
||||
outputs: [NodeConnectionType.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
|
||||
@@ -430,7 +429,7 @@ export class Agent implements INodeType {
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${NodeConnectionType.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,
|
||||
displayName: `Connect an <a data-action='openSelectiveNodeCreator' data-action-parameter-connectiontype='${NodeConnectionTypes.AiOutputParser}'>output parser</a> on the canvas to specify the output format you require`,
|
||||
name: 'notice',
|
||||
type: 'notice',
|
||||
default: '',
|
||||
|
||||
Reference in New Issue
Block a user