From 6622ce6ad8d59733f4f5e06d93dbea8436457b76 Mon Sep 17 00:00:00 2001 From: twwu Date: Fri, 13 Jun 2025 18:32:36 +0800 Subject: [PATCH] fix: update formData construction in convertToInputFieldFormData for improved handling of optional fields fix: adjust z-index value in DialogWrapper for proper stacking context --- .../components/input-field/editor/utils.ts | 27 +++++++++++++------ .../input-field/preview/dialog-wrapper.tsx | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/web/app/components/rag-pipeline/components/input-field/editor/utils.ts b/web/app/components/rag-pipeline/components/input-field/editor/utils.ts index 9f8aba3ecf..528718cb01 100644 --- a/web/app/components/rag-pipeline/components/input-field/editor/utils.ts +++ b/web/app/components/rag-pipeline/components/input-field/editor/utils.ts @@ -25,23 +25,34 @@ export const convertToInputFieldFormData = (data?: InputVar): FormData => { allowed_file_extensions, } = data || getNewInputVarInRagPipeline() - return { + const formData: FormData = { type, label, variable, maxLength: max_length, - default: default_value, required, - tooltips, options, - placeholder, - unit, - allowedFileUploadMethods: allowed_file_upload_methods, - allowedTypesAndExtensions: { + allowedTypesAndExtensions: {}, + } + + if (default_value !== undefined && default_value !== null) + formData.default = default_value + if (tooltips !== undefined && tooltips !== null) + formData.tooltips = tooltips + if (placeholder !== undefined && placeholder !== null) + formData.placeholder = placeholder + if (unit !== undefined && unit !== null) + formData.unit = unit + if (allowed_file_upload_methods) + formData.allowedFileUploadMethods = allowed_file_upload_methods + if (allowed_file_types && allowed_file_extensions) { + formData.allowedTypesAndExtensions = { allowedFileTypes: allowed_file_types, allowedFileExtensions: allowed_file_extensions, - }, + } } + + return formData } export const convertFormDataToINputField = (data: FormData): InputVar => { diff --git a/web/app/components/rag-pipeline/components/input-field/preview/dialog-wrapper.tsx b/web/app/components/rag-pipeline/components/input-field/preview/dialog-wrapper.tsx index a94ed49f59..087ad42089 100644 --- a/web/app/components/rag-pipeline/components/input-field/preview/dialog-wrapper.tsx +++ b/web/app/components/rag-pipeline/components/input-field/preview/dialog-wrapper.tsx @@ -21,7 +21,7 @@ const DialogWrapper = ({ const close = useCallback(() => onClose?.(), [onClose]) return ( - +