From 6431b50fa6e98ed24ff0222e311be36df6f45b96 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 3 Jul 2023 23:11:08 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(base.py):=20change=20custom?= =?UTF-8?q?=5Ffields=20default=20value=20from=20an=20empty=20list=20to=20a?= =?UTF-8?q?=20defaultdict=20to=20prevent=20potential=20errors=20The=20cust?= =?UTF-8?q?om=5Ffields=20attribute=20in=20the=20FrontendNode=20class=20now?= =?UTF-8?q?=20has=20a=20default=20value=20of=20defaultdict(list)=20instead?= =?UTF-8?q?=20of=20an=20empty=20list.=20This=20change=20ensures=20that=20c?= =?UTF-8?q?ustom=5Ffields=20is=20always=20a=20defaultdict,=20which=20preve?= =?UTF-8?q?nts=20potential=20errors=20when=20accessing=20or=20modifying=20?= =?UTF-8?q?the=20custom=5Ffields=20attribute.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/template/frontend_node/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/template/frontend_node/base.py b/src/backend/langflow/template/frontend_node/base.py index 0ac19351b..7dae45463 100644 --- a/src/backend/langflow/template/frontend_node/base.py +++ b/src/backend/langflow/template/frontend_node/base.py @@ -1,3 +1,4 @@ +from collections import defaultdict import re from typing import List, Optional @@ -47,7 +48,7 @@ class FrontendNode(BaseModel): name: str = "" display_name: str = "" documentation: str = "" - custom_fields: List[str] = [] + custom_fields: defaultdict = defaultdict(list) output_types: List[str] = [] field_formatters: FieldFormatters = Field(default_factory=FieldFormatters)