This commit is contained in:
archer
2023-05-11 17:29:46 +08:00
parent 451f234f68
commit 3e4b165ed9
7 changed files with 45 additions and 15 deletions

3
src/api/system.ts Normal file
View File

@@ -0,0 +1,3 @@
import { GET, POST, PUT } from './request';
export const getFilling = () => GET<{ beianText: string }>('/system/getFiling');

View File

@@ -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 || ''
}
});
}

View File

@@ -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 (
<Box p={[5, 10]}>
<Card p={5} lineHeight={2}>
@@ -21,11 +25,12 @@ const Home = () => {
</Card>
<Card p={5} mt={4} textAlign={'center'}>
<Box>
{beianText && (
<Link href="https://beian.miit.gov.cn/" target="_blank">
ICP备2023011255号-1
{beianText}
</Link>
</Box>
)}
<Box>Made by FastGpt Team.</Box>
</Card>
</Box>

View File

@@ -95,7 +95,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
{!!errors.username && errors.username.message}
</FormErrorMessage>
</FormControl>
<FormControl mt={5} isInvalid={!!errors.username}>
<FormControl mt={8} isInvalid={!!errors.username}>
<Flex>
<Input
flex={1}
@@ -121,7 +121,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
{!!errors.code && errors.code.message}
</FormErrorMessage>
</FormControl>
<FormControl mt={5} isInvalid={!!errors.password}>
<FormControl mt={8} isInvalid={!!errors.password}>
<Input
type={'password'}
placeholder="新密码"
@@ -142,7 +142,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
{!!errors.password && errors.password.message}
</FormErrorMessage>
</FormControl>
<FormControl mt={5} isInvalid={!!errors.password2}>
<FormControl mt={8} isInvalid={!!errors.password2}>
<Input
type={'password'}
placeholder="确认密码"

View File

@@ -103,7 +103,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
{!!errors.username && errors.username.message}
</FormErrorMessage>
</FormControl>
<FormControl mt={5} isInvalid={!!errors.username}>
<FormControl mt={8} isInvalid={!!errors.username}>
<Flex>
<Input
flex={1}
@@ -129,7 +129,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
{!!errors.code && errors.code.message}
</FormErrorMessage>
</FormControl>
<FormControl mt={5} isInvalid={!!errors.password}>
<FormControl mt={8} isInvalid={!!errors.password}>
<Input
type={'password'}
placeholder="密码"
@@ -150,7 +150,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
{!!errors.password && errors.password.message}
</FormErrorMessage>
</FormControl>
<FormControl mt={5} isInvalid={!!errors.password2}>
<FormControl mt={8} isInvalid={!!errors.password2}>
<Input
type={'password'}
placeholder="确认密码"

View File

@@ -74,7 +74,7 @@ const Login = ({ isPcDevice }: { isPcDevice: boolean }) => {
height="100%"
w={'100%'}
maxW={'1240px'}
maxH={['auto', '660px']}
maxH={['auto', 'max(660px,80vh)']}
backgroundColor={'#fff'}
alignItems={'center'}
justifyContent={'center'}

View File

@@ -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 = ({
<Box flex={1} mr={[0, 4]} mb={[4, 0]} h={['230px', '100%']}>
<Box h={'30px'}>{'匹配的知识点'}</Box>
<Textarea
placeholder={'匹配的知识点。这部分内容会被搜索,请把控内容的质量。最多 1500 字。'}
maxLength={1500}
placeholder={'匹配的知识点。这部分内容会被搜索,请把控内容的质量。总和最多 3000 字。'}
maxLength={3000}
resize={'none'}
h={'calc(100% - 30px)'}
{...register(`q`, {
@@ -134,9 +145,9 @@ const InputDataModal = ({
<Box h={'30px'}></Box>
<Textarea
placeholder={
'补充知识。这部分内容不会被搜索,但会作为"匹配的知识点"的内容补充,你可以讲一些细节的内容填写在这里。最多 1500 字。'
'补充知识。这部分内容不会被搜索,但会作为"匹配的知识点"的内容补充,你可以讲一些细节的内容填写在这里。总和最多 3000 字。'
}
maxLength={1500}
maxLength={3000}
resize={'none'}
h={'calc(100% - 30px)'}
{...register('a')}