Skip to content

Commit

Permalink
fix: Allow Node titles for LangChain nodes (#4)
Browse files Browse the repository at this point in the history
* fix: Allow Node titles for LangChain nodes

* Correctly deconstruct LC nodes
  • Loading branch information
OlegIvaniv authored Jan 4, 2024
1 parent 6833642 commit 025e7b5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import glob from "fast-glob";
import ts from "typescript";

const NODES_DIR = path.resolve("packages", "nodes-base", "nodes");
const LANGCHAIN_NODES_DIR = path.resolve("packages", "@n8n", "nodes-langchain", "nodes");

async function getDisplayNames() {
const [nodeFilepaths, versionDescriptionFilepaths] = await Promise.all([
const [nodeFilepaths, versionDescriptionFilepaths, lcNodeFilepaths, lcVersionDescriptionFilepaths] = await Promise.all([
glob(path.resolve(NODES_DIR, "**", "*.node.ts")),
glob(path.resolve(NODES_DIR, "**", "versionDescription.ts")),
glob(path.resolve(LANGCHAIN_NODES_DIR, "**", "*.node.ts")),
glob(path.resolve(LANGCHAIN_NODES_DIR, "**", "versionDescription.ts")),
]);

const nodeFiles = nodeFilepaths.reduce<string[]>((acc, cur) => {
const nodeFiles = [...nodeFilepaths, ...lcNodeFilepaths].reduce<string[]>((acc, cur) => {
let displayName = fromMajorityNodeFile(cur);

if (!displayName) {
Expand All @@ -21,7 +24,7 @@ async function getDisplayNames() {
return displayName ? [...acc, displayName] : acc;
}, []);

const versionDescriptionFiles = versionDescriptionFilepaths.reduce<string[]>(
const versionDescriptionFiles = [...versionDescriptionFilepaths, ...lcVersionDescriptionFilepaths].reduce<string[]>(
(acc, cur) => {
const displayName = fromVersionDescription(cur);

Expand Down

0 comments on commit 025e7b5

Please sign in to comment.