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)
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
shaohuzhang1 2025-03-18 16:40:15 +08:00 committed by GitHub
parent 1a7f484a62
commit 8b52927b4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -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':

View File

@ -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':