diff --git a/src/api/system.ts b/src/api/system.ts new file mode 100644 index 000000000..5c977f22d --- /dev/null +++ b/src/api/system.ts @@ -0,0 +1,3 @@ +import { GET, POST, PUT } from './request'; + +export const getFilling = () => GET<{ beianText: string }>('/system/getFiling'); diff --git a/src/pages/api/system/getFiling.ts b/src/pages/api/system/getFiling.ts new file mode 100644 index 000000000..1b9e273c0 --- /dev/null +++ b/src/pages/api/system/getFiling.ts @@ -0,0 +1,11 @@ +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction +import type { NextApiRequest, NextApiResponse } from 'next'; +import { jsonRes } from '@/service/response'; + +export default async function handler(req: NextApiRequest, res: NextApiResponse) { + jsonRes(res, { + data: { + beianText: process.env.SAFE_BEIAN_TEXT || '' + } + }); +} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index cf21bd625..8078f56c7 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -3,6 +3,8 @@ import { Card, Box, Link } from '@chakra-ui/react'; import Markdown from '@/components/Markdown'; import { useMarkdown } from '@/hooks/useMarkdown'; import { useRouter } from 'next/router'; +import { getFilling } from '@/api/system'; +import { useQuery } from '@tanstack/react-query'; const Home = () => { const { inviterId } = useRouter().query as { inviterId: string }; @@ -14,6 +16,8 @@ const Home = () => { } }, [inviterId]); + const { data: { beianText = '' } = {} } = useQuery(['init'], getFilling); + return ( @@ -21,11 +25,12 @@ const Home = () => { - + {beianText && ( - 浙ICP备2023011255号-1 + {beianText} - + )} + Made by FastGpt Team. diff --git a/src/pages/login/components/ForgetPasswordForm.tsx b/src/pages/login/components/ForgetPasswordForm.tsx index a26bdd272..ea5a7076a 100644 --- a/src/pages/login/components/ForgetPasswordForm.tsx +++ b/src/pages/login/components/ForgetPasswordForm.tsx @@ -95,7 +95,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => { {!!errors.username && errors.username.message} - + { {!!errors.code && errors.code.message} - + { {!!errors.password && errors.password.message} - + { {!!errors.username && errors.username.message} - + { {!!errors.code && errors.code.message} - + { {!!errors.password && errors.password.message} - + { height="100%" w={'100%'} maxW={'1240px'} - maxH={['auto', '660px']} + maxH={['auto', 'max(660px,80vh)']} backgroundColor={'#fff'} alignItems={'center'} justifyContent={'center'} diff --git a/src/pages/model/components/detail/components/InputDataModal.tsx b/src/pages/model/components/detail/components/InputDataModal.tsx index 5203daca1..912135a02 100644 --- a/src/pages/model/components/detail/components/InputDataModal.tsx +++ b/src/pages/model/components/detail/components/InputDataModal.tsx @@ -44,6 +44,13 @@ const InputDataModal = ({ */ const sureImportData = useCallback( async (e: FormData) => { + if (e.a.length + e.q.length >= 3000) { + toast({ + title: '总长度超长了', + status: 'warning' + }); + return; + } setImporting(true); try { @@ -66,7 +73,11 @@ const InputDataModal = ({ q: '' }); onSuccess(); - } catch (err) { + } catch (err: any) { + toast({ + title: err?.message || '出现了点意外~', + status: 'error' + }); console.log(err); } setImporting(false); @@ -121,8 +132,8 @@ const InputDataModal = ({ {'匹配的知识点'}