feat: Initialize component inputs with default values

The code changes in `component.py` initialize component inputs with default values if they are not provided. This ensures that the inputs are always set, even if they are not explicitly passed. Additionally, the commit message follows the established convention of using a prefix to indicate the type of change.
This commit is contained in:
ogabrielluiz 2024-06-18 19:17:16 -03:00
commit c51e311aa5

View file

@ -80,6 +80,11 @@ class Component(CustomComponent):
if key in self.__dict__:
raise ValueError(f"Key {key} already exists in {self.__class__.__name__}")
setattr(self, key, value)
for key, input_obj in self._inputs.items():
if not hasattr(self, key):
setattr(self, key, input_obj.value or None)
if key not in params:
params[key] = input_obj.value or None
self._arguments = params
def _set_outputs(self, outputs: List[dict]):