Improve the i18n configuration of the chat page (#719)

This commit is contained in:
徒言
2024-01-10 15:18:55 +08:00
committed by GitHub
parent dfa6586e5e
commit 414b693303
7 changed files with 41 additions and 15 deletions

View File

@@ -7,6 +7,7 @@ import Avatar from '@/components/Avatar';
import ToolMenu from './ToolMenu';
import type { ChatItemType } from '@fastgpt/global/core/chat/type';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
import { chatContentReplaceBlock } from '@fastgpt/global/core/chat/utils';
const ChatHeader = ({
@@ -28,12 +29,13 @@ const ChatHeader = ({
}) => {
const router = useRouter();
const theme = useTheme();
const { t } = useTranslation();
const { isPc } = useSystemStore();
const title = useMemo(
() =>
chatContentReplaceBlock(history[history.length - 2]?.value)?.slice(0, 8) ||
appName ||
'新对话',
t('chat.New Chat'),
[appName, history]
);
@@ -52,7 +54,11 @@ const ChatHeader = ({
</Box>
<Tag>
<MyIcon name={'history'} w={'14px'} />
<Box ml={1}>{history.length === 0 ? '新的对话' : `${history.length}条记录`}</Box>
<Box ml={1}>
{history.length === 0
? t('chat.Fresh Chat')
: t('chat.History Amount', { amount: history.length })}
</Box>
</Tag>
{!!chatModels && chatModels.length > 0 && (
<Tag ml={2} colorSchema={'green'}>