diff --git a/web/src/components/top-n-item.tsx b/web/src/components/top-n-item.tsx index 636a7a4f0..3fd760233 100644 --- a/web/src/components/top-n-item.tsx +++ b/web/src/components/top-n-item.tsx @@ -50,7 +50,7 @@ export function TopNFormField({ max = 30 }: SimilaritySliderFormFieldProps) { name={'top_n'} render={({ field }) => ( - {t('topN')} + {t('topN')} diff --git a/web/src/pages/agent/form-sheet/use-form-config-map.tsx b/web/src/pages/agent/form-sheet/use-form-config-map.tsx index a2ef2aceb..6a61fd830 100644 --- a/web/src/pages/agent/form-sheet/use-form-config-map.tsx +++ b/web/src/pages/agent/form-sheet/use-form-config-map.tsx @@ -125,23 +125,36 @@ export function useFormConfigMap() { }, [Operator.Baidu]: { component: BaiduForm, - defaultValues: {}, - schema: z.object({}), + defaultValues: { top_n: 10 }, + schema: z.object({ top_n: z.number() }), }, [Operator.DuckDuckGo]: { component: DuckDuckGoForm, - defaultValues: {}, - schema: z.object({}), + defaultValues: { + top_n: 10, + channel: 'text', + }, + schema: z.object({ + top_n: z.number(), + }), }, [Operator.KeywordExtract]: { component: KeywordExtractForm, - defaultValues: {}, - schema: z.object({}), + defaultValues: { top_n: 3 }, + schema: z.object({ + llm_id: z.string(), + top_n: z.number(), + }), }, [Operator.Wikipedia]: { component: WikipediaForm, - defaultValues: {}, - schema: z.object({}), + defaultValues: { + top_n: 10, + }, + schema: z.object({ + language: z.string(), + top_n: z.number(), + }), }, [Operator.PubMed]: { component: PubMedForm, @@ -206,13 +219,22 @@ export function useFormConfigMap() { }, [Operator.WenCai]: { component: WenCaiForm, - defaultValues: {}, - schema: z.object({}), + defaultValues: { + top_n: 20, + }, + schema: z.object({ + top_n: z.number(), + query_type: z.string(), + }), }, [Operator.AkShare]: { component: AkShareForm, - defaultValues: {}, - schema: z.object({}), + defaultValues: { + top_n: 10, + }, + schema: z.object({ + top_n: z.number(), + }), }, [Operator.YahooFinance]: { component: YahooFinanceForm, diff --git a/web/src/pages/agent/form/akshare-form/index.tsx b/web/src/pages/agent/form/akshare-form/index.tsx index 1f7ce99f1..1cfd554b1 100644 --- a/web/src/pages/agent/form/akshare-form/index.tsx +++ b/web/src/pages/agent/form/akshare-form/index.tsx @@ -1,19 +1,20 @@ -import TopNItem from '@/components/top-n-item'; -import { Form } from 'antd'; -import { IOperatorForm } from '../../interface'; -import DynamicInputVariable from '../components/dynamic-input-variable'; +import { TopNFormField } from '@/components/top-n-item'; +import { Form } from '@/components/ui/form'; +import { INextOperatorForm } from '../../interface'; +import { DynamicInputVariable } from '../components/next-dynamic-input-variable'; -const AkShareForm = ({ onValuesChange, form, node }: IOperatorForm) => { +const AkShareForm = ({ form, node }: INextOperatorForm) => { return ( -
- - + + { + e.preventDefault(); + }} + > + + +
); }; diff --git a/web/src/pages/agent/form/baidu-form/index.tsx b/web/src/pages/agent/form/baidu-form/index.tsx index 0c866e488..0861ef829 100644 --- a/web/src/pages/agent/form/baidu-form/index.tsx +++ b/web/src/pages/agent/form/baidu-form/index.tsx @@ -1,19 +1,20 @@ -import TopNItem from '@/components/top-n-item'; -import { Form } from 'antd'; -import { IOperatorForm } from '../../interface'; -import DynamicInputVariable from '../components/dynamic-input-variable'; +import { TopNFormField } from '@/components/top-n-item'; +import { Form } from '@/components/ui/form'; +import { INextOperatorForm } from '../../interface'; +import { DynamicInputVariable } from '../components/next-dynamic-input-variable'; -const BaiduForm = ({ onValuesChange, form, node }: IOperatorForm) => { +const BaiduForm = ({ form, node }: INextOperatorForm) => { return ( -
- - + + { + e.preventDefault(); + }} + > + + +
); }; diff --git a/web/src/pages/agent/form/duckduckgo-form/index.tsx b/web/src/pages/agent/form/duckduckgo-form/index.tsx index 53462da31..1595857ac 100644 --- a/web/src/pages/agent/form/duckduckgo-form/index.tsx +++ b/web/src/pages/agent/form/duckduckgo-form/index.tsx @@ -1,12 +1,20 @@ -import TopNItem from '@/components/top-n-item'; +import { TopNFormField } from '@/components/top-n-item'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { RAGFlowSelect } from '@/components/ui/select'; import { useTranslate } from '@/hooks/common-hooks'; -import { Form, Select } from 'antd'; import { useMemo } from 'react'; import { Channel } from '../../constant'; -import { IOperatorForm } from '../../interface'; -import DynamicInputVariable from '../components/dynamic-input-variable'; +import { INextOperatorForm } from '../../interface'; +import { DynamicInputVariable } from '../components/next-dynamic-input-variable'; -const DuckDuckGoForm = ({ onValuesChange, form, node }: IOperatorForm) => { +const DuckDuckGoForm = ({ form, node }: INextOperatorForm) => { const { t } = useTranslate('flow'); const options = useMemo(() => { @@ -14,23 +22,29 @@ const DuckDuckGoForm = ({ onValuesChange, form, node }: IOperatorForm) => { }, [t]); return ( -
- - - + { + e.preventDefault(); + }} > - - + + + ( + + {t('channel')} + + + + + + )} + /> + ); }; diff --git a/web/src/pages/agent/form/keyword-extract-form/index.tsx b/web/src/pages/agent/form/keyword-extract-form/index.tsx index 089df5eab..5ec092a35 100644 --- a/web/src/pages/agent/form/keyword-extract-form/index.tsx +++ b/web/src/pages/agent/form/keyword-extract-form/index.tsx @@ -1,30 +1,46 @@ -import LLMSelect from '@/components/llm-select'; -import TopNItem from '@/components/top-n-item'; -import { useTranslate } from '@/hooks/common-hooks'; -import { Form } from 'antd'; -import { IOperatorForm } from '../../interface'; -import DynamicInputVariable from '../components/dynamic-input-variable'; +import { NextLLMSelect } from '@/components/llm-select'; +import { TopNFormField } from '@/components/top-n-item'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { useTranslation } from 'react-i18next'; +import { INextOperatorForm } from '../../interface'; +import { DynamicInputVariable } from '../components/next-dynamic-input-variable'; -const KeywordExtractForm = ({ onValuesChange, form, node }: IOperatorForm) => { - const { t } = useTranslate('flow'); +const KeywordExtractForm = ({ form, node }: INextOperatorForm) => { + const { t } = useTranslation(); return ( -
- - + { + e.preventDefault(); + }} > - - - + + ( + + + {t('chat.model')} + + + + + + + )} + /> + + ); }; diff --git a/web/src/pages/agent/form/wencai-form/index.tsx b/web/src/pages/agent/form/wencai-form/index.tsx index 7c44c182f..631ccbed1 100644 --- a/web/src/pages/agent/form/wencai-form/index.tsx +++ b/web/src/pages/agent/form/wencai-form/index.tsx @@ -1,34 +1,53 @@ -import TopNItem from '@/components/top-n-item'; -import { useTranslate } from '@/hooks/common-hooks'; -import { Form, Select } from 'antd'; +import { TopNFormField } from '@/components/top-n-item'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { RAGFlowSelect } from '@/components/ui/select'; import { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; import { WenCaiQueryTypeOptions } from '../../constant'; -import { IOperatorForm } from '../../interface'; -import DynamicInputVariable from '../components/dynamic-input-variable'; +import { INextOperatorForm } from '../../interface'; +import { DynamicInputVariable } from '../components/next-dynamic-input-variable'; -const WenCaiForm = ({ onValuesChange, form, node }: IOperatorForm) => { - const { t } = useTranslate('flow'); +const WenCaiForm = ({ form, node }: INextOperatorForm) => { + const { t } = useTranslation(); const wenCaiQueryTypeOptions = useMemo(() => { return WenCaiQueryTypeOptions.map((x) => ({ value: x, - label: t(`wenCaiQueryTypeOptions.${x}`), + label: t(`flow.wenCaiQueryTypeOptions.${x}`), })); }, [t]); return ( -
- - - - - + + { + e.preventDefault(); + }} + > + + + ( + + {t('flow.queryType')} + + + + + + )} + /> + ); }; diff --git a/web/src/pages/agent/form/wikipedia-form/index.tsx b/web/src/pages/agent/form/wikipedia-form/index.tsx index 9e28bf21d..1364aa24d 100644 --- a/web/src/pages/agent/form/wikipedia-form/index.tsx +++ b/web/src/pages/agent/form/wikipedia-form/index.tsx @@ -1,26 +1,46 @@ -import TopNItem from '@/components/top-n-item'; +import { TopNFormField } from '@/components/top-n-item'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { RAGFlowSelect } from '@/components/ui/select'; import { useTranslate } from '@/hooks/common-hooks'; -import { Form, Select } from 'antd'; import { LanguageOptions } from '../../constant'; -import { IOperatorForm } from '../../interface'; -import DynamicInputVariable from '../components/dynamic-input-variable'; +import { INextOperatorForm } from '../../interface'; +import { DynamicInputVariable } from '../components/next-dynamic-input-variable'; -const WikipediaForm = ({ onValuesChange, form, node }: IOperatorForm) => { +const WikipediaForm = ({ form, node }: INextOperatorForm) => { const { t } = useTranslate('common'); return ( -
- - - - - + + { + e.preventDefault(); + }} + > + + + + ( + + {t('language')} + + + + + + )} + /> + ); };