@n8n/n8n-nodes-langchain
Version:

75 lines • 2.52 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var description_exports = {};
__export(description_exports, {
configureNodeInputs: () => configureNodeInputs,
prettifyOperation: () => prettifyOperation
});
module.exports = __toCommonJS(description_exports);
const prettifyOperation = (resource, operation) => {
if (operation === "deleteAssistant") {
return "Delete Assistant";
}
if (operation === "deleteFile") {
return "Delete File";
}
if (operation === "classify") {
return "Classify Text";
}
if (operation === "message" && resource === "text") {
return "Message Model";
}
const capitalize = (str) => {
const chars = str.split("");
chars[0] = chars[0].toUpperCase();
return chars.join("");
};
if (["transcribe", "translate"].includes(operation)) {
resource = "recording";
}
if (operation === "list") {
resource = resource + "s";
}
return `${capitalize(operation)} ${capitalize(resource)}`;
};
const configureNodeInputs = (resource, operation, hideTools, memory) => {
if (resource === "assistant" && operation === "message") {
const inputs = [
{ type: "main" },
{ type: "ai_tool", displayName: "Tools" }
];
if (memory !== "threadId") {
inputs.push({ type: "ai_memory", displayName: "Memory", maxConnections: 1 });
}
return inputs;
}
if (resource === "text" && (operation === "message" || operation === "response")) {
if (hideTools === "hide") {
return ["main"];
}
return [{ type: "main" }, { type: "ai_tool", displayName: "Tools" }];
}
return ["main"];
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
configureNodeInputs,
prettifyOperation
});
//# sourceMappingURL=description.js.map