From 590070e47dda0e52da2de9dfb027bd32ea708ebe Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 27 May 2025 11:44:54 +0800 Subject: [PATCH] Feat: Put buildSelectOptions to common-util.ts #3221 (#7875) ### What problem does this PR solve? Feat: Put buildSelectOptions to common-util.ts #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/pages/agent/form/begin-form/index.tsx | 2 +- web/src/utils/common-util.ts | 4 ---- web/src/utils/component-util.ts | 3 +++ 3 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 web/src/utils/component-util.ts diff --git a/web/src/pages/agent/form/begin-form/index.tsx b/web/src/pages/agent/form/begin-form/index.tsx index 46dcd7c50..60af202f1 100644 --- a/web/src/pages/agent/form/begin-form/index.tsx +++ b/web/src/pages/agent/form/begin-form/index.tsx @@ -12,7 +12,7 @@ import { RAGFlowSelect } from '@/components/ui/select'; import { Switch } from '@/components/ui/switch'; import { Textarea } from '@/components/ui/textarea'; import { FormTooltip } from '@/components/ui/tooltip'; -import { buildSelectOptions } from '@/utils/common-util'; +import { buildSelectOptions } from '@/utils/component-util'; import { Plus } from 'lucide-react'; import { useCallback } from 'react'; import { useWatch } from 'react-hook-form'; diff --git a/web/src/utils/common-util.ts b/web/src/utils/common-util.ts index 418e3de71..c602d9f3d 100644 --- a/web/src/utils/common-util.ts +++ b/web/src/utils/common-util.ts @@ -140,7 +140,3 @@ export function formatFileSize(bytes: number, si = true, dp = 1) { return nextBytes.toFixed(dp) + ' ' + units[u]; } - -export function buildSelectOptions(list: Array) { - return list.map((x) => ({ label: x, value: x })); -} diff --git a/web/src/utils/component-util.ts b/web/src/utils/component-util.ts new file mode 100644 index 000000000..724be1caa --- /dev/null +++ b/web/src/utils/component-util.ts @@ -0,0 +1,3 @@ +export function buildSelectOptions(list: Array) { + return list.map((x) => ({ label: x, value: x })); +}