Refactor process_type function to handle lowercase field types

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-02-22 15:20:27 -03:00
commit 7e6c77ee4f

View file

@ -121,7 +121,13 @@ def get_field_properties(extra_field):
def process_type(field_type: str):
if field_type.startswith("list") or field_type.startswith("List"):
return extract_inner_type(field_type)
return "prompt" if field_type == "Prompt" else field_type
# field_type is a string can be Prompt or Code too
# so we just need to lower if it is the case
lowercase_type = field_type.lower()
if lowercase_type in ["prompt", "code"]:
return lowercase_type
return field_type
def add_new_custom_field(