diff --git a/web/src/layouts/components/right-toolbar/index.tsx b/web/src/layouts/components/right-toolbar/index.tsx index d720e4a3e..3a570c749 100644 --- a/web/src/layouts/components/right-toolbar/index.tsx +++ b/web/src/layouts/components/right-toolbar/index.tsx @@ -9,7 +9,7 @@ import { useTheme } from '@/components/theme-provider'; import { LanguageList, LanguageMap } from '@/constants/common'; import { useChangeLanguage } from '@/hooks/logic-hooks'; import { useFetchUserInfo } from '@/hooks/user-setting-hooks'; -import { MoonIcon, SunIcon } from 'lucide-react'; +import { CircleHelp, MoonIcon, SunIcon } from 'lucide-react'; import styled from './index.less'; const Circle = ({ children, ...restProps }: React.PropsWithChildren) => { @@ -24,6 +24,10 @@ const handleGithubCLick = () => { window.open('https://github.com/infiniflow/ragflow', 'target'); }; +const handleDocHelpCLick = () => { + window.open('https://ragflow.io/docs/dev/category/guides', 'target'); +}; + const RightToolBar = () => { const { t } = useTranslate('common'); const changeLanguage = useChangeLanguage(); @@ -63,6 +67,9 @@ const RightToolBar = () => { + + + {theme === 'dark' ? ( 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 6a61fd830..83334da92 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 @@ -158,8 +158,11 @@ export function useFormConfigMap() { }, [Operator.PubMed]: { component: PubMedForm, - defaultValues: {}, - schema: z.object({}), + defaultValues: { top_n: 10 }, + schema: z.object({ + top_n: z.number(), + email: z.string(), + }), }, [Operator.ArXiv]: { component: ArXivForm, diff --git a/web/src/pages/agent/form/message-form/index.tsx b/web/src/pages/agent/form/message-form/index.tsx index 6040b929d..01e744a91 100644 --- a/web/src/pages/agent/form/message-form/index.tsx +++ b/web/src/pages/agent/form/message-form/index.tsx @@ -1,85 +1,80 @@ -import { useTranslate } from '@/hooks/common-hooks'; -import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; -import { Button, Form, Input } from 'antd'; -import { IOperatorForm } from '../../interface'; +import { Button } from '@/components/ui/button'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { Textarea } from '@/components/ui/textarea'; +import { PlusCircle, Trash2 } from 'lucide-react'; +import { useFieldArray } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { INextOperatorForm } from '../../interface'; -import styles from './index.less'; - -const formItemLayout = { - labelCol: { - sm: { span: 6 }, - }, - wrapperCol: { - sm: { span: 18 }, - }, -}; - -const formItemLayoutWithOutLabel = { - wrapperCol: { - sm: { span: 18, offset: 6 }, - }, -}; - -const MessageForm = ({ onValuesChange, form }: IOperatorForm) => { - const { t } = useTranslate('flow'); +const MessageForm = ({ form }: INextOperatorForm) => { + const { t } = useTranslation(); + const { fields, append, remove } = useFieldArray({ + name: 'messages', + control: form.control, + }); return ( - - - {(fields, { add, remove }, {}) => ( - <> + + { + e.preventDefault(); + }} + > + + {t('flow.msg')} + {fields.map((field, index) => ( - - - - - {fields.length > 1 ? ( - remove(field.name)} - /> - ) : null} - + + ( + + + + + + )} + /> + {fields.length > 1 && ( + remove(index)} + className="cursor-pointer text-colors-text-functional-danger" + > + + + )} + ))} - - add()} - style={{ width: '80%' }} - icon={} - > - {t('addMessage')} - - - > - )} - + + append(' ')} // "" will cause the inability to add, refer to: https://github.com/orgs/react-hook-form/discussions/8485#discussioncomment-2961861 + className="w-full mt-4" + > + + {t('flow.addMessage')} + + + + + ); }; diff --git a/web/src/pages/agent/form/pubmed-form/index.tsx b/web/src/pages/agent/form/pubmed-form/index.tsx index a10962b6e..7532d09ee 100644 --- a/web/src/pages/agent/form/pubmed-form/index.tsx +++ b/web/src/pages/agent/form/pubmed-form/index.tsx @@ -1,30 +1,44 @@ -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 { Input } from '@/components/ui/input'; import { useTranslate } from '@/hooks/common-hooks'; -import { Form, Input } from 'antd'; -import { IOperatorForm } from '../../interface'; -import DynamicInputVariable from '../components/dynamic-input-variable'; +import { INextOperatorForm } from '../../interface'; +import { DynamicInputVariable } from '../components/next-dynamic-input-variable'; -const PubMedForm = ({ onValuesChange, form, node }: IOperatorForm) => { +const PubMedForm = ({ form, node }: INextOperatorForm) => { const { t } = useTranslate('flow'); return ( - - - - + { + e.preventDefault(); + }} > - - + + + ( + + {t('email')} + + + + + + )} + /> + ); };