Skip to content

Commit 80e0043

Browse files
committed
fix: The float values collected by the form will be treated as ints when the decimal part is 0, resulting in a type error
1 parent 1a7f484 commit 80e0043

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

apps/application/flow/step_node/function_lib_node/impl/base_function_lib_node.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ def get_field_value(debug_field_list, name, is_required):
4545

4646
def valid_reference_value(_type, value, name):
4747
if _type == 'int':
48-
instance_type = int
48+
instance_type = int | float
4949
elif _type == 'float':
50-
instance_type = float
50+
instance_type = float | int
5151
elif _type == 'dict':
5252
instance_type = dict
5353
elif _type == 'array':
@@ -70,6 +70,10 @@ def convert_value(name: str, value, _type, is_required, source, node):
7070
value[0],
7171
value[1:])
7272
valid_reference_value(_type, value, name)
73+
if _type == 'int':
74+
return int(value)
75+
if _type == 'float':
76+
return float(value)
7377
return value
7478
try:
7579
if _type == 'int':

apps/application/flow/step_node/function_node/impl/base_function_node.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow):
3333

3434
def valid_reference_value(_type, value, name):
3535
if _type == 'int':
36-
instance_type = int
36+
instance_type = int | float
3737
elif _type == 'float':
38-
instance_type = float
38+
instance_type = float | int
3939
elif _type == 'dict':
4040
instance_type = dict
4141
elif _type == 'array':
@@ -56,6 +56,10 @@ def convert_value(name: str, value, _type, is_required, source, node):
5656
value[0],
5757
value[1:])
5858
valid_reference_value(_type, value, name)
59+
if _type == 'int':
60+
return int(value)
61+
if _type == 'float':
62+
return float(value)
5963
return value
6064
try:
6165
if _type == 'int':

0 commit comments

Comments
 (0)