🐛 fix(types.py): change update_display_name_and_description function name to update_attributes to reflect its purpose more accurately

🐛 fix(component.py): change field_config key to beta in template_config dictionary to match the expected key
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-03 11:43:18 -03:00
commit c86fd2f741
2 changed files with 8 additions and 5 deletions

View file

@ -63,8 +63,8 @@ class Component(BaseModel):
elif "description" in item_name:
template_config["description"] = ast.literal_eval(item_value)
elif "field_config" in item_name:
template_config["field_config"] = ast.literal_eval(item_value)
elif "beta" in item_name:
template_config["beta"] = ast.literal_eval(item_value)
return template_config

View file

@ -145,7 +145,7 @@ def add_code_field(template, raw_code, field_config):
"dynamic": True,
"required": True,
"placeholder": "",
"show": True,
"show": field_config.pop("show", True),
"multiline": True,
"value": raw_code,
"password": False,
@ -186,7 +186,7 @@ def build_frontend_node(custom_component: CustomComponent):
return None
def update_display_name_and_description(frontend_node, template_config):
def update_attributes(frontend_node, template_config):
"""Update the display name and description of a frontend node"""
if "display_name" in template_config:
frontend_node["display_name"] = template_config["display_name"]
@ -194,6 +194,9 @@ def update_display_name_and_description(frontend_node, template_config):
if "description" in template_config:
frontend_node["description"] = template_config["description"]
if "beta" in template_config:
frontend_node["beta"] = template_config["beta"]
def build_field_config(custom_component: CustomComponent):
"""Build the field configuration for a custom component"""
@ -281,7 +284,7 @@ def build_langchain_template_custom_component(custom_component: CustomComponent)
template_config = custom_component.build_template_config
update_display_name_and_description(frontend_node, template_config)
update_attributes(frontend_node, template_config)
field_config = build_field_config(custom_component)
add_extra_fields(