From 8a4a6720d17f8abd1d5cfcb8cfb4b22c5e1a66a9 Mon Sep 17 00:00:00 2001 From: twwu Date: Tue, 25 Mar 2025 16:37:31 +0800 Subject: [PATCH] fix: update placeholder format and enhance enum value handling in advanced options --- .../visual-editor/edit-card/advanced-options.tsx | 2 +- .../visual-editor/edit-card/index.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-options.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-options.tsx index a672fa4c02..4fff9dab75 100644 --- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-options.tsx +++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/advanced-options.tsx @@ -55,7 +55,7 @@ const AdvancedOptions: FC = ({ value={enumValue} onChange={handleEnumChange} onBlur={handleEnumBlur} - placeholder={'\'abcd\', 1, 1.5, \'etc\''} + placeholder={'abcd, 1, 1.5, etc.'} /> diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx index 2359cb0690..241b45387e 100644 --- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx +++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx @@ -144,7 +144,9 @@ const EditCard: FC = ({ }, [isAdvancedEditing, emitPropertyOptionsChange, currentFields]) const handleAdvancedOptionsChange = useCallback((options: AdvancedOptionsType) => { - const enumValue = options.enum.replace(/\s/g, '').split(',') + let enumValue: SchemaEnumType = options.enum.replace(/\s/g, '').split(',') + if (currentFields.type === Type.number) + enumValue = enumValue.map(value => Number(value)).filter(num => !Number.isNaN(num)) setCurrentFields(prev => ({ ...prev, enum: enumValue })) if (isAdvancedEditing) return emitPropertyOptionsChange({ description: currentFields.description, enum: enumValue })