🐛 fix(directory_reader.py): fix the name of the custom component to always be "CustomComponent" for consistency

🐛 fix(directory_reader.py): add the output types of the custom component to the component template to ensure correct behavior
🐛 fix(types.py): add the output types of the custom component to the component template to ensure correct behavior
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-03 14:22:20 -03:00
commit c207f0aa4b
2 changed files with 5 additions and 2 deletions

View file

@ -227,12 +227,13 @@ class DirectoryReader:
component_name = filename.split(".")[0]
# This is the name of the file which will be displayed in the UI
# We need to change it from snake_case to CamelCase
camel_case_name = " ".join(
component_name_camelcase = " ".join(
word.title() for word in component_name.split("_")
)
component_info = {
"name": camel_case_name,
"name": "CustomComponent",
"output_types": [component_name_camelcase],
"file": filename,
"code": result_content if validation_result else "",
"error": "" if validation_result else result_content,

View file

@ -330,12 +330,14 @@ def build_valid_menu(valid_components):
try:
component_name = component["name"]
component_code = component["code"]
component_output_types = component["output_types"]
component_extractor = CustomComponent(code=component_code)
component_extractor.is_check_valid()
component_template = build_langchain_template_custom_component(
component_extractor
)
component_template["output_types"] = component_output_types
valid_menu[menu_name][component_name] = component_template