import SvgIcon from '@/components/svg-icon'; import { Card } from '@/components/ui/card'; import { FormControl, FormField, FormItem, FormLabel, FormMessage, } from '@/components/ui/form'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import { useTranslate } from '@/hooks/common-hooks'; import { useSelectParserList } from '@/hooks/user-setting-hooks'; import { Col, Divider, Empty, Row, Typography } from 'antd'; import DOMPurify from 'dompurify'; import camelCase from 'lodash/camelCase'; import { useMemo } from 'react'; import { useFormContext } from 'react-hook-form'; import styles from './index.less'; import { ImageMap } from './utils'; const { Title, Text } = Typography; const CategoryPanel = ({ chunkMethod }: { chunkMethod: string }) => { const parserList = useSelectParserList(); const { t } = useTranslate('knowledgeConfiguration'); const item = useMemo(() => { const item = parserList.find((x) => x.value === chunkMethod); if (item) { return { title: item.label, description: t(camelCase(item.value)), }; } return { title: '', description: '' }; }, [parserList, chunkMethod, t]); const imageList = useMemo(() => { if (chunkMethod in ImageMap) { return ImageMap[chunkMethod as keyof typeof ImageMap]; } return []; }, [chunkMethod]); return ( {imageList.length > 0 ? ( <> {`"${item.title}" ${t('methodTitle')}`} {`"${item.title}" ${t('methodExamples')}`} {t('methodExamplesDescription')} {imageList.map((x) => ( ))} {item.title} {t('dialogueExamplesTitle')} > ) : ( {t('methodEmpty')} )} ); }; export default function ChunkMethodCard() { const { t } = useTranslate('knowledgeConfiguration'); const form = useFormContext(); return ( ( {t('chunkMethod')} m@example.com m@google.com m@support.com )} /> ); }
{t('methodEmpty')}