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[],
|
||||
): Array<NodeConnectionType | INodeInputConfiguration> => {
|
||||
const displayNames: { [key: string]: string } = {
|
||||
[NodeConnectionType.AiLanguageModel]: 'Model',
|
||||
[NodeConnectionType.AiMemory]: 'Memory',
|
||||
[NodeConnectionType.AiTool]: 'Tool',
|
||||
[NodeConnectionType.AiOutputParser]: 'Output Parser',
|
||||
ai_languageModel: 'Model',
|
||||
ai_memory: 'Memory',
|
||||
ai_tool: 'Tool',
|
||||
ai_outputParser: 'Output Parser',
|
||||
};
|
||||
|
||||
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;
|
||||
if (
|
||||
isModelType &&
|
||||
@@ -65,11 +65,9 @@ function getInputs(
|
||||
type,
|
||||
displayName,
|
||||
required: isModelType,
|
||||
maxConnections: [
|
||||
NodeConnectionType.AiLanguageModel,
|
||||
NodeConnectionType.AiMemory,
|
||||
NodeConnectionType.AiOutputParser,
|
||||
].includes(type as NodeConnectionType)
|
||||
maxConnections: ['ai_languageModel', 'ai_memory', 'ai_outputParser'].includes(
|
||||
type as NodeConnectionType,
|
||||
)
|
||||
? 1
|
||||
: undefined,
|
||||
};
|
||||
|
||||
@@ -14,11 +14,11 @@ import { getTemplateNoticeField } from '@utils/sharedFields';
|
||||
*/
|
||||
export function getInputs(parameters: IDataObject) {
|
||||
const inputs = [
|
||||
{ displayName: '', type: NodeConnectionType.Main },
|
||||
{ displayName: '', type: 'main' },
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
@@ -29,7 +29,7 @@ export function getInputs(parameters: IDataObject) {
|
||||
if (hasOutputParser === undefined || hasOutputParser === true) {
|
||||
inputs.push({
|
||||
displayName: 'Output Parser',
|
||||
type: NodeConnectionType.AiOutputParser,
|
||||
type: 'ai_outputParser',
|
||||
maxConnections: 1,
|
||||
required: false,
|
||||
});
|
||||
|
||||
@@ -25,11 +25,11 @@ function getInputs(parameters: IDataObject) {
|
||||
const chunkingMode = parameters?.chunkingMode;
|
||||
const operationMode = parameters?.operationMode;
|
||||
const inputs = [
|
||||
{ displayName: '', type: NodeConnectionType.Main },
|
||||
{ displayName: '', type: 'main' },
|
||||
{
|
||||
displayName: 'Model',
|
||||
maxConnections: 1,
|
||||
type: NodeConnectionType.AiLanguageModel,
|
||||
type: 'ai_languageModel',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
@@ -37,7 +37,7 @@ function getInputs(parameters: IDataObject) {
|
||||
if (operationMode === 'documentLoader') {
|
||||
inputs.push({
|
||||
displayName: 'Document',
|
||||
type: NodeConnectionType.AiDocument,
|
||||
type: 'ai_document',
|
||||
required: true,
|
||||
maxConnections: 1,
|
||||
});
|
||||
@@ -47,7 +47,7 @@ function getInputs(parameters: IDataObject) {
|
||||
if (chunkingMode === 'advanced') {
|
||||
inputs.push({
|
||||
displayName: 'Text Splitter',
|
||||
type: NodeConnectionType.AiTextSplitter,
|
||||
type: 'ai_textSplitter',
|
||||
required: false,
|
||||
maxConnections: 1,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user