diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx index 130773e0c..a715237a4 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-modal.tsx @@ -47,7 +47,22 @@ const EndpointModal: FC = ({ return } } - onSaved(tempCredential) + + // Fix: Process boolean fields to ensure they are sent as proper boolean values + const processedCredential = { ...tempCredential } + formSchemas.forEach((field) => { + if (field.type === 'boolean' && processedCredential[field.name] !== undefined) { + const value = processedCredential[field.name] + if (typeof value === 'string') + processedCredential[field.name] = value === 'true' || value === '1' || value === 'True' + else if (typeof value === 'number') + processedCredential[field.name] = value === 1 + else if (typeof value === 'boolean') + processedCredential[field.name] = value + } + }) + + onSaved(processedCredential) } return ( diff --git a/web/app/components/tools/utils/to-form-schema.ts b/web/app/components/tools/utils/to-form-schema.ts index ee7f3379a..ae43e6f15 100644 --- a/web/app/components/tools/utils/to-form-schema.ts +++ b/web/app/components/tools/utils/to-form-schema.ts @@ -63,6 +63,16 @@ export const addDefaultValue = (value: Record, formSchemas: { varia const itemValue = value[formSchema.variable] if ((formSchema.default !== undefined) && (value === undefined || itemValue === null || itemValue === '' || itemValue === undefined)) newValues[formSchema.variable] = formSchema.default + + // Fix: Convert boolean field values to proper boolean type + if (formSchema.type === 'boolean' && itemValue !== undefined && itemValue !== null && itemValue !== '') { + if (typeof itemValue === 'string') + newValues[formSchema.variable] = itemValue === 'true' || itemValue === '1' || itemValue === 'True' + else if (typeof itemValue === 'number') + newValues[formSchema.variable] = itemValue === 1 + else if (typeof itemValue === 'boolean') + newValues[formSchema.variable] = itemValue + } }) return newValues }