perf: config home title

This commit is contained in:
archer
2023-08-28 21:36:37 +08:00
parent c5c3826714
commit be937956af
11 changed files with 65 additions and 32 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -38,11 +38,11 @@
"Complete Response": "Complete Response",
"Confirm to clear history": "Confirm to clear history?",
"Exit Chat": "Exit",
"Feedback Close": "Close Feedback",
"Feedback Failed": "Feedback Failed",
"Feedback Mark": "Mark",
"Feedback Modal": "Feedback",
"Feedback Modal Tip": "Enter what you find unsatisfactory",
"Feedback Close": "Close Feedback",
"Feedback Submit": "Submit",
"Feedback Success": "Feedback Success",
"Feedback Update Failed": "Feedback Update Failed",
@@ -110,9 +110,9 @@
"Choice Extension": "Infinite Extension",
"Choice Extension Desc": "HTTP based extension, easy to achieve custom functions",
"Choice Models": "Multiple Models",
"Choice Models Desc": "",
"Choice Models Desc": "Supports multiple models such as GPT, Claude, Spark, and ChatGLM",
"Choice Open": "Open",
"Choice Open Desc": "",
"Choice Open Desc": "{{title}} follows the Apache License 2.0 open source protocol",
"Choice QA": "QA Struceture",
"Choice QA Desc": "The index is constructed with the structure of QA pairs, and ADAPTS to various scenarios such as Q&A and reading",
"Choice Visual": "Visual workflow",
@@ -121,12 +121,12 @@
"Dateset": "",
"Dateset Desc": "",
"Docs": "Docs",
"FastGPT Ability": "FastGPT Ability",
"FastGPT Desc": "FastGPT is a knowledgebase question answering system based on LLM large language model, which provides out-of-the-box data processing, model invocation and other capabilities. At the same time, workflow orchestration can be performed through Flow visualization to achieve complex Q&A scenarios!",
"FastGPT Ability": "{{title}} Ability",
"FastGPT Desc": "{{title}} is a knowledgebase question answering system based on LLM large language model, which provides out-of-the-box data processing, model invocation and other capabilities. At the same time, workflow orchestration can be performed through Flow visualization to achieve complex Q&A scenarios!",
"Features": "Features",
"Footer Developer": "Developer",
"Footer Docs": "Docs",
"Footer FastGPT Cloud": "FastGPT Cloud",
"Footer FastGPT Cloud": "{{title}} Cloud",
"Footer Feedback": "Feedback",
"Footer Git": "Code",
"Footer Product": "Product",
@@ -138,7 +138,7 @@
"Quickly build AI question and answer library": "Quickly build AI question and answer library",
"Start Now": "Start Now",
"Visual AI orchestration": "Visual AI orchestration",
"Why FastGPT": "",
"Why FastGPT": "Why {{title}}",
"desc": "AI knowledge base question and answer platform based on LLM large model",
"slogan": "Let the AI know more about you"
},

View File

@@ -38,11 +38,11 @@
"Complete Response": "完整响应",
"Confirm to clear history": "确认清空该应用的聊天记录?",
"Exit Chat": "退出聊天",
"Feedback Close": "关闭反馈",
"Feedback Failed": "提交反馈异常",
"Feedback Mark": "标注",
"Feedback Modal": "结果反馈",
"Feedback Modal Tip": "输入你觉得回答不满意的地方",
"Feedback Close": "关闭反馈",
"Feedback Submit": "提交反馈",
"Feedback Success": "反馈成功!",
"Feedback Update Failed": "更新反馈状态失败",
@@ -110,9 +110,9 @@
"Choice Extension": "无限扩展",
"Choice Extension Desc": "基于 HTTP 实现扩展,轻松实现定制功能",
"Choice Models": "支持多种模型",
"Choice Models Desc": "支持 GPT、Claude、文心一言等多模型",
"Choice Models Desc": "支持 GPT、Claude、Spark、ChatGLM等多模型",
"Choice Open": "更开放",
"Choice Open Desc": "FastGPT 遵循 Apache License 2.0 开源协议",
"Choice Open Desc": "{{title}} 遵循 Apache License 2.0 开源协议",
"Choice QA": "独特的 QA 结构",
"Choice QA Desc": "采用 QA 对的结构构建索引,适应问答、阅读等多种场景",
"Choice Visual": "可视化工作流",
@@ -121,12 +121,12 @@
"Dateset": "自动数据预处理",
"Dateset Desc": "提供手动输入、直接分段、LLM 自动处理和 CSV 等多种数据导入途径",
"Docs": "文档",
"FastGPT Ability": "FastGPT 能力",
"FastGPT Desc": "FastGPT 是一个基于 LLM 大语言模型的知识库问答系统,提供开箱即用的数据处理、模型调用等能力。同时可以通过 Flow 可视化进行工作流编排,从而实现复杂的问答场景!",
"FastGPT Ability": "{{title}} 能力",
"FastGPT Desc": "{{title}} 是一个基于 LLM 大语言模型的知识库问答系统,提供开箱即用的数据处理、模型调用等能力。同时可以通过 Flow 可视化进行工作流编排,从而实现复杂的问答场景!",
"Features": "特点",
"Footer Developer": "开发者",
"Footer Docs": "文档",
"Footer FastGPT Cloud": "FastGPT 线上服务",
"Footer FastGPT Cloud": "{{title}} 线上服务",
"Footer Feedback": "反馈",
"Footer Git": "源码",
"Footer Product": "产品",
@@ -138,7 +138,7 @@
"Quickly build AI question and answer library": "快速搭建 AI 问答系统",
"Start Now": "立即开始",
"Visual AI orchestration": "可视化 AI 编排",
"Why FastGPT": "为什么选择 FastGPT",
"Why FastGPT": "为什么选择 {{title}}",
"desc": "基于 LLM 大模型的 AI 知识库问答平台",
"slogan": "让 AI 更懂你的知识"
},

View File

@@ -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
View File

@@ -0,0 +1,7 @@
import { RequestPaging } from '@/types';
export type GetAppChatLogsParams = RequestPaging & {
appId: string;
dateStart: Date;
dateEnd: Date;
};

View File

@@ -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"

View File

@@ -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([

View File

@@ -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}

View File

@@ -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

View File

@@ -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) => (

View File

@@ -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) => (