mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: The float values collected by the form will be treated as ints when the decimal part is 0, resulting in a type error (#2601)
This commit is contained in:
parent
1a7f484a62
commit
8b52927b4f
|
|
@ -45,9 +45,9 @@ def get_field_value(debug_field_list, name, is_required):
|
|||
|
||||
def valid_reference_value(_type, value, name):
|
||||
if _type == 'int':
|
||||
instance_type = int
|
||||
instance_type = int | float
|
||||
elif _type == 'float':
|
||||
instance_type = float
|
||||
instance_type = float | int
|
||||
elif _type == 'dict':
|
||||
instance_type = dict
|
||||
elif _type == 'array':
|
||||
|
|
@ -70,6 +70,10 @@ def convert_value(name: str, value, _type, is_required, source, node):
|
|||
value[0],
|
||||
value[1:])
|
||||
valid_reference_value(_type, value, name)
|
||||
if _type == 'int':
|
||||
return int(value)
|
||||
if _type == 'float':
|
||||
return float(value)
|
||||
return value
|
||||
try:
|
||||
if _type == 'int':
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow):
|
|||
|
||||
def valid_reference_value(_type, value, name):
|
||||
if _type == 'int':
|
||||
instance_type = int
|
||||
instance_type = int | float
|
||||
elif _type == 'float':
|
||||
instance_type = float
|
||||
instance_type = float | int
|
||||
elif _type == 'dict':
|
||||
instance_type = dict
|
||||
elif _type == 'array':
|
||||
|
|
@ -56,6 +56,10 @@ def convert_value(name: str, value, _type, is_required, source, node):
|
|||
value[0],
|
||||
value[1:])
|
||||
valid_reference_value(_type, value, name)
|
||||
if _type == 'int':
|
||||
return int(value)
|
||||
if _type == 'float':
|
||||
return float(value)
|
||||
return value
|
||||
try:
|
||||
if _type == 'int':
|
||||
|
|
|
|||
Loading…
Reference in New Issue