mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
perf: ui
This commit is contained in:
3
src/api/system.ts
Normal file
3
src/api/system.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { GET, POST, PUT } from './request';
|
||||
|
||||
export const getFilling = () => GET<{ beianText: string }>('/system/getFiling');
|
11
src/pages/api/system/getFiling.ts
Normal file
11
src/pages/api/system/getFiling.ts
Normal 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 || ''
|
||||
}
|
||||
});
|
||||
}
|
@@ -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>
|
||||
|
@@ -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="确认密码"
|
||||
|
@@ -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="确认密码"
|
||||
|
@@ -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'}
|
||||
|
@@ -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')}
|
||||
|
Reference in New Issue
Block a user