perf: config home page

This commit is contained in:
archer
2023-09-01 10:13:57 +08:00
parent 2ae8d43216
commit 68cdf50cb6
15 changed files with 110 additions and 77 deletions

View File

@@ -1,8 +1,5 @@
# 默认用户密码,用户名为 root每次重启时会自动更新。
DEFAULT_ROOT_PSW=123456
# 代理
# AXIOS_PROXY_HOST=127.0.0.1
# AXIOS_PROXY_PORT=7890
# 数据库最大连接数
DB_MAX_LINK=5
# token
@@ -19,3 +16,5 @@ CHAT_API_KEY=sk-xxxx
# db
MONGODB_URI=mongodb://username:password@0.0.0.0:27017/fastgpt?authSource=admin
PG_URL=postgresql://username:password@host:port/postgres
# 首页路径
HOME_URL=/

View File

@@ -4,8 +4,9 @@
"show_register": false,
"show_appStore": false,
"show_userDetail": false,
"show_loginTip": false,
"show_contact": true,
"show_git": true,
"show_doc": true,
"systemTitle": "FastGPT",
"authorText": "Made by FastGPT Team.",
"gitLoginKey": "",

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1693533362715" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4021" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M166.32 808.98l-99.28 99.28c-15.31 15.32-39.71 15.32-55.03 0-15.32-15.31-15.32-39.71 0-55.03l98.71-99.28c15.32-15.31 39.71-15.31 55.03 0 15.32 15.32 15.32 39.72 0.57 55.03z m48.22 48.79l-99.28 99.27c-15.31 15.32-15.31 39.71 0 55.03 15.32 15.32 39.71 15.32 55.03 0l99.28-99.28c15.32-15.32 15.32-39.71 0-55.03-15.32-15.31-39.72-15.31-55.03 0.01z m625.14-545.16c0 71.47-57.86 129.34-129.34 129.34S581 384.08 581 312.61c0-71.48 57.86-129.34 129.34-129.34 72.05 0 129.91 57.86 129.34 129.34z m-77.71 0.57c0-28.36-23.26-51.63-51.62-51.63-28.36 0-51.62 23.26-51.62 51.63 0 28.36 23.26 51.62 51.62 51.62 28.93 0 52.19-23.26 51.62-51.62z m236.56 68.07c-27.8 104.39-83.39 203.65-164.51 285.35h-3.97l-5.11 5.67c10.21 38.57 11.35 78.28 2.84 116.86-9.07 46.52-32.33 90.2-66.94 124.8l-2.27 2.27c-38.57 36.87-85.09 59.57-134.45 67.51-51.62 7.94-105.51 0-152.6-23.26-17.58-10.21-25.53-32.9-16.45-51.63 1.7-2.84 3.41-5.67 5.67-8.5 14.18-15.32 24.96-32.9 32.9-51.63l3.4-7.94c-10.21 1.7-20.42 4.53-30.63 5.1-29.5 4.54-60.14 6.24-90.2 5.67-10.21 0-19.86-3.97-26.1-11.35L181.63 671.14c-8.51-7.95-11.35-18.72-10.78-29.5 0-28.37 2.27-58.43 5.67-86.79 1.7-10.78 2.84-20.99 5.1-31.2l-8.51 3.4c-17.58 7.95-35.17 18.72-51.06 33.47-14.75 14.18-39.14 12.48-53.32-2.27-2.27-2.84-3.97-7.37-6.24-10.21-23.26-47.09-30.63-99.28-22.69-150.9 8.22-51.8 32.65-99.66 69.78-136.71 34.61-34.61 78.85-57.86 123.67-66.94 39.14-8.51 79.42-7.94 116.86 2.27l7.95-7.95C439.75 106.69 538.45 51.66 642.83 23.3c108.35-28.36 222.38-28.36 329.59 0 13.62 4.54 23.82 15.32 27.23 27.23l0.57 0.57v0.56c28.37 107.78 28.37 221.81-1.69 329.59zM936.12 92.51c-89.06-19.86-182.67-18.16-270.03 5.1-91.34 24.96-178.7 73.18-250.74 145.22l-10.78 10.78-10.21 11.35c-10.21 11.35-26.66 16.45-42.55 10.78-31.2-12.48-65.81-14.75-98.71-7.38-31.2 6.81-61.27 22.13-86.23 46.52-26.66 27.8-43.12 60.7-48.79 95.3-3.4 20.99-3.4 42.55 0.57 62.97 9.64-5.67 18.72-10.78 28.93-14.18 26.66-11.34 55.6-18.15 84.53-18.72 3.97-0.57 7.94 0 11.91 0.56 19.86 5.67 31.77 26.66 26.1 46.52-7.95 26.1-13.05 52.2-16.45 78.29-1.7 22.12-3.4 43.12-3.97 64.67l146.36 146.93c22.12-1.14 43.11-2.27 64.67-5.11 27.23-3.97 52.76-8.51 78.29-15.89 3.97-0.56 7.94-1.13 11.91-1.13 20.42 0.57 36.31 18.72 36.31 39.14-1.7 29.5-7.38 58.43-19.29 85.66-3.97 9.08-9.07 19.29-14.18 28.36 20.42 3.97 41.98 3.97 62.4 1.13 33.47-5.1 66.94-20.99 93.03-47.09l1.13-1.13c24.39-24.96 39.71-55.6 47.09-86.79 6.81-32.34 3.97-66.94-7.94-99.28-4.54-14.18-1.7-30.64 10.21-41.41l11.91-11.35 8.51-8.51 2.27-1.13c72.04-72.61 119.7-159.41 145.79-250.17 23.27-89.05 25.54-180.95 7.95-270.01z" p-id="4022" fill="#515151"></path></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -9,7 +9,7 @@
"app": {
"Advance App TestTip": "The current application is advanced editing mode \n. If you need to switch to [simple mode], please click the save button on the left",
"App Detail": "App Detail",
"Chat Logs Tips": "Logs record the app's online, shared, and API conversations",
"Chat Logs Tips": "Logs record the app's online, shared, and API(chatId is existing) conversations",
"Chat logs": "Chat Logs",
"Confirm Del App Tip": "Confirm to delete the app and all its chats",
"Confirm Save App Tip": "The application may be in advanced orchestration mode, and the advanced orchestration configuration will be overwritten after saving, please confirm!",
@@ -110,6 +110,8 @@
"Choice Desc": "FastGPT follows the Apache License 2.0 open source protocol",
"Choice Extension": "Infinite Extension",
"Choice Extension Desc": "HTTP based extension, easy to achieve custom functions",
"Choice Fast": "Fast",
"Choice Fast Desc": "{{title}} provides out-of-the-box visual actions to build AI applications point-by-point",
"Choice Models": "Multiple Models",
"Choice Models Desc": "Supports multiple models such as GPT, Claude, Spark, and ChatGLM",
"Choice Open": "Open",

View File

@@ -9,7 +9,7 @@
"app": {
"Advance App TestTip": "当前应用为高级编排模式\n如需切换为【简易模式】请点击左侧保存按键",
"App Detail": "应用详情",
"Chat Logs Tips": "日志会记录该应用的在线、分享和 API 对话记录",
"Chat Logs Tips": "日志会记录该应用的在线、分享和 API(需填写 chatId) 对话记录",
"Chat logs": "对话日志",
"Confirm Del App Tip": "确认删除该应用及其所有聊天记录?",
"Confirm Save App Tip": "该应用可能为高级编排模式,保存后将会覆盖高级编排配置,请确认!",
@@ -110,6 +110,8 @@
"Choice Desc": "",
"Choice Extension": "无限扩展",
"Choice Extension Desc": "基于 HTTP 实现扩展,轻松实现定制功能",
"Choice Fast": "开箱即用",
"Choice Fast Desc": "{{title}} 提供开箱即用的可视化操作,点点点即可构建 AI 应用",
"Choice Models": "支持多种模型",
"Choice Models Desc": "支持 GPT、Claude、Spark、ChatGLM等多模型",
"Choice Open": "更开放",

View File

@@ -167,6 +167,7 @@ const Navbar = ({ unread }: { unread: number }) => {
</Link>
</Box>
)}
{feConfigs?.show_doc && (
<MyTooltip label={t('home.Docs')} placement={'right-end'}>
<Box
{...itemStyles}
@@ -176,11 +177,10 @@ const Navbar = ({ unread }: { unread: number }) => {
window.open(`https://doc.fastgpt.run/docs/intro`);
}}
>
<Badge count={unread}>
<MyIcon name={'courseLight'} width={'26px'} height={'26px'} />
</Badge>
</Box>
</MyTooltip>
)}
<Language {...itemStyles} />
{feConfigs?.show_git && (
<MyTooltip label={`Git Star: ${gitStar}`} placement={'right-end'}>

View File

@@ -43,7 +43,7 @@ const OpenAIAccountModal = ({
<Input
flex={1}
{...register('baseUrl')}
placeholder={'中转地址,未自动补全 "v1"'}
placeholder={'请求地址,默认为 openai 官方。可填中转地址,未自动补全 "v1"'}
></Input>
</Flex>
</ModalBody>

View File

@@ -9,42 +9,47 @@ const Choice = () => {
const { t } = useTranslation();
const list = [
...(feConfigs?.show_git
? [
{
icon: '/imgs/home/icon_1.svg',
title: t('home.Choice Open'),
desc: t('home.Choice Open Desc', { title: feConfigs.systemTitle }),
desc: t('home.Choice Open Desc', { title: feConfigs?.systemTitle }),
tooltip: '前往 GitHub',
onClick: () => window.open('https://github.com/labring/FastGPT', '_blank')
},
}
]
: [
{
icon: '/imgs/home/icon_0.svg',
title: t('home.Choice Fast'),
desc: t('home.Choice Fast Desc', { title: feConfigs?.systemTitle })
}
]),
{
icon: '/imgs/home/icon_2.svg',
title: t('home.Choice QA'),
desc: t('home.Choice QA Desc'),
onClick: () => {}
desc: t('home.Choice QA Desc')
},
{
icon: '/imgs/home/icon_3.svg',
title: t('home.Choice Visual'),
desc: t('home.Choice Visual Desc'),
onClick: () => {}
desc: t('home.Choice Visual Desc')
},
{
icon: '/imgs/home/icon_4.svg',
title: t('home.Choice Extension'),
desc: t('home.Choice Extension Desc'),
onClick: () => {}
desc: t('home.Choice Extension Desc')
},
{
icon: '/imgs/home/icon_5.svg',
title: t('home.Choice Debug'),
desc: t('home.Choice Debug Desc'),
onClick: () => {}
desc: t('home.Choice Debug Desc')
},
{
icon: '/imgs/home/icon_6.svg',
title: t('home.Choice Models'),
desc: t('home.Choice Models Desc'),
onClick: () => {}
desc: t('home.Choice Models Desc')
}
];
@@ -57,7 +62,7 @@ const Choice = () => {
fontSize={['22px', '30px']}
fontWeight={'bold'}
>
{t('home.Why FastGPT', { title: feConfigs.systemTitle })}
{t('home.Why FastGPT', { title: feConfigs?.systemTitle })}
</Box>
<Grid px={[5, 0]} gridTemplateColumns={['1fr', `1fr 1fr`, 'repeat(3,1fr)']} gridGap={6}>
{list.map((item) => (
@@ -72,7 +77,7 @@ const Choice = () => {
_hover={{
bg: 'rgba(255,255,255,0.8)'
}}
onClick={item.onClick}
onClick={() => item.onClick?.()}
>
<Flex
flex={'0 0 48px'}

View File

@@ -19,16 +19,20 @@ const Navbar = () => {
} = useDisclosure();
const { isOpen: isOpenMenu, onOpen: onOpenMenu, onClose: onCloseMenu } = useDisclosure();
const { isPc } = useGlobalStore();
const menuList = useMemo(
() => [
// { label: t('home.Features'), key: 'features', onClick: () => {} },
const menuList = [
...(feConfigs?.show_contact
? [
{
label: t('home.Community'),
key: 'community',
onClick: () => {
onOpenCommunity();
}
},
}
]
: []),
...(feConfigs?.show_doc
? [
{
label: t('home.Docs'),
key: 'docs',
@@ -36,9 +40,9 @@ const Navbar = () => {
window.open('https://doc.fastgpt.run/docs/intro');
}
}
],
[onOpenCommunity, t]
);
]
: [])
];
const bgOpacity = useMemo(() => {
const rate = scrollTop / 120;
if (rate > 0.7) {

View File

@@ -1,16 +1,24 @@
import React, { useEffect } from 'react';
import React from 'react';
import { Box } from '@chakra-ui/react';
import { feConfigs } from '@/store/static';
import { serviceSideProps } from '@/utils/i18n';
import { useRouter } from 'next/router';
import Navbar from './components/Navbar';
import Hero from './components/Hero';
import Ability from './components/Ability';
import Choice from './components/Choice';
import Footer from './components/Footer';
import Loading from '@/components/Loading';
const Home = () => {
return (
const Home = ({ homeUrl = '/' }: { homeUrl: string }) => {
const router = useRouter();
if (homeUrl !== '/') {
router.replace(homeUrl);
}
return homeUrl === '/' ? (
<Box id="home" bg={'myWhite.600'} h={'100vh'} overflowY={'auto'} overflowX={'hidden'}>
<Box position={'fixed'} zIndex={10} top={0} left={0} right={0}>
<Navbar />
@@ -22,17 +30,22 @@ const Home = () => {
<Choice />
</Box>
</Box>
{feConfigs?.show_git && (
<Box bg={'white'}>
<Footer />
</Box>
)}
</Box>
) : (
<Loading />
);
};
export async function getServerSideProps(content: any) {
return {
props: {
...(await serviceSideProps(content))
...(await serviceSideProps(content)),
homeUrl: process.env.HOME_URL || '/'
}
};
}

View File

@@ -99,7 +99,7 @@ const Login = () => {
>
<DynamicComponent type={pageType} />
{feConfigs?.show_loginTip && (
{feConfigs?.show_contact && (
<Box
fontSize={'sm'}
color={'myGray.600'}

View File

@@ -34,11 +34,15 @@ const Tools = () => {
}
]
: []),
...(feConfigs?.show_doc
? [
{
icon: 'courseLight',
label: '使用文档',
link: 'https://doc.fastgpt.run/docs/intro'
}
]
: [])
];
return (

View File

@@ -124,7 +124,7 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
stream
},
{
timeout: stream ? 60000 : 480000,
timeout: stream ? 120000 : 480000,
responseType: stream ? 'stream' : 'json',
...axiosConfig(userOpenaiAccount)
}

View File

@@ -19,8 +19,9 @@ export type FeConfigsType = {
show_register?: boolean;
show_appStore?: boolean;
show_userDetail?: boolean;
show_loginTip?: boolean;
show_contact?: boolean;
show_git?: boolean;
show_doc?: boolean;
systemTitle?: string;
authorText?: string;
beianText?: string;

View File

@@ -4,7 +4,9 @@
"show_register": false,
"show_appStore": false,
"show_userDetail": false,
"show_contact": true,
"show_git": true,
"show_doc": true,
"systemTitle": "FastGPT",
"authorText": "Made by FastGPT Team.",
"gitLoginKey": "",
@@ -15,7 +17,6 @@
"qaMaxProcess": 15,
"pgIvfflatProbe": 20
},
"plugins": {},
"ChatModels": [
{
"model": "gpt-3.5-turbo",