🐛 fix(loading.py): handle case when "handle_keys" is not in params dictionary and add input_variable to "handle_keys" list

The code now checks if the "handle_keys" key is present in the params dictionary. If it is not present, it creates an empty list and adds the input_variable to it. This ensures that the "handle_keys" list is always present and the input_variable is correctly added to it.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-29 19:31:01 -03:00
commit 1743edfd1d

View file

@ -142,6 +142,13 @@ def instantiate_prompt(node_type, class_object, params):
for item in variable
]
)
# handle_keys will be a list but it does not exist yet
# so we need to create it
if "handle_keys" not in params:
format_kwargs["handle_keys"] = []
# Add the handle_keys to the list
format_kwargs["handle_keys"].append(input_variable)
return prompt, format_kwargs