🔨 refactor(custom_component.py): read build method
This commit is contained in:
parent
15d0327f62
commit
2c6b88f4f9
2 changed files with 8 additions and 1 deletions
|
|
@ -189,3 +189,6 @@ class CustomComponent(Component, extra=Extra.allow):
|
||||||
if not flow:
|
if not flow:
|
||||||
raise ValueError(f"Flow {flow_name or flow_id} not found")
|
raise ValueError(f"Flow {flow_name or flow_id} not found")
|
||||||
return self.load_flow(flow.id, tweaks)
|
return self.load_flow(flow.id, tweaks)
|
||||||
|
|
||||||
|
def build(self, *args: Any, **kwargs: Any) -> Any:
|
||||||
|
raise NotImplementedError
|
||||||
|
|
|
||||||
|
|
@ -331,6 +331,7 @@ def build_valid_menu(valid_components):
|
||||||
valid_menu[menu_name] = {}
|
valid_menu[menu_name] = {}
|
||||||
|
|
||||||
for component in menu_item["components"]:
|
for component in menu_item["components"]:
|
||||||
|
logger.debug(f"Building component: {component}")
|
||||||
try:
|
try:
|
||||||
component_name = component["name"]
|
component_name = component["name"]
|
||||||
component_code = component["code"]
|
component_code = component["code"]
|
||||||
|
|
@ -346,7 +347,10 @@ def build_valid_menu(valid_components):
|
||||||
valid_menu[menu_name][component_name] = component_template
|
valid_menu[menu_name][component_name] = component_template
|
||||||
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error(f"Error while building custom component: {exc}")
|
logger.error(f"Error loading Component: {component}")
|
||||||
|
logger.exception(
|
||||||
|
f"Error while building custom component {component_output_types}: {exc}"
|
||||||
|
)
|
||||||
|
|
||||||
return valid_menu
|
return valid_menu
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue