import { DocumentParserType } from '@/constants/knowledge'; import { useTranslate } from '@/hooks/common-hooks'; import { cn } from '@/lib/utils'; import { Switch as AntSwitch, Form, Select } from 'antd'; import { upperFirst } from 'lodash'; import { useCallback, useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; import { DatasetConfigurationContainer } from '../dataset-configuration-container'; import EntityTypesItem from '../entity-types-item'; import { FormControl, FormField, FormItem, FormLabel, FormMessage, } from '../ui/form'; import { Switch } from '../ui/switch'; const excludedTagParseMethods = [ DocumentParserType.Table, DocumentParserType.KnowledgeGraph, DocumentParserType.Tag, ]; export const showTagItems = (parserId: DocumentParserType) => { return !excludedTagParseMethods.includes(parserId); }; const enum MethodValue { General = 'general', Light = 'light', } export const excludedParseMethods = [ DocumentParserType.Table, DocumentParserType.Resume, DocumentParserType.Picture, DocumentParserType.KnowledgeGraph, DocumentParserType.Qa, DocumentParserType.Tag, ]; export const showGraphRagItems = (parserId: DocumentParserType | undefined) => { return !excludedParseMethods.some((x) => x === parserId); }; type GraphRagItemsProps = { marginBottom?: boolean; }; export function UseGraphRagItem() { const { t } = useTranslate('knowledgeConfiguration'); return (