mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-31 02:02:48 +00:00
feat: The parameter type of the parameter extraction node is recommended to be lowercase, and the parameter type of the function is missing the boolean type (#4586)
This commit is contained in:
parent
3c54c7bff7
commit
459a6709c4
|
|
@ -56,6 +56,8 @@ def valid_reference_value(_type, value, name):
|
|||
try:
|
||||
if _type == 'int':
|
||||
instance_type = int | float
|
||||
elif _type == 'boolean':
|
||||
instance_type = bool
|
||||
elif _type == 'float':
|
||||
instance_type = float | int
|
||||
elif _type == 'dict':
|
||||
|
|
@ -103,6 +105,9 @@ def convert_value(name: str, value, _type, is_required, source, node):
|
|||
value = node.workflow_manage.generate_prompt(value)
|
||||
if _type == 'int':
|
||||
return int(value)
|
||||
if _type == 'boolean':
|
||||
value = 0 if ['0', '[]'].__contains__(value) else value
|
||||
return bool(value)
|
||||
if _type == 'float':
|
||||
return float(value)
|
||||
if _type == 'dict':
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class InputField(serializers.Serializer):
|
|||
name = serializers.CharField(required=True, label=_('Variable Name'))
|
||||
is_required = serializers.BooleanField(required=True, label=_("Is this field required"))
|
||||
type = serializers.CharField(required=True, label=_("type"), validators=[
|
||||
validators.RegexValidator(regex=re.compile("^string|int|dict|array|float$"),
|
||||
validators.RegexValidator(regex=re.compile("^string|int|dict|array|float|boolean$"),
|
||||
message=_("The field only supports string|int|dict|array|float"), code=500)
|
||||
])
|
||||
source = serializers.CharField(required=True, label=_("source"), validators=[
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ def valid_reference_value(_type, value, name):
|
|||
try:
|
||||
if _type == 'int':
|
||||
instance_type = int | float
|
||||
elif _type == 'boolean':
|
||||
instance_type = bool
|
||||
elif _type == 'float':
|
||||
instance_type = float | int
|
||||
elif _type == 'dict':
|
||||
|
|
@ -82,6 +84,9 @@ def convert_value(name: str, value, _type, is_required, source, node):
|
|||
value = node.workflow_manage.generate_prompt(value)
|
||||
if _type == 'int':
|
||||
return int(value)
|
||||
if _type == 'boolean':
|
||||
value = 0 if ['0', '[]'].__contains__(value) else value
|
||||
return bool(value)
|
||||
if _type == 'float':
|
||||
return float(value)
|
||||
if _type == 'dict':
|
||||
|
|
|
|||
|
|
@ -438,6 +438,9 @@ class ToolSerializer(serializers.Serializer):
|
|||
try:
|
||||
if _type == 'int':
|
||||
return int(value)
|
||||
if _type == 'boolean':
|
||||
value = 0 if ['0', '[]'].__contains__(value) else value
|
||||
return bool(value)
|
||||
if _type == 'float':
|
||||
return float(value)
|
||||
if _type == 'dict':
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ import { ref, reactive, watch } from 'vue'
|
|||
import type { FormInstance } from 'element-plus'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { t } from '@/locales'
|
||||
const typeOptions = ['string', 'int', 'dict', 'array', 'float']
|
||||
const typeOptions = ['string', 'int', 'dict', 'array', 'float', 'boolean']
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
|
|
|
|||
|
|
@ -93,23 +93,23 @@ const emit = defineEmits(['refresh'])
|
|||
const options = [
|
||||
{
|
||||
value: 'string',
|
||||
label: 'String',
|
||||
label: 'string',
|
||||
},
|
||||
{
|
||||
value: 'number',
|
||||
label: 'Number',
|
||||
label: 'number',
|
||||
},
|
||||
{
|
||||
value: 'object',
|
||||
label: 'Object',
|
||||
label: 'object',
|
||||
},
|
||||
{
|
||||
value: 'boolean',
|
||||
label: 'Boolean',
|
||||
label: 'boolean',
|
||||
},
|
||||
{
|
||||
value: 'array',
|
||||
label: 'Array',
|
||||
label: 'array',
|
||||
},
|
||||
]
|
||||
const fieldFormRef = ref()
|
||||
|
|
|
|||
Loading…
Reference in New Issue