Skip to content

Commit

Permalink
prevent code fields to show on group node (langflow-ai#1035)
Browse files Browse the repository at this point in the history
refactor(reactflowUtils.ts): change display_name of generated group node
from "group Component" to "Group" for better clarity and understanding
  • Loading branch information
anovazzi1 committed Oct 10, 2023
2 parents 66700bd + 7f9a4a1 commit a95db60
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/frontend/src/utils/reactflowUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,10 @@ function updateGroupNodeTemplate(template: APITemplateType) {
) {
template[key].advanced = true;
}
//prevent code fields from showing on the group node
if (type === "code") {
template[key].show = false;
}
});
return template;
}
Expand All @@ -669,10 +673,7 @@ export function mergeNodeTemplates({
Object.keys(nodeTemplate)
.filter((field_name) => field_name.charAt(0) !== "_")
.forEach((key) => {
if (
nodeTemplate[key].show &&
!isHandleConnected(edges, key, nodeTemplate[key], node.id)
) {
if (!isHandleConnected(edges, key, nodeTemplate[key], node.id)) {
template[key + "_" + node.id] = nodeTemplate[key];
template[key + "_" + node.id].proxy = { id: node.id, field: key };
if (node.type === "groupNode") {
Expand Down Expand Up @@ -764,7 +765,7 @@ export function generateNodeFromFlow(
type: outputNode?.data.type!,
node: {
output_types: outputNode!.data.node!.output_types,
display_name: "group Component",
display_name: "Group",
documentation: "",
base_classes: outputNode!.data.node!.base_classes,
description: "double click to edit description",
Expand Down

0 comments on commit a95db60

Please sign in to comment.