Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
c46a3754
authored
Jul 19, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: config fe
parent
47af8d1c
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
23 deletions
+25
-23
client/data/FeConfig.json
+7
-7
client/src/components/ChatBox/index.tsx
+1
-1
client/src/components/Layout/navbar.tsx
+2
-2
client/src/pages/_app.tsx
+2
-3
client/src/pages/api/user/sendAuthCode.ts
+1
-1
client/src/pages/index.tsx
+3
-3
client/src/pages/login/components/LoginForm.tsx
+3
-0
client/src/pages/number/index.tsx
+3
-3
client/src/pages/tools/index.tsx
+2
-2
client/src/types/index.d.ts
+1
-1
No files found.
client/data/FeConfig.json
View file @
c46a3754
{
{
"show_emptyChat"
:
fals
e
,
"show_emptyChat"
:
tru
e
,
"show_register"
:
fals
e
,
"show_register"
:
tru
e
,
"show_appStore"
:
fals
e
,
"show_appStore"
:
tru
e
,
"show_
promotion"
:
fals
e
,
"show_
userDetail"
:
tru
e
,
"show_
userDetail"
:
fals
e
,
"show_
git"
:
tru
e
,
"s
how_git"
:
false
,
"s
ystemTitle"
:
"FastAI"
,
"authorText"
:
"Made by Fast
Gpt
Team."
"authorText"
:
"Made by Fast
AI
Team."
}
}
client/src/components/ChatBox/index.tsx
View file @
c46a3754
...
@@ -394,7 +394,7 @@ const ChatBox = (
...
@@ -394,7 +394,7 @@ const ChatBox = (
const
showEmpty
=
useMemo
(
const
showEmpty
=
useMemo
(
()
=>
()
=>
feConfigs
.
show_emptyChat
&&
feConfigs
?
.
show_emptyChat
&&
showEmptyIntro
&&
showEmptyIntro
&&
chatHistory
.
length
===
0
&&
chatHistory
.
length
===
0
&&
!
variableModules
?.
length
&&
!
variableModules
?.
length
&&
...
...
client/src/components/Layout/navbar.tsx
View file @
c46a3754
...
@@ -42,7 +42,7 @@ const Navbar = ({ unread }: { unread: number }) => {
...
@@ -42,7 +42,7 @@ const Navbar = ({ unread }: { unread: number }) => {
link
:
`/kb/list`
,
link
:
`/kb/list`
,
activeLink
:
[
'/kb/list'
,
'/kb/detail'
]
activeLink
:
[
'/kb/list'
,
'/kb/detail'
]
},
},
...(
feConfigs
.
show_appStore
...(
feConfigs
?
.
show_appStore
?
[
?
[
{
{
label
:
'市场'
,
label
:
'市场'
,
...
@@ -143,7 +143,7 @@ const Navbar = ({ unread }: { unread: number }) => {
...
@@ -143,7 +143,7 @@ const Navbar = ({ unread }: { unread: number }) => {
</
Link
>
</
Link
>
</
Box
>
</
Box
>
)
}
)
}
{
feConfigs
.
show_git
&&
(
{
feConfigs
?
.
show_git
&&
(
<
Box
>
<
Box
>
<
Link
<
Link
as=
{
NextLink
}
as=
{
NextLink
}
...
...
client/src/pages/_app.tsx
View file @
c46a3754
...
@@ -10,10 +10,9 @@ import NProgress from 'nprogress'; //nprogress module
...
@@ -10,10 +10,9 @@ import NProgress from 'nprogress'; //nprogress module
import
Router
from
'next/router'
;
import
Router
from
'next/router'
;
import
'nprogress/nprogress.css'
;
import
'nprogress/nprogress.css'
;
import
'@/styles/reset.scss'
;
import
'@/styles/reset.scss'
;
import
{
clientInitData
}
from
'@/store/static'
;
import
{
clientInitData
,
feConfigs
}
from
'@/store/static'
;
import
{
NextPageContext
}
from
'next'
;
import
{
NextPageContext
}
from
'next'
;
import
{
useGlobalStore
}
from
'@/store/global'
;
import
{
useGlobalStore
}
from
'@/store/global'
;
import
{
GET
}
from
'@/service/api/axios'
;
//Binding events.
//Binding events.
Router
.
events
.
on
(
'routeChangeStart'
,
()
=>
NProgress
.
start
());
Router
.
events
.
on
(
'routeChangeStart'
,
()
=>
NProgress
.
start
());
...
@@ -51,7 +50,7 @@ function App({ Component, pageProps, isPc }: AppProps & { isPc?: boolean; respon
...
@@ -51,7 +50,7 @@ function App({ Component, pageProps, isPc }: AppProps & { isPc?: boolean; respon
return
(
return
(
<>
<>
<
Head
>
<
Head
>
<
title
>
Fast GPT
</
title
>
<
title
>
{
feConfigs
?.
systemTitle
||
'FastAI'
}
</
title
>
<
meta
name=
"description"
content=
"Embedding + LLM, Build AI knowledge base"
/>
<
meta
name=
"description"
content=
"Embedding + LLM, Build AI knowledge base"
/>
<
meta
<
meta
name=
"viewport"
name=
"viewport"
...
...
client/src/pages/api/user/sendAuthCode.ts
View file @
c46a3754
...
@@ -33,7 +33,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
...
@@ -33,7 +33,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
await
connectToDatabase
();
await
connectToDatabase
();
// register switch
// register switch
if
(
type
===
UserAuthTypeEnum
.
register
&&
!
global
.
feConfigs
.
show_register
)
{
if
(
type
===
UserAuthTypeEnum
.
register
&&
!
global
.
feConfigs
?
.
show_register
)
{
throw
new
Error
(
'Register is closed'
);
throw
new
Error
(
'Register is closed'
);
}
}
...
...
client/src/pages/index.tsx
View file @
c46a3754
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Card
,
Box
,
Link
,
Flex
,
Image
,
Button
}
from
'@chakra-ui/react'
;
import
{
Card
,
Box
,
Link
,
Flex
,
Image
,
Button
}
from
'@chakra-ui/react'
;
import
Markdown
from
'@/components/Markdown'
;
import
{
useMarkdown
}
from
'@/hooks/useMarkdown'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useGlobalStore
}
from
'@/store/global'
;
import
{
useGlobalStore
}
from
'@/store/global'
;
import
{
beianText
}
from
'@/store/static'
;
import
{
beianText
}
from
'@/store/static'
;
...
@@ -170,7 +168,7 @@ const Home = () => {
...
@@ -170,7 +168,7 @@ const Home = () => {
fontSize=
{
[
'40px'
,
'70px'
]
}
fontSize=
{
[
'40px'
,
'70px'
]
}
letterSpacing=
{
'5px'
}
letterSpacing=
{
'5px'
}
>
>
FastAI
{
feConfigs
?.
systemTitle
||
'FastAI'
}
</
Box
>
</
Box
>
<
Box
className=
{
styles
.
textlg
}
fontWeight=
{
'bold'
}
fontSize=
{
[
'30px'
,
'50px'
]
}
>
<
Box
className=
{
styles
.
textlg
}
fontWeight=
{
'bold'
}
fontSize=
{
[
'30px'
,
'50px'
]
}
>
可视化 AI 编排
可视化 AI 编排
...
@@ -180,6 +178,7 @@ const Home = () => {
...
@@ -180,6 +178,7 @@ const Home = () => {
</
Box
>
</
Box
>
<
Flex
flexDirection=
{
[
'column'
,
'row'
]
}
my=
{
5
}
>
<
Flex
flexDirection=
{
[
'column'
,
'row'
]
}
my=
{
5
}
>
{
feConfigs
?.
show_git
&&
(
<
Button
<
Button
mr=
{
[
0
,
5
]
}
mr=
{
[
0
,
5
]
}
mb=
{
[
5
,
0
]
}
mb=
{
[
5
,
0
]
}
...
@@ -199,6 +198,7 @@ const Home = () => {
...
@@ -199,6 +198,7 @@ const Home = () => {
>
>
Stars
{
(
star
/
1000
).
toFixed
(
1
)
}
k
Stars
{
(
star
/
1000
).
toFixed
(
1
)
}
k
</
Button
>
</
Button
>
)
}
<
Button
<
Button
fontSize=
{
[
'xl'
,
'3xl'
]
}
fontSize=
{
[
'xl'
,
'3xl'
]
}
h=
{
'auto'
}
h=
{
'auto'
}
...
...
client/src/pages/login/components/LoginForm.tsx
View file @
c46a3754
...
@@ -5,6 +5,7 @@ import { PageTypeEnum } from '@/constants/user';
...
@@ -5,6 +5,7 @@ import { PageTypeEnum } from '@/constants/user';
import
{
postLogin
}
from
'@/api/user'
;
import
{
postLogin
}
from
'@/api/user'
;
import
type
{
ResLogin
}
from
'@/api/response/user'
;
import
type
{
ResLogin
}
from
'@/api/response/user'
;
import
{
useToast
}
from
'@/hooks/useToast'
;
import
{
useToast
}
from
'@/hooks/useToast'
;
import
{
feConfigs
}
from
'@/store/static'
;
interface
Props
{
interface
Props
{
setPageType
:
Dispatch
<
`
${
PageTypeEnum
}
`
>
;
setPageType
:
Dispatch
<
`
${
PageTypeEnum
}
`
>
;
...
@@ -104,6 +105,7 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => {
...
@@ -104,6 +105,7 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => {
>
>
忘记密码?
忘记密码?
</
Box
>
</
Box
>
{
feConfigs
?.
show_register
&&
(
<
Box
<
Box
cursor=
{
'pointer'
}
cursor=
{
'pointer'
}
_hover=
{
{
textDecoration
:
'underline'
}
}
_hover=
{
{
textDecoration
:
'underline'
}
}
...
@@ -112,6 +114,7 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => {
...
@@ -112,6 +114,7 @@ const LoginForm = ({ setPageType, loginSuccess }: Props) => {
>
>
注册账号
注册账号
</
Box
>
</
Box
>
)
}
</
Flex
>
</
Flex
>
<
Button
<
Button
type=
"submit"
type=
"submit"
...
...
client/src/pages/number/index.tsx
View file @
c46a3754
...
@@ -174,7 +174,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
...
@@ -174,7 +174,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
<
Box
flex=
{
'0 0 50px'
}
>
账号:
</
Box
>
<
Box
flex=
{
'0 0 50px'
}
>
账号:
</
Box
>
<
Box
>
{
userInfo
?.
username
}
</
Box
>
<
Box
>
{
userInfo
?.
username
}
</
Box
>
</
Flex
>
</
Flex
>
{
feConfigs
.
show_userDetail
&&
(
{
feConfigs
?
.
show_userDetail
&&
(
<
Box
mt=
{
6
}
>
<
Box
mt=
{
6
}
>
<
Flex
alignItems=
{
'center'
}
>
<
Flex
alignItems=
{
'center'
}
>
<
Box
flex=
{
'0 0 50px'
}
>
余额:
</
Box
>
<
Box
flex=
{
'0 0 50px'
}
>
余额:
</
Box
>
...
@@ -188,7 +188,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
...
@@ -188,7 +188,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
</
Box
>
</
Box
>
)
}
)
}
</
Card
>
</
Card
>
{
feConfigs
.
show_userDetail
&&
(
{
feConfigs
?
.
show_userDetail
&&
(
<
Card
px=
{
6
}
py=
{
4
}
>
<
Card
px=
{
6
}
py=
{
4
}
>
<
Box
fontSize=
{
'xl'
}
fontWeight=
{
'bold'
}
>
<
Box
fontSize=
{
'xl'
}
fontWeight=
{
'bold'
}
>
我的邀请
我的邀请
...
@@ -234,7 +234,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
...
@@ -234,7 +234,7 @@ const NumberSetting = ({ tableType }: { tableType: `${TableEnum}` }) => {
)
}
)
}
</
Grid
>
</
Grid
>
{
feConfigs
.
show_userDetail
&&
(
{
feConfigs
?
.
show_userDetail
&&
(
<
Card
mt=
{
4
}
px=
{
[
3
,
6
]
}
py=
{
4
}
>
<
Card
mt=
{
4
}
px=
{
[
3
,
6
]
}
py=
{
4
}
>
<
Tabs
<
Tabs
m=
{
'auto'
}
m=
{
'auto'
}
...
...
client/src/pages/tools/index.tsx
View file @
c46a3754
...
@@ -11,7 +11,7 @@ const list = [
...
@@ -11,7 +11,7 @@ const list = [
label
:
'我的知识库'
,
label
:
'我的知识库'
,
link
:
'/kb/list'
link
:
'/kb/list'
},
},
...(
feConfigs
.
show_appStore
...(
feConfigs
?
.
show_appStore
?
[
?
[
{
{
icon
:
'appStoreLight'
,
icon
:
'appStoreLight'
,
...
@@ -20,7 +20,7 @@ const list = [
...
@@ -20,7 +20,7 @@ const list = [
}
}
]
]
:
[]),
:
[]),
...(
feConfigs
.
show_git
...(
feConfigs
?
.
show_git
?
[
?
[
{
{
icon
:
'git'
,
icon
:
'git'
,
...
...
client/src/types/index.d.ts
View file @
c46a3754
...
@@ -17,9 +17,9 @@ export type FeConfigsType = {
...
@@ -17,9 +17,9 @@ export type FeConfigsType = {
show_emptyChat
?:
boolean
;
show_emptyChat
?:
boolean
;
show_register
?:
boolean
;
show_register
?:
boolean
;
show_appStore
?:
boolean
;
show_appStore
?:
boolean
;
show_promotion
?:
boolean
;
show_userDetail
?:
boolean
;
show_userDetail
?:
boolean
;
show_git
?:
false
;
show_git
?:
false
;
systemTitle
?:
string
;
authorText
?:
string
;
authorText
?:
string
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment