feat(core): Add support for building LLM applications (#7235)

This extracts all core and editor changes from #7246 and #7137, so that
we can get these changes merged first.

ADO-1120

[DB Tests](https://github.com/n8n-io/n8n/actions/runs/6379749011)
[E2E Tests](https://github.com/n8n-io/n8n/actions/runs/6379751480)
[Workflow Tests](https://github.com/n8n-io/n8n/actions/runs/6379752828)

---------

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>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-10-02 17:33:43 +02:00
committed by GitHub
parent 04dfcd73be
commit 00a4b8b0c6
93 changed files with 6209 additions and 728 deletions

View File

@@ -5,7 +5,7 @@ import type {
SimplifiedNodeType,
INodeCreateElement,
} from '@/Interface';
import { CORE_NODES_CATEGORY, DEFAULT_SUBCATEGORY } from '@/constants';
import { AI_SUBCATEGORY, CORE_NODES_CATEGORY, DEFAULT_SUBCATEGORY } from '@/constants';
import { v4 as uuidv4 } from 'uuid';
import { sublimeSearch } from '@/utils';
@@ -31,12 +31,16 @@ export function transformNodeType(
}
export function subcategorizeItems(items: SimplifiedNodeType[]) {
const WHITE_LISTED_SUBCATEGORIES = [CORE_NODES_CATEGORY, AI_SUBCATEGORY];
return items.reduce((acc: SubcategorizedNodeTypes, item) => {
// Only Core Nodes subcategories are valid, others are uncategorized
const isCoreNodesCategory = item.codex?.categories?.includes(CORE_NODES_CATEGORY);
const subcategories = isCoreNodesCategory
? item?.codex?.subcategories?.[CORE_NODES_CATEGORY] ?? []
: [DEFAULT_SUBCATEGORY];
// Only some subcategories are allowed
let subcategories: string[] = [DEFAULT_SUBCATEGORY];
WHITE_LISTED_SUBCATEGORIES.forEach((category) => {
if (item.codex?.categories?.includes(category)) {
subcategories = item.codex?.subcategories?.[category] ?? [];
}
});
subcategories.forEach((subcategory: string) => {
if (!acc[subcategory]) {