mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Fix: Hide dataflow related functions #9869 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -9,13 +9,7 @@ import { cn, formatBytes } from '@/lib/utils';
|
|||||||
import { Routes } from '@/routes';
|
import { Routes } from '@/routes';
|
||||||
import { formatPureDate } from '@/utils/date';
|
import { formatPureDate } from '@/utils/date';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
import {
|
import { Banknote, Database, FileSearch2, GitGraph } from 'lucide-react';
|
||||||
Banknote,
|
|
||||||
Database,
|
|
||||||
DatabaseZap,
|
|
||||||
FileSearch2,
|
|
||||||
GitGraph,
|
|
||||||
} from 'lucide-react';
|
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHandleMenuClick } from './hooks';
|
import { useHandleMenuClick } from './hooks';
|
||||||
@ -34,11 +28,11 @@ export function SideBar({ refreshCount }: PropType) {
|
|||||||
|
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
const list = [
|
const list = [
|
||||||
{
|
// {
|
||||||
icon: DatabaseZap,
|
// icon: DatabaseZap,
|
||||||
label: t(`knowledgeDetails.overview`),
|
// label: t(`knowledgeDetails.overview`),
|
||||||
key: Routes.DataSetOverview,
|
// key: Routes.DataSetOverview,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
icon: Database,
|
icon: Database,
|
||||||
label: t(`knowledgeDetails.dataset`),
|
label: t(`knowledgeDetails.dataset`),
|
||||||
|
|||||||
@ -17,16 +17,9 @@ import {
|
|||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { IModalProps } from '@/interfaces/common';
|
import { IModalProps } from '@/interfaces/common';
|
||||||
import { zodResolver } from '@hookform/resolvers/zod';
|
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 { useTranslation } from 'react-i18next';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import {
|
|
||||||
DataExtractKnowledgeItem,
|
|
||||||
DataFlowItem,
|
|
||||||
EmbeddingModelItem,
|
|
||||||
ParseTypeItem,
|
|
||||||
TeamItem,
|
|
||||||
} from '../dataset/dataset-setting/configuration/common-item';
|
|
||||||
|
|
||||||
const FormId = 'dataset-creating-form';
|
const FormId = 'dataset-creating-form';
|
||||||
|
|
||||||
@ -54,10 +47,6 @@ export function InputForm({ onOk }: IModalProps<any>) {
|
|||||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
onOk?.(data.name);
|
onOk?.(data.name);
|
||||||
}
|
}
|
||||||
const parseType = useWatch({
|
|
||||||
control: form.control,
|
|
||||||
name: 'parseType',
|
|
||||||
});
|
|
||||||
return (
|
return (
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form
|
<form
|
||||||
@ -84,15 +73,6 @@ export function InputForm({ onOk }: IModalProps<any>) {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<EmbeddingModelItem line={2} />
|
|
||||||
<ParseTypeItem />
|
|
||||||
{parseType === 2 && (
|
|
||||||
<>
|
|
||||||
<DataFlowItem />
|
|
||||||
<DataExtractKnowledgeItem />
|
|
||||||
<TeamItem />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|||||||
123
web/src/pages/datasets/dataset-dataflow-creating-dialog.tsx
Normal file
123
web/src/pages/datasets/dataset-dataflow-creating-dialog.tsx
Normal file
@ -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<any>) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const FormSchema = z.object({
|
||||||
|
name: z
|
||||||
|
.string()
|
||||||
|
.min(1, {
|
||||||
|
message: t('knowledgeList.namePlaceholder'),
|
||||||
|
})
|
||||||
|
.trim(),
|
||||||
|
parseType: z.number().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const form = useForm<z.infer<typeof FormSchema>>({
|
||||||
|
resolver: zodResolver(FormSchema),
|
||||||
|
defaultValues: {
|
||||||
|
name: '',
|
||||||
|
parseType: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
|
onOk?.(data.name);
|
||||||
|
}
|
||||||
|
const parseType = useWatch({
|
||||||
|
control: form.control,
|
||||||
|
name: 'parseType',
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<Form {...form}>
|
||||||
|
<form
|
||||||
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
|
className="space-y-6"
|
||||||
|
id={FormId}
|
||||||
|
>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="name"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>
|
||||||
|
<span className="text-destructive mr-1"> *</span>
|
||||||
|
{t('knowledgeList.name')}
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Input
|
||||||
|
placeholder={t('knowledgeList.namePlaceholder')}
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<EmbeddingModelItem line={2} />
|
||||||
|
<ParseTypeItem />
|
||||||
|
{parseType === 2 && (
|
||||||
|
<>
|
||||||
|
<DataFlowItem />
|
||||||
|
<DataExtractKnowledgeItem />
|
||||||
|
<TeamItem />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</form>
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DatasetCreatingDialog({
|
||||||
|
hideModal,
|
||||||
|
onOk,
|
||||||
|
loading,
|
||||||
|
}: IModalProps<any>) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog open onOpenChange={hideModal}>
|
||||||
|
<DialogContent className="sm:max-w-[425px]">
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>{t('knowledgeList.createKnowledgeBase')}</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
<InputForm onOk={onOk}></InputForm>
|
||||||
|
<DialogFooter>
|
||||||
|
<ButtonLoading type="submit" form={FormId} loading={loading}>
|
||||||
|
{t('common.save')}
|
||||||
|
</ButtonLoading>
|
||||||
|
</DialogFooter>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user