import { RAGFlowFormItem } from '@/components/ragflow-form'; import { RAGFlowSelect } from '@/components/ui/select'; import { Switch } from '@/components/ui/switch'; import { LLMFactory } from '@/constants/llm'; import { buildOptions } from '@/utils/form'; import { useFormContext, useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; const parseMethodOptions = buildOptions(['auto', 'txt', 'ocr']); const languageOptions = buildOptions([ 'English', 'Chinese', 'Traditional Chinese', 'Russian', 'Ukrainian', 'Indonesian', 'Spanish', 'Vietnamese', 'Japanese', 'Korean', 'Portuguese BR', 'German', 'French', 'Italian', 'Tamil', 'Telugu', 'Kannada', 'Thai', 'Greek', 'Hindi', ]); export function MinerUOptionsFormField({ namePrefix = 'parser_config', }: { namePrefix?: string; }) { const form = useFormContext(); const { t } = useTranslation(); const buildName = (field: string) => namePrefix ? `${namePrefix}.${field}` : field; const layoutRecognize = useWatch({ control: form.control, name: 'parser_config.layout_recognize', }); // Check if MinerU is selected (the value contains 'MinerU' or matches the factory name) const isMinerUSelected = layoutRecognize?.includes(LLMFactory.MinerU) || layoutRecognize?.toLowerCase()?.includes('mineru'); if (!isMinerUSelected) { return null; } return (
{t('knowledgeConfiguration.mineruOptions', 'MinerU Options')}
{(field) => ( )} {(field) => ( )} {(field) => ( )} {(field) => ( )}
); }