import { RAGFlowFormItem } from '@/components/ragflow-form'; import { Input } from '@/components/ui/input'; import { RAGFlowSelect } from '@/components/ui/select'; import { LLMFactory } from '@/constants/llm'; import { buildOptions } from '@/utils/form'; import { useFormContext, useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; const algorithmOptions = buildOptions(['PaddleOCR-VL']); export function PaddleOCROptionsFormField({ 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 PaddleOCR is selected (the value contains 'PaddleOCR' or matches the factory name) const isPaddleOCRSelected = layoutRecognize?.includes(LLMFactory.PaddleOCR) || layoutRecognize?.toLowerCase()?.includes('paddleocr'); if (!isPaddleOCRSelected) { return null; } return (
{t('knowledgeConfiguration.paddleocrOptions', 'PaddleOCR Options')}
{(field) => ( )} {(field) => ( )} {(field) => ( )}
); }