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", "Complete Response": "Complete Response",
"Confirm to clear history": "Confirm to clear history?", "Confirm to clear history": "Confirm to clear history?",
"Exit Chat": "Exit", "Exit Chat": "Exit",
"Feedback Close": "Close Feedback",
"Feedback Failed": "Feedback Failed", "Feedback Failed": "Feedback Failed",
"Feedback Mark": "Mark", "Feedback Mark": "Mark",
"Feedback Modal": "Feedback", "Feedback Modal": "Feedback",
"Feedback Modal Tip": "Enter what you find unsatisfactory", "Feedback Modal Tip": "Enter what you find unsatisfactory",
"Feedback Close": "Close Feedback",
"Feedback Submit": "Submit", "Feedback Submit": "Submit",
"Feedback Success": "Feedback Success", "Feedback Success": "Feedback Success",
"Feedback Update Failed": "Feedback Update Failed", "Feedback Update Failed": "Feedback Update Failed",
@@ -110,9 +110,9 @@
"Choice Extension": "Infinite Extension", "Choice Extension": "Infinite Extension",
"Choice Extension Desc": "HTTP based extension, easy to achieve custom functions", "Choice Extension Desc": "HTTP based extension, easy to achieve custom functions",
"Choice Models": "Multiple Models", "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": "Open",
"Choice Open Desc": "", "Choice Open Desc": "{{title}} follows the Apache License 2.0 open source protocol",
"Choice QA": "QA Struceture", "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 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", "Choice Visual": "Visual workflow",
@@ -121,12 +121,12 @@
"Dateset": "", "Dateset": "",
"Dateset Desc": "", "Dateset Desc": "",
"Docs": "Docs", "Docs": "Docs",
"FastGPT Ability": "FastGPT Ability", "FastGPT Ability": "{{title}} 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 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", "Features": "Features",
"Footer Developer": "Developer", "Footer Developer": "Developer",
"Footer Docs": "Docs", "Footer Docs": "Docs",
"Footer FastGPT Cloud": "FastGPT Cloud", "Footer FastGPT Cloud": "{{title}} Cloud",
"Footer Feedback": "Feedback", "Footer Feedback": "Feedback",
"Footer Git": "Code", "Footer Git": "Code",
"Footer Product": "Product", "Footer Product": "Product",
@@ -138,7 +138,7 @@
"Quickly build AI question and answer library": "Quickly build AI question and answer library", "Quickly build AI question and answer library": "Quickly build AI question and answer library",
"Start Now": "Start Now", "Start Now": "Start Now",
"Visual AI orchestration": "Visual AI orchestration", "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", "desc": "AI knowledge base question and answer platform based on LLM large model",
"slogan": "Let the AI know more about you" "slogan": "Let the AI know more about you"
}, },

View File

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

View File

@@ -4,6 +4,7 @@ import type { AppListItemType, AppUpdateParams } from '@/types/app';
import { RequestPaging } from '../types/index'; import { RequestPaging } from '../types/index';
import type { Props as CreateAppProps } from '@/pages/api/app/create'; import type { Props as CreateAppProps } from '@/pages/api/app/create';
import { addDays } from 'date-fns'; 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) end: addDays(new Date(), 1)
}).then((res) => (res.length === 0 ? [{ date: new Date(), total: 0 }] : res)); }).then((res) => (res.length === 0 ? [{ date: new Date(), total: 0 }] : res));
export const getAppChatLogs = (data: RequestPaging & { appId: string }) => export const getAppChatLogs = (data: GetAppChatLogsParams) => POST(`/app/getChatLogs`, data);
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 ( return (
<> <>
<Head> <Head>
<title>{feConfigs?.systemTitle || 'FastGPT'}</title> <title>{feConfigs?.systemTitle || 'AI'}</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"

View File

@@ -5,14 +5,18 @@ import { authUser } from '@/service/utils/auth';
import type { PagingData } from '@/types'; import type { PagingData } from '@/types';
import { AppLogsListItemType } from '@/types/app'; import { AppLogsListItemType } from '@/types/app';
import { Types } from 'mongoose'; import { Types } from 'mongoose';
import { addDays } from 'date-fns';
import { GetAppChatLogsParams } from '@/api/request/app';
export default async function handler(req: NextApiRequest, res: NextApiResponse) { export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try { try {
const { const {
pageNum = 1, pageNum = 1,
pageSize = 20, pageSize = 20,
appId appId,
} = req.body as { pageNum: number; pageSize: number; appId: string }; dateStart = addDays(new Date(), -7),
dateEnd = new Date()
} = req.body as GetAppChatLogsParams;
if (!appId) { if (!appId) {
throw new Error('缺少参数'); throw new Error('缺少参数');
@@ -24,7 +28,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const where = { const where = {
appId: new Types.ObjectId(appId), 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([ const [data, total] = await Promise.all([

View File

@@ -21,17 +21,23 @@ import dayjs from 'dayjs';
import { ChatSourceMap, HUMAN_ICON } from '@/constants/chat'; import { ChatSourceMap, HUMAN_ICON } from '@/constants/chat';
import { AppLogsListItemType } from '@/types/app'; import { AppLogsListItemType } from '@/types/app';
import { useGlobalStore } from '@/store/global'; import { useGlobalStore } from '@/store/global';
import MyTooltip from '@/components/MyTooltip';
import ChatBox, { type ComponentRef } from '@/components/ChatBox'; import ChatBox, { type ComponentRef } from '@/components/ChatBox';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { getInitChatSiteInfo } from '@/api/chat'; import { getInitChatSiteInfo } from '@/api/chat';
import Tag from '@/components/Tag'; import Tag from '@/components/Tag';
import MyModal from '@/components/MyModal'; import MyModal from '@/components/MyModal';
import DateRangePicker, { type DateRangeType } from '@/components/DateRangePicker';
import { addDays } from 'date-fns';
const Logs = ({ appId }: { appId: string }) => { const Logs = ({ appId }: { appId: string }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { isPc } = useGlobalStore(); const { isPc } = useGlobalStore();
const [dateRange, setDateRange] = useState<DateRangeType>({
from: addDays(new Date(), -7),
to: new Date()
});
const { const {
isOpen: isOpenMarkDesc, isOpen: isOpenMarkDesc,
onOpen: onOpenMarkDesc, onOpen: onOpenMarkDesc,
@@ -48,7 +54,9 @@ const Logs = ({ appId }: { appId: string }) => {
api: getAppChatLogs, api: getAppChatLogs,
pageSize: 20, pageSize: 20,
params: { 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> </Tbody>
</Table> </Table>
</TableContainer> </TableContainer>
<Box p={4}>
<Pagination />
</Box>
{logs.length === 0 && !isLoading && ( {logs.length === 0 && !isLoading && (
<Flex h={'100%'} flexDirection={'column'} alignItems={'center'} pt={'10vh'}> <Flex h={'100%'} flexDirection={'column'} alignItems={'center'} pt={'10vh'}>
<MyIcon name="empty" w={'48px'} h={'48px'} color={'transparent'} /> <MyIcon name="empty" w={'48px'} h={'48px'} color={'transparent'} />
@@ -143,6 +148,18 @@ const Logs = ({ appId }: { appId: string }) => {
</Box> </Box>
</Flex> </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 && ( {!!detailLogsId && (
<DetailLogsModal <DetailLogsModal
appId={appId} appId={appId}

View File

@@ -1,6 +1,7 @@
import { Box, Image, BoxProps, Grid, useTheme } from '@chakra-ui/react'; import { Box, Image, BoxProps, Grid, useTheme } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { feConfigs } from '@/store/static';
const Ability = () => { const Ability = () => {
const theme = useTheme(); const theme = useTheme();
@@ -34,7 +35,7 @@ const Ability = () => {
fontSize={['22px', '30px']} fontSize={['22px', '30px']}
fontWeight={'bold'} fontWeight={'bold'}
> >
{t('home.FastGPT Ability')} {t('home.FastGPT Ability', { title: feConfigs.systemTitle })}
</Box> </Box>
<Grid px={[5, 0]} minH={'400px'} gridTemplateColumns={['1fr', `500px 1fr`]} gridGap={6}> <Grid px={[5, 0]} minH={'400px'} gridTemplateColumns={['1fr', `500px 1fr`]} gridGap={6}>
<Box <Box

View File

@@ -1,8 +1,8 @@
import { Box, Image, Flex, Grid, useTheme } from '@chakra-ui/react'; 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 { useTranslation } from 'next-i18next';
import MyTooltip from '@/components/MyTooltip'; import MyTooltip from '@/components/MyTooltip';
import MyIcon from '@/components/Icon'; import { feConfigs } from '@/store/static';
const Choice = () => { const Choice = () => {
const theme = useTheme(); const theme = useTheme();
@@ -12,7 +12,7 @@ const Choice = () => {
{ {
icon: '/imgs/home/icon_1.svg', icon: '/imgs/home/icon_1.svg',
title: t('home.Choice Open'), title: t('home.Choice Open'),
desc: t('home.Choice Open Desc'), desc: t('home.Choice Open Desc', { title: feConfigs.systemTitle }),
tooltip: '前往 GitHub', tooltip: '前往 GitHub',
onClick: () => window.open('https://github.com/labring/FastGPT', '_blank') onClick: () => window.open('https://github.com/labring/FastGPT', '_blank')
}, },
@@ -57,7 +57,7 @@ const Choice = () => {
fontSize={['22px', '30px']} fontSize={['22px', '30px']}
fontWeight={'bold'} fontWeight={'bold'}
> >
{t('home.Why FastGPT')} {t('home.Why FastGPT', { title: feConfigs.systemTitle })}
</Box> </Box>
<Grid px={[5, 0]} gridTemplateColumns={['1fr', `1fr 1fr`, 'repeat(3,1fr)']} gridGap={6}> <Grid px={[5, 0]} gridTemplateColumns={['1fr', `1fr 1fr`, 'repeat(3,1fr)']} gridGap={6}>
{list.map((item) => ( {list.map((item) => (

View File

@@ -16,7 +16,7 @@ const Footer = () => {
label: t('home.Footer Product'), label: t('home.Footer Product'),
child: [ child: [
{ {
label: t('home.Footer FastGPT Cloud'), label: t('home.Footer FastGPT Cloud', { title: feConfigs.systemTitle }),
onClick: () => { onClick: () => {
router.push('/app/list'); router.push('/app/list');
} }
@@ -96,7 +96,7 @@ const Footer = () => {
</Box> </Box>
</Flex> </Flex>
<Box mt={5} fontSize={'sm'} color={'myGray.600'} maxW={'380px'} textAlign={'justify'}> <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>
</Box> </Box>
{list.map((item) => ( {list.map((item) => (