data formatting of tool data

This commit is contained in:
JzoNg
2025-06-11 15:54:01 +08:00
parent 45941778c9
commit e0d7facddd
6 changed files with 41 additions and 41 deletions

View File

@ -110,16 +110,22 @@ export const getConfiguredValue = (value: Record<string, any>, formSchemas: { va
if (formSchema.type === 'boolean') {
if (typeof value === 'string')
newValues[formSchema.variable].value = value === 'true'
newValues[formSchema.variable].value = value === 'true' || value === '1'
if (typeof value === 'boolean')
newValues[formSchema.variable].value = value
if (typeof value === 'number')
newValues[formSchema.variable].value = value === 1
}
if (formSchema.type === 'number-input') {
if (typeof value === 'string' && value !== '')
newValues[formSchema.variable].value = Number.parseFloat(value)
}
if (formSchema.type === 'app-selector' || formSchema.type === 'model-selector')
newValues[formSchema.variable] = value
}
})
return newValues