feat(core): Update LLM applications building support (no-changelog) (#7710)

extracted out of #7336

---------

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
Co-authored-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-11-28 16:47:28 +01:00
committed by GitHub
parent 4a89504d54
commit 117962d473
58 changed files with 1135 additions and 183 deletions

View File

@@ -0,0 +1,47 @@
import type { INodeTypeData, INodeTypeDescription } from 'n8n-workflow';
import {
AGENT_NODE_TYPE,
MANUAL_CHAT_TRIGGER_NODE_TYPE,
MANUAL_TRIGGER_NODE_TYPE,
} from '@/constants';
import nodeTypesJson from '../../../nodes-base/dist/types/nodes.json';
const allNodeTypes = [...nodeTypesJson];
function findNodeWithName(name: string): INodeTypeDescription {
return allNodeTypes.find((node) => node.name === name) as INodeTypeDescription;
}
export const testingNodeTypes: INodeTypeData = {
[MANUAL_TRIGGER_NODE_TYPE]: {
sourcePath: '',
type: {
description: findNodeWithName(MANUAL_TRIGGER_NODE_TYPE),
},
},
[MANUAL_CHAT_TRIGGER_NODE_TYPE]: {
sourcePath: '',
type: {
description: findNodeWithName(MANUAL_CHAT_TRIGGER_NODE_TYPE),
},
},
[AGENT_NODE_TYPE]: {
sourcePath: '',
type: {
description: findNodeWithName(AGENT_NODE_TYPE),
},
},
};
export const defaultMockNodeTypes: INodeTypeData = {
[MANUAL_TRIGGER_NODE_TYPE]: testingNodeTypes[MANUAL_TRIGGER_NODE_TYPE],
};
export function mockNodeTypesToArray(nodeTypes: INodeTypeData): INodeTypeDescription[] {
return Object.values(nodeTypes).map(
(nodeType) => nodeType.type.description as INodeTypeDescription,
);
}
export const defaultMockNodeTypesArray: INodeTypeDescription[] =
mockNodeTypesToArray(defaultMockNodeTypes);