mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: the input field of tool panel not worked as expected (#6003)
This commit is contained in:
parent
ab847c81fa
commit
eee779a923
|
@ -154,7 +154,7 @@ class ToolManager:
|
|||
'invoke_from': invoke_from,
|
||||
'tool_invoke_from': tool_invoke_from,
|
||||
})
|
||||
|
||||
|
||||
elif provider_type == 'api':
|
||||
if tenant_id is None:
|
||||
raise ValueError('tenant id is required for api provider')
|
||||
|
@ -201,7 +201,7 @@ class ToolManager:
|
|||
init runtime parameter
|
||||
"""
|
||||
parameter_value = parameters.get(parameter_rule.name)
|
||||
if not parameter_value:
|
||||
if not parameter_value and parameter_value != 0:
|
||||
# get default value
|
||||
parameter_value = parameter_rule.default
|
||||
if not parameter_value and parameter_rule.required:
|
||||
|
@ -321,14 +321,14 @@ class ToolManager:
|
|||
if cls._builtin_providers_loaded:
|
||||
yield from list(cls._builtin_providers.values())
|
||||
return
|
||||
|
||||
|
||||
with cls._builtin_provider_lock:
|
||||
if cls._builtin_providers_loaded:
|
||||
yield from list(cls._builtin_providers.values())
|
||||
return
|
||||
|
||||
|
||||
yield from cls._list_builtin_providers()
|
||||
|
||||
|
||||
@classmethod
|
||||
def _list_builtin_providers(cls) -> Generator[BuiltinToolProviderController, None, None]:
|
||||
"""
|
||||
|
@ -492,7 +492,7 @@ class ToolManager:
|
|||
|
||||
controller = ApiToolProviderController.from_db(
|
||||
provider,
|
||||
ApiProviderAuthType.API_KEY if provider.credentials['auth_type'] == 'api_key' else
|
||||
ApiProviderAuthType.API_KEY if provider.credentials['auth_type'] == 'api_key' else
|
||||
ApiProviderAuthType.NONE
|
||||
)
|
||||
controller.load_bundled_tools(provider.tools)
|
||||
|
|
|
@ -191,6 +191,7 @@ const SimpleSelect: FC<ISelectProps> = ({
|
|||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
setSelectedItem(null)
|
||||
onSelect({ value: null })
|
||||
}}
|
||||
className="h-5 w-5 text-gray-400 cursor-pointer"
|
||||
aria-hidden="false"
|
||||
|
|
|
@ -114,7 +114,7 @@ const Form: FC<FormProps> = ({
|
|||
validated={validatedSuccess}
|
||||
placeholder={placeholder?.[language] || placeholder?.en_US}
|
||||
disabled={disabed}
|
||||
type={formSchema.type === FormTypeEnum.textNumber ? 'number' : 'text'}
|
||||
type={formSchema.type === FormTypeEnum.textNumber ? 'number' : formSchema.type === FormTypeEnum.secretInput ? 'password' : 'text'}
|
||||
{...(formSchema.type === FormTypeEnum.textNumber ? { min: (formSchema as CredentialFormSchemaNumberInput).min, max: (formSchema as CredentialFormSchemaNumberInput).max } : {})}
|
||||
/>
|
||||
{fieldMoreInfo?.(formSchema)}
|
||||
|
@ -229,6 +229,7 @@ const Form: FC<FormProps> = ({
|
|||
variable,
|
||||
label,
|
||||
show_on,
|
||||
required,
|
||||
} = formSchema as CredentialFormSchemaRadio
|
||||
|
||||
if (show_on.length && !show_on.every(showOnItem => value[showOnItem.variable] === showOnItem.value))
|
||||
|
@ -239,11 +240,16 @@ const Form: FC<FormProps> = ({
|
|||
<div className='flex items-center justify-between py-2 text-sm text-gray-900'>
|
||||
<div className='flex items-center space-x-2'>
|
||||
<span className={cn(fieldLabelClassName, 'py-2 text-sm text-gray-900')}>{label[language] || label.en_US}</span>
|
||||
{
|
||||
required && (
|
||||
<span className='ml-1 text-red-500'>*</span>
|
||||
)
|
||||
}
|
||||
{tooltipContent}
|
||||
</div>
|
||||
<Radio.Group
|
||||
className='flex items-center'
|
||||
value={value[variable] ? 1 : 0}
|
||||
value={value[variable] === null ? undefined : (value[variable] ? 1 : 0)}
|
||||
onChange={val => handleFormChange(variable, val === 1)}
|
||||
>
|
||||
<Radio value={1} className='!mr-1'>True</Radio>
|
||||
|
|
|
@ -53,7 +53,7 @@ const Input: FC<InputProps> = ({
|
|||
onChange={e => onChange(e.target.value)}
|
||||
onBlur={e => toLimit(e.target.value)}
|
||||
onFocus={onFocus}
|
||||
value={value || ''}
|
||||
value={value}
|
||||
disabled={disabled}
|
||||
type={type}
|
||||
min={min}
|
||||
|
|
Loading…
Reference in New Issue
Block a user