import { useTranslate } from '@/hooks/common-hooks'; import { Divider, Form, Select, Switch } from 'antd'; import { upperFirst } from 'lodash'; import { useCallback, useMemo } from 'react'; import EntityTypesItem from '../entity-types-item'; const excludedTagParseMethods = ['table', 'knowledge_graph', 'tag']; export const showTagItems = (parserId: string) => { return !excludedTagParseMethods.includes(parserId); }; const enum MethodValue { General = 'general', Light = 'light', } export const excludedParseMethods = [ 'table', 'resume', 'picture', 'knowledge_graph', 'qa', 'tag', ]; export const showGraphRagItems = (parserId: string) => { return !excludedParseMethods.includes(parserId); }; // The three types "table", "resume" and "one" do not display this configuration. const GraphRagItems = () => { const { t } = useTranslate('knowledgeConfiguration'); const methodOptions = useMemo(() => { return [MethodValue.Light, MethodValue.General].map((x) => ({ value: x, label: upperFirst(x), })); }, []); const renderWideTooltip = useCallback( (title: React.ReactNode | string) => { return { title: typeof title === 'string' ? t(title) : title, overlayInnerStyle: { width: '50vw' }, }; }, [t], ); return ( <> prevValues.parser_config.graphrag.use_graphrag !== curValues.parser_config.graphrag.use_graphrag } > {({ getFieldValue }) => { const useRaptor = getFieldValue([ 'parser_config', 'graphrag', 'use_graphrag', ]); return ( useRaptor && ( <> , )} initialValue={MethodValue.Light} >