mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-03 21:48:02 +00:00
perf: config home title
This commit is contained in:
@@ -4,6 +4,7 @@ import type { AppListItemType, AppUpdateParams } from '@/types/app';
|
||||
import { RequestPaging } from '../types/index';
|
||||
import type { Props as CreateAppProps } from '@/pages/api/app/create';
|
||||
import { addDays } from 'date-fns';
|
||||
import { GetAppChatLogsParams } from './request/app';
|
||||
|
||||
/**
|
||||
* 获取模型列表
|
||||
@@ -52,5 +53,4 @@ export const getAppTotalUsage = (data: { appId: string }) =>
|
||||
end: addDays(new Date(), 1)
|
||||
}).then((res) => (res.length === 0 ? [{ date: new Date(), total: 0 }] : res));
|
||||
|
||||
export const getAppChatLogs = (data: RequestPaging & { appId: string }) =>
|
||||
POST(`/app/getChatLogs`, data);
|
||||
export const getAppChatLogs = (data: GetAppChatLogsParams) => POST(`/app/getChatLogs`, data);
|
||||
|
7
client/src/api/request/app.d.ts
vendored
Normal file
7
client/src/api/request/app.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { RequestPaging } from '@/types';
|
||||
|
||||
export type GetAppChatLogsParams = RequestPaging & {
|
||||
appId: string;
|
||||
dateStart: Date;
|
||||
dateEnd: Date;
|
||||
};
|
@@ -64,7 +64,7 @@ function App({ Component, pageProps }: AppProps) {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{feConfigs?.systemTitle || 'FastGPT'}</title>
|
||||
<title>{feConfigs?.systemTitle || 'AI'}</title>
|
||||
<meta name="description" content="Embedding + LLM, Build AI knowledge base" />
|
||||
<meta
|
||||
name="viewport"
|
||||
|
@@ -5,14 +5,18 @@ import { authUser } from '@/service/utils/auth';
|
||||
import type { PagingData } from '@/types';
|
||||
import { AppLogsListItemType } from '@/types/app';
|
||||
import { Types } from 'mongoose';
|
||||
import { addDays } from 'date-fns';
|
||||
import { GetAppChatLogsParams } from '@/api/request/app';
|
||||
|
||||
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
try {
|
||||
const {
|
||||
pageNum = 1,
|
||||
pageSize = 20,
|
||||
appId
|
||||
} = req.body as { pageNum: number; pageSize: number; appId: string };
|
||||
appId,
|
||||
dateStart = addDays(new Date(), -7),
|
||||
dateEnd = new Date()
|
||||
} = req.body as GetAppChatLogsParams;
|
||||
|
||||
if (!appId) {
|
||||
throw new Error('缺少参数');
|
||||
@@ -24,7 +28,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||
|
||||
const where = {
|
||||
appId: new Types.ObjectId(appId),
|
||||
userId: new Types.ObjectId(userId)
|
||||
userId: new Types.ObjectId(userId),
|
||||
updateTime: {
|
||||
$gte: new Date(dateStart),
|
||||
$lte: new Date(dateEnd)
|
||||
}
|
||||
};
|
||||
|
||||
const [data, total] = await Promise.all([
|
||||
|
@@ -21,17 +21,23 @@ import dayjs from 'dayjs';
|
||||
import { ChatSourceMap, HUMAN_ICON } from '@/constants/chat';
|
||||
import { AppLogsListItemType } from '@/types/app';
|
||||
import { useGlobalStore } from '@/store/global';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import ChatBox, { type ComponentRef } from '@/components/ChatBox';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getInitChatSiteInfo } from '@/api/chat';
|
||||
import Tag from '@/components/Tag';
|
||||
import MyModal from '@/components/MyModal';
|
||||
import DateRangePicker, { type DateRangeType } from '@/components/DateRangePicker';
|
||||
import { addDays } from 'date-fns';
|
||||
|
||||
const Logs = ({ appId }: { appId: string }) => {
|
||||
const { t } = useTranslation();
|
||||
const { isPc } = useGlobalStore();
|
||||
|
||||
const [dateRange, setDateRange] = useState<DateRangeType>({
|
||||
from: addDays(new Date(), -7),
|
||||
to: new Date()
|
||||
});
|
||||
|
||||
const {
|
||||
isOpen: isOpenMarkDesc,
|
||||
onOpen: onOpenMarkDesc,
|
||||
@@ -48,7 +54,9 @@ const Logs = ({ appId }: { appId: string }) => {
|
||||
api: getAppChatLogs,
|
||||
pageSize: 20,
|
||||
params: {
|
||||
appId
|
||||
appId,
|
||||
dateStart: dateRange.from || new Date(),
|
||||
dateEnd: addDays(dateRange.to || new Date(), 1)
|
||||
}
|
||||
});
|
||||
|
||||
@@ -132,9 +140,6 @@ const Logs = ({ appId }: { appId: string }) => {
|
||||
</Tbody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
<Box p={4}>
|
||||
<Pagination />
|
||||
</Box>
|
||||
{logs.length === 0 && !isLoading && (
|
||||
<Flex h={'100%'} flexDirection={'column'} alignItems={'center'} pt={'10vh'}>
|
||||
<MyIcon name="empty" w={'48px'} h={'48px'} color={'transparent'} />
|
||||
@@ -143,6 +148,18 @@ const Logs = ({ appId }: { appId: string }) => {
|
||||
</Box>
|
||||
</Flex>
|
||||
)}
|
||||
<Flex w={'100%'} p={4} alignItems={'center'} justifyContent={'flex-end'}>
|
||||
<DateRangePicker
|
||||
defaultDate={dateRange}
|
||||
position="top"
|
||||
onChange={setDateRange}
|
||||
onSuccess={() => getData(1)}
|
||||
/>
|
||||
<Box ml={3}>
|
||||
<Pagination />
|
||||
</Box>
|
||||
</Flex>
|
||||
|
||||
{!!detailLogsId && (
|
||||
<DetailLogsModal
|
||||
appId={appId}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { Box, Image, BoxProps, Grid, useTheme } from '@chakra-ui/react';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { feConfigs } from '@/store/static';
|
||||
|
||||
const Ability = () => {
|
||||
const theme = useTheme();
|
||||
@@ -34,7 +35,7 @@ const Ability = () => {
|
||||
fontSize={['22px', '30px']}
|
||||
fontWeight={'bold'}
|
||||
>
|
||||
{t('home.FastGPT Ability')}
|
||||
{t('home.FastGPT Ability', { title: feConfigs.systemTitle })}
|
||||
</Box>
|
||||
<Grid px={[5, 0]} minH={'400px'} gridTemplateColumns={['1fr', `500px 1fr`]} gridGap={6}>
|
||||
<Box
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { Box, Image, Flex, Grid, useTheme } from '@chakra-ui/react';
|
||||
import React, { useRef } from 'react';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MyTooltip from '@/components/MyTooltip';
|
||||
import MyIcon from '@/components/Icon';
|
||||
import { feConfigs } from '@/store/static';
|
||||
|
||||
const Choice = () => {
|
||||
const theme = useTheme();
|
||||
@@ -12,7 +12,7 @@ const Choice = () => {
|
||||
{
|
||||
icon: '/imgs/home/icon_1.svg',
|
||||
title: t('home.Choice Open'),
|
||||
desc: t('home.Choice Open Desc'),
|
||||
desc: t('home.Choice Open Desc', { title: feConfigs.systemTitle }),
|
||||
tooltip: '前往 GitHub',
|
||||
onClick: () => window.open('https://github.com/labring/FastGPT', '_blank')
|
||||
},
|
||||
@@ -57,7 +57,7 @@ const Choice = () => {
|
||||
fontSize={['22px', '30px']}
|
||||
fontWeight={'bold'}
|
||||
>
|
||||
{t('home.Why FastGPT')}
|
||||
{t('home.Why FastGPT', { title: feConfigs.systemTitle })}
|
||||
</Box>
|
||||
<Grid px={[5, 0]} gridTemplateColumns={['1fr', `1fr 1fr`, 'repeat(3,1fr)']} gridGap={6}>
|
||||
{list.map((item) => (
|
||||
|
@@ -16,7 +16,7 @@ const Footer = () => {
|
||||
label: t('home.Footer Product'),
|
||||
child: [
|
||||
{
|
||||
label: t('home.Footer FastGPT Cloud'),
|
||||
label: t('home.Footer FastGPT Cloud', { title: feConfigs.systemTitle }),
|
||||
onClick: () => {
|
||||
router.push('/app/list');
|
||||
}
|
||||
@@ -96,7 +96,7 @@ const Footer = () => {
|
||||
</Box>
|
||||
</Flex>
|
||||
<Box mt={5} fontSize={'sm'} color={'myGray.600'} maxW={'380px'} textAlign={'justify'}>
|
||||
{t('home.FastGPT Desc')}
|
||||
{t('home.FastGPT Desc', { title: feConfigs.systemTitle })}
|
||||
</Box>
|
||||
</Box>
|
||||
{list.map((item) => (
|
||||
|
Reference in New Issue
Block a user