🔧 fix(types.py): add exception handling when evaluating field_value using ast.literal_eval to prevent potential errors
🔀 chore(types.py): import ast and contextlib modules for future use
This commit is contained in:
parent
18949de603
commit
dc8097ebd7
1 changed files with 4 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import ast
|
||||
import contextlib
|
||||
from typing import Any
|
||||
from langflow.interface.agents.base import agent_creator
|
||||
from langflow.interface.chains.base import chain_creator
|
||||
|
|
@ -250,6 +252,8 @@ def get_field_properties(extra_field):
|
|||
if not field_required:
|
||||
field_type = extract_type_from_optional(field_type)
|
||||
|
||||
with contextlib.suppress(Exception):
|
||||
field_value = ast.literal_eval(field_value)
|
||||
return field_name, field_type, field_value, field_required
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue