mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix: Replace ai nodes enum strings with hard-coded values (no-changelog) (#14091)
This commit is contained in:
@@ -46,14 +46,14 @@ function getInputs(
|
|||||||
inputs: SpecialInput[],
|
inputs: SpecialInput[],
|
||||||
): Array<NodeConnectionType | INodeInputConfiguration> => {
|
): Array<NodeConnectionType | INodeInputConfiguration> => {
|
||||||
const displayNames: { [key: string]: string } = {
|
const displayNames: { [key: string]: string } = {
|
||||||
[NodeConnectionType.AiLanguageModel]: 'Model',
|
ai_languageModel: 'Model',
|
||||||
[NodeConnectionType.AiMemory]: 'Memory',
|
ai_memory: 'Memory',
|
||||||
[NodeConnectionType.AiTool]: 'Tool',
|
ai_tool: 'Tool',
|
||||||
[NodeConnectionType.AiOutputParser]: 'Output Parser',
|
ai_outputParser: 'Output Parser',
|
||||||
};
|
};
|
||||||
|
|
||||||
return inputs.map(({ type, filter }) => {
|
return inputs.map(({ type, filter }) => {
|
||||||
const isModelType = type === NodeConnectionType.AiLanguageModel;
|
const isModelType = type === ('ai_languageModel' as NodeConnectionType);
|
||||||
let displayName = type in displayNames ? displayNames[type] : undefined;
|
let displayName = type in displayNames ? displayNames[type] : undefined;
|
||||||
if (
|
if (
|
||||||
isModelType &&
|
isModelType &&
|
||||||
@@ -65,11 +65,9 @@ function getInputs(
|
|||||||
type,
|
type,
|
||||||
displayName,
|
displayName,
|
||||||
required: isModelType,
|
required: isModelType,
|
||||||
maxConnections: [
|
maxConnections: ['ai_languageModel', 'ai_memory', 'ai_outputParser'].includes(
|
||||||
NodeConnectionType.AiLanguageModel,
|
type as NodeConnectionType,
|
||||||
NodeConnectionType.AiMemory,
|
)
|
||||||
NodeConnectionType.AiOutputParser,
|
|
||||||
].includes(type as NodeConnectionType)
|
|
||||||
? 1
|
? 1
|
||||||
: undefined,
|
: undefined,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import { getTemplateNoticeField } from '@utils/sharedFields';
|
|||||||
*/
|
*/
|
||||||
export function getInputs(parameters: IDataObject) {
|
export function getInputs(parameters: IDataObject) {
|
||||||
const inputs = [
|
const inputs = [
|
||||||
{ displayName: '', type: NodeConnectionType.Main },
|
{ displayName: '', type: 'main' },
|
||||||
{
|
{
|
||||||
displayName: 'Model',
|
displayName: 'Model',
|
||||||
maxConnections: 1,
|
maxConnections: 1,
|
||||||
type: NodeConnectionType.AiLanguageModel,
|
type: 'ai_languageModel',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -29,7 +29,7 @@ export function getInputs(parameters: IDataObject) {
|
|||||||
if (hasOutputParser === undefined || hasOutputParser === true) {
|
if (hasOutputParser === undefined || hasOutputParser === true) {
|
||||||
inputs.push({
|
inputs.push({
|
||||||
displayName: 'Output Parser',
|
displayName: 'Output Parser',
|
||||||
type: NodeConnectionType.AiOutputParser,
|
type: 'ai_outputParser',
|
||||||
maxConnections: 1,
|
maxConnections: 1,
|
||||||
required: false,
|
required: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ function getInputs(parameters: IDataObject) {
|
|||||||
const chunkingMode = parameters?.chunkingMode;
|
const chunkingMode = parameters?.chunkingMode;
|
||||||
const operationMode = parameters?.operationMode;
|
const operationMode = parameters?.operationMode;
|
||||||
const inputs = [
|
const inputs = [
|
||||||
{ displayName: '', type: NodeConnectionType.Main },
|
{ displayName: '', type: 'main' },
|
||||||
{
|
{
|
||||||
displayName: 'Model',
|
displayName: 'Model',
|
||||||
maxConnections: 1,
|
maxConnections: 1,
|
||||||
type: NodeConnectionType.AiLanguageModel,
|
type: 'ai_languageModel',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -37,7 +37,7 @@ function getInputs(parameters: IDataObject) {
|
|||||||
if (operationMode === 'documentLoader') {
|
if (operationMode === 'documentLoader') {
|
||||||
inputs.push({
|
inputs.push({
|
||||||
displayName: 'Document',
|
displayName: 'Document',
|
||||||
type: NodeConnectionType.AiDocument,
|
type: 'ai_document',
|
||||||
required: true,
|
required: true,
|
||||||
maxConnections: 1,
|
maxConnections: 1,
|
||||||
});
|
});
|
||||||
@@ -47,7 +47,7 @@ function getInputs(parameters: IDataObject) {
|
|||||||
if (chunkingMode === 'advanced') {
|
if (chunkingMode === 'advanced') {
|
||||||
inputs.push({
|
inputs.push({
|
||||||
displayName: 'Text Splitter',
|
displayName: 'Text Splitter',
|
||||||
type: NodeConnectionType.AiTextSplitter,
|
type: 'ai_textSplitter',
|
||||||
required: false,
|
required: false,
|
||||||
maxConnections: 1,
|
maxConnections: 1,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user