diff --git a/web/src/pages/dataset/sidebar/index.tsx b/web/src/pages/dataset/sidebar/index.tsx index bcc160e22..a93414a30 100644 --- a/web/src/pages/dataset/sidebar/index.tsx +++ b/web/src/pages/dataset/sidebar/index.tsx @@ -9,13 +9,7 @@ import { cn, formatBytes } from '@/lib/utils'; import { Routes } from '@/routes'; import { formatPureDate } from '@/utils/date'; import { isEmpty } from 'lodash'; -import { - Banknote, - Database, - DatabaseZap, - FileSearch2, - GitGraph, -} from 'lucide-react'; +import { Banknote, Database, FileSearch2, GitGraph } from 'lucide-react'; import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useHandleMenuClick } from './hooks'; @@ -34,11 +28,11 @@ export function SideBar({ refreshCount }: PropType) { const items = useMemo(() => { const list = [ - { - icon: DatabaseZap, - label: t(`knowledgeDetails.overview`), - key: Routes.DataSetOverview, - }, + // { + // icon: DatabaseZap, + // label: t(`knowledgeDetails.overview`), + // key: Routes.DataSetOverview, + // }, { icon: Database, label: t(`knowledgeDetails.dataset`), diff --git a/web/src/pages/datasets/dataset-creating-dialog.tsx b/web/src/pages/datasets/dataset-creating-dialog.tsx index 5bf28758b..dce755746 100644 --- a/web/src/pages/datasets/dataset-creating-dialog.tsx +++ b/web/src/pages/datasets/dataset-creating-dialog.tsx @@ -17,16 +17,9 @@ import { import { Input } from '@/components/ui/input'; import { IModalProps } from '@/interfaces/common'; import { zodResolver } from '@hookform/resolvers/zod'; -import { useForm, useWatch } from 'react-hook-form'; +import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import { z } from 'zod'; -import { - DataExtractKnowledgeItem, - DataFlowItem, - EmbeddingModelItem, - ParseTypeItem, - TeamItem, -} from '../dataset/dataset-setting/configuration/common-item'; const FormId = 'dataset-creating-form'; @@ -54,10 +47,6 @@ export function InputForm({ onOk }: IModalProps) { function onSubmit(data: z.infer) { onOk?.(data.name); } - const parseType = useWatch({ - control: form.control, - name: 'parseType', - }); return (
) { )} /> - - - {parseType === 2 && ( - <> - - - - - )} ); diff --git a/web/src/pages/datasets/dataset-dataflow-creating-dialog.tsx b/web/src/pages/datasets/dataset-dataflow-creating-dialog.tsx new file mode 100644 index 000000000..5bf28758b --- /dev/null +++ b/web/src/pages/datasets/dataset-dataflow-creating-dialog.tsx @@ -0,0 +1,123 @@ +import { ButtonLoading } from '@/components/ui/button'; +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { IModalProps } from '@/interfaces/common'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { useForm, useWatch } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { z } from 'zod'; +import { + DataExtractKnowledgeItem, + DataFlowItem, + EmbeddingModelItem, + ParseTypeItem, + TeamItem, +} from '../dataset/dataset-setting/configuration/common-item'; + +const FormId = 'dataset-creating-form'; + +export function InputForm({ onOk }: IModalProps) { + const { t } = useTranslation(); + + const FormSchema = z.object({ + name: z + .string() + .min(1, { + message: t('knowledgeList.namePlaceholder'), + }) + .trim(), + parseType: z.number().optional(), + }); + + const form = useForm>({ + resolver: zodResolver(FormSchema), + defaultValues: { + name: '', + parseType: 1, + }, + }); + + function onSubmit(data: z.infer) { + onOk?.(data.name); + } + const parseType = useWatch({ + control: form.control, + name: 'parseType', + }); + return ( +
+ + ( + + + * + {t('knowledgeList.name')} + + + + + + + )} + /> + + + {parseType === 2 && ( + <> + + + + + )} + + + ); +} + +export function DatasetCreatingDialog({ + hideModal, + onOk, + loading, +}: IModalProps) { + const { t } = useTranslation(); + + return ( + + + + {t('knowledgeList.createKnowledgeBase')} + + + + + {t('common.save')} + + + + + ); +}