mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 22:03:54 +00:00
fix i18next.d.ts (#2064)
* fix i18next.d.ts * feat: packages web i18n * delete file
This commit is contained in:
@@ -83,11 +83,11 @@ const MyRadio = ({
|
||||
)}
|
||||
<Box pr={hiddenCircle ? 0 : 2} flex={'1 0 0'}>
|
||||
<Box fontSize={'sm'} color={'myGray.800'}>
|
||||
{typeof item.title === 'string' ? t(item.title) : item.title}
|
||||
{typeof item.title === 'string' ? t(item.title as any) : item.title}
|
||||
</Box>
|
||||
{!!item.desc && (
|
||||
<Box fontSize={'mini'} color={'myGray.500'} lineHeight={1.2}>
|
||||
{t(item.desc)}
|
||||
{t(item.desc as any)}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
@@ -52,7 +52,7 @@ const VariableEdit = ({
|
||||
const VariableTypeList = useMemo(
|
||||
() =>
|
||||
Object.entries(variableMap).map(([key, value]) => ({
|
||||
title: t(value.title),
|
||||
title: t(value.title as any),
|
||||
icon: value.icon,
|
||||
value: key
|
||||
})),
|
||||
@@ -219,7 +219,7 @@ const VariableEdit = ({
|
||||
{/* desc */}
|
||||
{variableMap[variableType]?.desc && (
|
||||
<Box mt={2} fontSize={'sm'} color={'myGray.500'} whiteSpace={'pre-wrap'}>
|
||||
{t(variableMap[variableType].desc)}
|
||||
{t(variableMap[variableType].desc as any)}
|
||||
</Box>
|
||||
)}
|
||||
|
||||
|
@@ -510,7 +510,7 @@ const ChatBox = (
|
||||
autoTTSResponse && splitText2Audio(responseText, true);
|
||||
} catch (err: any) {
|
||||
toast({
|
||||
title: t(getErrText(err, 'core.chat.error.Chat error')),
|
||||
title: t(getErrText(err, 'core.chat.error.Chat error') as any),
|
||||
status: 'error',
|
||||
duration: 5000,
|
||||
isClosable: true
|
||||
@@ -814,7 +814,7 @@ const ChatBox = (
|
||||
|
||||
return {
|
||||
status: chatContent.status || 'loading',
|
||||
name: t(chatContent.moduleName || '') || t('common:common.Loading')
|
||||
name: t(chatContent.moduleName || ('' as any)) || t('common:common.Loading')
|
||||
};
|
||||
}, [chatHistories, isChatting, t]);
|
||||
|
||||
|
@@ -50,7 +50,7 @@ const RenderPluginInput = ({
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
isDisabled={isDisabled}
|
||||
placeholder={t(placeholder)}
|
||||
placeholder={t(placeholder as any)}
|
||||
bg={'myGray.50'}
|
||||
isInvalid={isInvalid}
|
||||
/>
|
||||
@@ -88,7 +88,7 @@ const RenderPluginInput = ({
|
||||
return (
|
||||
<JsonEditor
|
||||
bg={'myGray.50'}
|
||||
placeholder={t(placeholder || '')}
|
||||
placeholder={t(placeholder || ('' as any))}
|
||||
resize
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
|
@@ -136,7 +136,7 @@ export const ResponseBox = React.memo(function ResponseBox({
|
||||
alt={''}
|
||||
w={['14px', '16px']}
|
||||
/>
|
||||
{t(item.moduleName)}
|
||||
{t(item.moduleName as any)}
|
||||
</Flex>
|
||||
),
|
||||
value: `${i}`
|
||||
@@ -177,7 +177,7 @@ export const ResponseBox = React.memo(function ResponseBox({
|
||||
<>
|
||||
<Row
|
||||
label={t('common:core.chat.response.module name')}
|
||||
value={t(activeModule.moduleName)}
|
||||
value={t(activeModule.moduleName as any)}
|
||||
/>
|
||||
{activeModule?.totalPoints !== undefined && (
|
||||
<Row
|
||||
|
@@ -112,7 +112,7 @@ const QuoteItem = ({
|
||||
{score?.primaryScore && (
|
||||
<>
|
||||
{canViewSource ? (
|
||||
<MyTooltip label={t(SearchScoreTypeMap[score.primaryScore.type]?.desc)}>
|
||||
<MyTooltip label={t(SearchScoreTypeMap[score.primaryScore.type]?.desc as any)}>
|
||||
<Flex
|
||||
px={'12px'}
|
||||
py={'5px'}
|
||||
@@ -132,7 +132,7 @@ const QuoteItem = ({
|
||||
mx={2}
|
||||
/>
|
||||
<Box>
|
||||
{t(SearchScoreTypeMap[score.primaryScore.type]?.label)}
|
||||
{t(SearchScoreTypeMap[score.primaryScore.type]?.label as any)}
|
||||
{SearchScoreTypeMap[score.primaryScore.type]?.showScore
|
||||
? ` ${score.primaryScore.value.toFixed(4)}`
|
||||
: ''}
|
||||
@@ -159,7 +159,7 @@ const QuoteItem = ({
|
||||
)}
|
||||
{canViewSource &&
|
||||
score.secondaryScore.map((item, i) => (
|
||||
<MyTooltip key={item.type} label={t(SearchScoreTypeMap[item.type]?.desc)}>
|
||||
<MyTooltip key={item.type} label={t(SearchScoreTypeMap[item.type]?.desc as any)}>
|
||||
<Box fontSize={'xs'}>
|
||||
<Flex alignItems={'flex-start'} lineHeight={1.2} mb={1}>
|
||||
<Box
|
||||
@@ -172,7 +172,7 @@ const QuoteItem = ({
|
||||
<Box transform={'scale(0.9)'}>#{item.index + 1}</Box>
|
||||
</Box>
|
||||
<Box transform={'scale(0.9)'}>
|
||||
{t(SearchScoreTypeMap[item.type]?.label)}: {item.value.toFixed(4)}
|
||||
{t(SearchScoreTypeMap[item.type]?.label as any)}: {item.value.toFixed(4)}
|
||||
</Box>
|
||||
</Flex>
|
||||
<Box h={'4px'}>
|
||||
|
@@ -68,7 +68,7 @@ const SearchParamsTip = ({
|
||||
w={'12px'}
|
||||
mr={'1px'}
|
||||
/>
|
||||
{t(DatasetSearchModeMap[searchMode]?.title)}
|
||||
{t(DatasetSearchModeMap[searchMode]?.title as any)}
|
||||
</Flex>
|
||||
</Td>
|
||||
<Td pt={0} pb={2}>
|
||||
|
@@ -343,7 +343,7 @@ function EditKeyModal({
|
||||
placeholder={publishT('key alias') || 'key alias'}
|
||||
maxLength={20}
|
||||
{...register('name', {
|
||||
required: t('common:common.Name is empty') || 'Name is empty'
|
||||
required: t('common:common.name_is_empty') || 'name_is_empty'
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
|
@@ -34,7 +34,7 @@ const PermissionIconText = ({
|
||||
return PermissionTypeMap[per] ? (
|
||||
<HStack spacing={1} fontSize={fontSize} {...props}>
|
||||
<MyIcon name={PermissionTypeMap[per]?.iconLight as any} w={w} color={iconColor} />
|
||||
<Box lineHeight={1}>{t(PermissionTypeMap[per]?.label)}</Box>
|
||||
<Box lineHeight={1}>{t(PermissionTypeMap[per]?.label as any)}</Box>
|
||||
</HStack>
|
||||
) : null;
|
||||
};
|
||||
|
@@ -189,7 +189,7 @@ function PermissionSelect({
|
||||
<Box ml={4}>
|
||||
<Box>{item.name}</Box>
|
||||
<Box color={'myGray.500'} fontSize={'mini'}>
|
||||
{t(item.description)}
|
||||
{t(item.description as any)}
|
||||
</Box>
|
||||
</Box>
|
||||
</Flex>
|
||||
|
@@ -68,7 +68,7 @@ function MemberTable() {
|
||||
/>
|
||||
</Td>
|
||||
<Td color={TeamMemberStatusMap[item.status].color}>
|
||||
{t(TeamMemberStatusMap[item.status]?.label || '')}
|
||||
{t(TeamMemberStatusMap[item.status]?.label || ('' as any))}
|
||||
</Td>
|
||||
<Td>
|
||||
{userInfo?.team.permission.hasManagePer &&
|
||||
|
@@ -103,7 +103,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
|
||||
<ModalBody style={{ padding: '10rpx' }}>
|
||||
<Flex mt={3} alignItems={'center'}>
|
||||
<Box mb={2} fontWeight="semibold">
|
||||
{t('common:同步链接')}
|
||||
{t('common:sync_link')}
|
||||
</Box>
|
||||
<Input
|
||||
flex={1}
|
||||
@@ -118,7 +118,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
|
||||
</Flex>
|
||||
<Flex mt={3} alignItems={'center'}>
|
||||
<Box mb={2} fontWeight="semibold">
|
||||
{t('common:分享链接')}
|
||||
{t('common:share_link')}
|
||||
</Box>
|
||||
{/* code */}
|
||||
<Box ml={4} borderRadius={'md'} overflow={'hidden'}>
|
||||
@@ -143,7 +143,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
|
||||
</Flex>
|
||||
<Flex mt={3} alignItems={'center'}>
|
||||
<Box mb={2} fontWeight="semibold">
|
||||
{t('common:标签列表')}
|
||||
{t('common:tag_list')}
|
||||
</Box>
|
||||
<HStack
|
||||
ml={4}
|
||||
|
@@ -45,7 +45,7 @@ const BillTable = () => {
|
||||
[
|
||||
{ label: t('common:common.All'), value: '' },
|
||||
...Object.entries(billTypeMap).map(([key, value]) => ({
|
||||
label: t(value.label),
|
||||
label: t(value.label as any),
|
||||
value: key
|
||||
}))
|
||||
] as {
|
||||
@@ -130,12 +130,12 @@ const BillTable = () => {
|
||||
{bills.map((item, i) => (
|
||||
<Tr key={item._id}>
|
||||
<Td>{i + 1}</Td>
|
||||
<Td>{t(billTypeMap[item.type]?.label)}</Td>
|
||||
<Td>{t(billTypeMap[item.type]?.label as any)}</Td>
|
||||
<Td>
|
||||
{item.createTime ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') : '-'}
|
||||
</Td>
|
||||
<Td>{formatStorePrice2Read(item.price)}元</Td>
|
||||
<Td>{t(billStatusMap[item.status]?.label)}</Td>
|
||||
<Td>{t(billStatusMap[item.status]?.label as any)}</Td>
|
||||
<Td>
|
||||
{item.status === 'NOTPAY' && (
|
||||
<Button mr={4} onClick={() => handleRefreshPayOrder(item._id)} size={'sm'}>
|
||||
@@ -201,12 +201,12 @@ function BillDetailModal({ bill, onClose }: { bill: BillSchemaType; onClose: ()
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<FormLabel flex={'0 0 120px'}>{t('common:support.wallet.bill.Status')}:</FormLabel>
|
||||
<Box>{t(billStatusMap[bill.status]?.label)}</Box>
|
||||
<Box>{t(billStatusMap[bill.status]?.label as any)}</Box>
|
||||
</Flex>
|
||||
{!!bill.metadata?.payWay && (
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<FormLabel flex={'0 0 120px'}>{t('common:support.wallet.bill.payWay.Way')}:</FormLabel>
|
||||
<Box>{t(billPayWayMap[bill.metadata.payWay]?.label)}</Box>
|
||||
<Box>{t(billPayWayMap[bill.metadata.payWay]?.label as any)}</Box>
|
||||
</Flex>
|
||||
)}
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
@@ -215,14 +215,14 @@ function BillDetailModal({ bill, onClose }: { bill: BillSchemaType; onClose: ()
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<FormLabel flex={'0 0 120px'}>{t('common:support.wallet.bill.Type')}:</FormLabel>
|
||||
<Box>{t(billTypeMap[bill.type]?.label)}</Box>
|
||||
<Box>{t(billTypeMap[bill.type]?.label as any)}</Box>
|
||||
</Flex>
|
||||
{!!bill.metadata?.subMode && (
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<FormLabel flex={'0 0 120px'}>
|
||||
{t('common:support.wallet.subscription.mode.Period')}:
|
||||
</FormLabel>
|
||||
<Box>{t(subModeMap[bill.metadata.subMode]?.label)}</Box>
|
||||
<Box>{t(subModeMap[bill.metadata.subMode]?.label as any)}</Box>
|
||||
</Flex>
|
||||
)}
|
||||
{!!bill.metadata?.standSubLevel && (
|
||||
@@ -230,7 +230,7 @@ function BillDetailModal({ bill, onClose }: { bill: BillSchemaType; onClose: ()
|
||||
<FormLabel flex={'0 0 120px'}>
|
||||
{t('common:support.wallet.subscription.Stand plan level')}:
|
||||
</FormLabel>
|
||||
<Box>{t(standardSubLevelMap[bill.metadata.standSubLevel]?.label)}</Box>
|
||||
<Box>{t(standardSubLevelMap[bill.metadata.standSubLevel]?.label as any)}</Box>
|
||||
</Flex>
|
||||
)}
|
||||
{bill.metadata?.month !== undefined && (
|
||||
|
@@ -404,7 +404,7 @@ const PlanUsage = () => {
|
||||
{t('common:support.wallet.subscription.Current plan')}
|
||||
</Box>
|
||||
<Box fontWeight={'bold'} fontSize="lg">
|
||||
{t(planName)}
|
||||
{t(planName as any)}
|
||||
</Box>
|
||||
|
||||
{isFreeTeam ? (
|
||||
|
@@ -77,11 +77,11 @@ const UsageDetail = ({ usage, onClose }: { usage: UsageItemType; onClose: () =>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<FormLabel flex={'0 0 80px'}>{t('common:support.wallet.usage.App name')}:</FormLabel>
|
||||
<Box>{t(usage.appName) || '-'}</Box>
|
||||
<Box>{t(usage.appName as any) || '-'}</Box>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<FormLabel flex={'0 0 80px'}>{t('common:support.wallet.usage.Source')}:</FormLabel>
|
||||
<Box>{t(UsageSourceMap[usage.source]?.label)}</Box>
|
||||
<Box>{t(UsageSourceMap[usage.source]?.label as any)}</Box>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} pb={4}>
|
||||
<FormLabel flex={'0 0 80px'}>{t('common:support.wallet.usage.Total points')}:</FormLabel>
|
||||
@@ -106,7 +106,7 @@ const UsageDetail = ({ usage, onClose }: { usage: UsageItemType; onClose: () =>
|
||||
<Tbody>
|
||||
{filterBillList.map((item, i) => (
|
||||
<Tr key={i}>
|
||||
<Td>{t(item.moduleName)}</Td>
|
||||
<Td>{t(item.moduleName as any)}</Td>
|
||||
{hasModel && <Td>{item.model ?? '-'}</Td>}
|
||||
{hasToken && <Td>{item.tokens ?? '-'}</Td>}
|
||||
{hasCharsLen && <Td>{item.charsLength ?? '-'}</Td>}
|
||||
|
@@ -51,7 +51,7 @@ const UsageTable = () => {
|
||||
[
|
||||
{ label: t('common:common.All'), value: '' },
|
||||
...Object.entries(UsageSourceMap).map(([key, value]) => ({
|
||||
label: t(value.label),
|
||||
label: t(value.label as any),
|
||||
value: key
|
||||
}))
|
||||
] as {
|
||||
@@ -169,8 +169,8 @@ const UsageTable = () => {
|
||||
<Tr key={item.id}>
|
||||
{/* <Td>{item.memberName}</Td> */}
|
||||
<Td>{dayjs(item.time).format('YYYY/MM/DD HH:mm:ss')}</Td>
|
||||
<Td>{t(UsageSourceMap[item.source]?.label) || '-'}</Td>
|
||||
<Td>{t(item.appName) || '-'}</Td>
|
||||
<Td>{t(UsageSourceMap[item.source]?.label as any) || '-'}</Td>
|
||||
<Td>{t(item.appName as any) || '-'}</Td>
|
||||
<Td>{formatNumber(item.totalPoints) || 0}</Td>
|
||||
<Td>
|
||||
<Button size={'sm'} variant={'whitePrimary'} onClick={() => setUsageDetail(item)}>
|
||||
|
@@ -73,8 +73,9 @@ const StandDetailModal = ({ onClose }: { onClose: () => void }) => {
|
||||
w={'20px'}
|
||||
color={'myGray.800'}
|
||||
/>
|
||||
{t(subTypeMap[type]?.label)}
|
||||
{currentSubLevel && `(${t(standardSubLevelMap[currentSubLevel]?.label)})`}
|
||||
{t(subTypeMap[type]?.label as any)}
|
||||
{currentSubLevel &&
|
||||
`(${t(standardSubLevelMap[currentSubLevel]?.label as any)})`}
|
||||
</Td>
|
||||
<Td>{datasetSize ? `${datasetSize}组` : '-'}</Td>
|
||||
<Td>
|
||||
|
@@ -126,7 +126,7 @@ const Logs = () => {
|
||||
onClick={() => setDetailLogsId(item.id)}
|
||||
>
|
||||
<Td>
|
||||
<Box>{t(ChatSourceMap[item.source]?.name || 'UnKnow')}</Box>
|
||||
<Box>{t(ChatSourceMap[item.source]?.name || ('UnKnow' as any))}</Box>
|
||||
<Box color={'myGray.500'}>{dayjs(item.time).format('YYYY/MM/DD HH:mm')}</Box>
|
||||
</Td>
|
||||
<Td className="textEllipsis" maxW={'250px'}>
|
||||
|
@@ -69,7 +69,7 @@ const FeiShuEditModal = ({
|
||||
placeholder={publishT('Feishu name') || 'Link Name'} // TODO: i18n
|
||||
maxLength={20}
|
||||
{...register('name', {
|
||||
required: t('common:common.Name is empty') || 'Name is empty'
|
||||
required: t('common:common.name_is_empty') || 'name_is_empty'
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
@@ -150,7 +150,7 @@ const FeiShuEditModal = ({
|
||||
<Flex alignItems={'center'} mt={4}>
|
||||
<Box flex={'0 0 90px'}>{t('common:core.module.http.AppId')}</Box>
|
||||
<Input
|
||||
placeholder={t('common:core.module.http.appId') || 'Link Name'}
|
||||
placeholder={t('common:core.module.http.AppId') || 'Link Name'}
|
||||
// maxLength={20}
|
||||
{...register('app.appId', {
|
||||
required: true
|
||||
@@ -158,12 +158,12 @@ const FeiShuEditModal = ({
|
||||
/>
|
||||
</Flex>
|
||||
<Flex alignItems={'center'} mt={4}>
|
||||
<Box flex={'0 0 90px'}>{t('common:core.module.http.AppSecret')}</Box>
|
||||
<Box flex={'0 0 90px'}>{t('common:core.module.http.AppSecret' as any)}</Box>
|
||||
<Input
|
||||
placeholder={'App Secret'}
|
||||
// maxLength={20}
|
||||
{...register('app.appSecret', {
|
||||
required: t('common:common.Name is empty') || 'Name is empty'
|
||||
required: t('common:common.name_is_empty') || 'name_is_empty'
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
@@ -173,7 +173,7 @@ const FeiShuEditModal = ({
|
||||
placeholder="Encrypt Key"
|
||||
// maxLength={20}
|
||||
{...register('app.encryptKey', {
|
||||
required: t('common:common.Name is empty') || 'Name is empty'
|
||||
required: t('common:common.name_is_empty') || 'name_is_empty'
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
@@ -183,7 +183,7 @@ const FeiShuEditModal = ({
|
||||
placeholder="Verification Token"
|
||||
// maxLength={20}
|
||||
{...register('app.verificationToken', {
|
||||
required: t('common:common.Name is empty') || 'Name is empty'
|
||||
required: t('common:common.name_is_empty') || 'name_is_empty'
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
|
@@ -108,7 +108,7 @@ const FeiShu = ({ appId }: { appId: string }) => {
|
||||
)}
|
||||
<Td>
|
||||
{item.lastTime
|
||||
? t(formatTimeToChatTime(item.lastTime))
|
||||
? t(formatTimeToChatTime(item.lastTime) as any)
|
||||
: t('common:common.Un used')}
|
||||
</Td>
|
||||
<Td display={'flex'} alignItems={'center'}>
|
||||
|
@@ -308,7 +308,7 @@ function EditLinkModal({
|
||||
placeholder={publishT('Link Name')}
|
||||
maxLength={20}
|
||||
{...register('name', {
|
||||
required: t('common:common.Name is empty') || 'Name is empty'
|
||||
required: t('common:common.name_is_empty') || 'name_is_empty'
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
|
@@ -214,10 +214,10 @@ const RenderList = React.memo(function RenderList({
|
||||
borderRadius={'0'}
|
||||
/>
|
||||
<Box ml={5} flex={'1 0 0'}>
|
||||
<Box color={'black'}>{t(item.name)}</Box>
|
||||
<Box color={'black'}>{t(item.name as any)}</Box>
|
||||
{item.intro && (
|
||||
<Box className="textEllipsis3" color={'myGray.500'} fontSize={'xs'}>
|
||||
{t(item.intro)}
|
||||
{t(item.intro as any)}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
@@ -264,7 +264,7 @@ const RenderList = React.memo(function RenderList({
|
||||
return (
|
||||
<Box key={input.key} _notLast={{ mb: 4 }} px={1}>
|
||||
<Flex position={'relative'} mb={1} alignItems={'center'}>
|
||||
{t(input.debugLabel || input.label)}
|
||||
{t(input.debugLabel || (input.label as any))}
|
||||
{input.description && <QuestionTip label={input.description} ml={1} />}
|
||||
</Flex>
|
||||
{(() => {
|
||||
@@ -274,7 +274,7 @@ const RenderList = React.memo(function RenderList({
|
||||
{...register(input.key, {
|
||||
required
|
||||
})}
|
||||
placeholder={t(input.placeholder || '')}
|
||||
placeholder={t(input.placeholder || ('' as any))}
|
||||
bg={'myGray.50'}
|
||||
/>
|
||||
);
|
||||
@@ -308,7 +308,7 @@ const RenderList = React.memo(function RenderList({
|
||||
return (
|
||||
<JsonEditor
|
||||
bg={'myGray.50'}
|
||||
placeholder={t(input.placeholder || '')}
|
||||
placeholder={t(input.placeholder || ('' as any))}
|
||||
resize
|
||||
value={getValues(input.key)}
|
||||
onChange={(e) => {
|
||||
|
@@ -64,7 +64,7 @@ const TagsEditModal = ({ onClose }: { onClose: () => void }) => {
|
||||
>
|
||||
<ModalBody>
|
||||
<Box mb={3} fontWeight="semibold">
|
||||
{t('common:团队标签')}
|
||||
{t('common:team_tag')}
|
||||
</Box>
|
||||
<Menu closeOnSelect={false}>
|
||||
<MenuButton className="menu-btn" maxHeight={'250'} w={'100%'}>
|
||||
|
@@ -333,11 +333,11 @@ const RenderList = React.memo(function RenderList({
|
||||
template: {
|
||||
...templateNode,
|
||||
name: computedNewNodeName({
|
||||
templateName: t(templateNode.name),
|
||||
templateName: t(templateNode.name as any),
|
||||
flowNodeType: templateNode.flowNodeType,
|
||||
pluginId: templateNode.pluginId
|
||||
}),
|
||||
intro: t(templateNode.intro || '')
|
||||
intro: t(templateNode.intro || ('' as any))
|
||||
},
|
||||
position: { x: mouseX, y: mouseY - 20 },
|
||||
selected: true
|
||||
@@ -374,7 +374,7 @@ const RenderList = React.memo(function RenderList({
|
||||
{item.label && (
|
||||
<Flex>
|
||||
<Box fontSize={'sm'} fontWeight={'bold'} flex={1}>
|
||||
{t(item.label)}
|
||||
{t(item.label as any)}
|
||||
</Box>
|
||||
</Flex>
|
||||
)}
|
||||
@@ -394,11 +394,11 @@ const RenderList = React.memo(function RenderList({
|
||||
borderRadius={'0'}
|
||||
/>
|
||||
<Box fontWeight={'bold'} ml={3}>
|
||||
{t(template.name)}
|
||||
{t(template.name as any)}
|
||||
</Box>
|
||||
</Flex>
|
||||
<Box mt={2} color={'myGray.500'}>
|
||||
{t(template.intro) || t('common:core.workflow.Not intro')}
|
||||
{t(template.intro as any) || t('common:core.workflow.Not intro')}
|
||||
</Box>
|
||||
</Box>
|
||||
}
|
||||
@@ -441,7 +441,7 @@ const RenderList = React.memo(function RenderList({
|
||||
borderRadius={'0'}
|
||||
/>
|
||||
<Box color={'black'} fontSize={'sm'} ml={5} flex={'1 0 0'}>
|
||||
{t(template.name)}
|
||||
{t(template.name as any)}
|
||||
</Box>
|
||||
</Flex>
|
||||
</MyTooltip>
|
||||
|
@@ -193,7 +193,7 @@ export const useDebug = () => {
|
||||
{...register(input.key, {
|
||||
required
|
||||
})}
|
||||
placeholder={t(input.placeholder || '')}
|
||||
placeholder={t(input.placeholder || ('' as any))}
|
||||
bg={'myGray.50'}
|
||||
/>
|
||||
);
|
||||
@@ -232,7 +232,7 @@ export const useDebug = () => {
|
||||
return (
|
||||
<JsonEditor
|
||||
bg={'myGray.50'}
|
||||
placeholder={t(input.placeholder || '')}
|
||||
placeholder={t(input.placeholder || ('' as any))}
|
||||
resize
|
||||
value={value}
|
||||
onChange={(e) => {
|
||||
@@ -251,7 +251,7 @@ export const useDebug = () => {
|
||||
*
|
||||
</Box>
|
||||
)}
|
||||
{t(input.debugLabel || input.label)}
|
||||
{t(input.debugLabel || (input.label as any))}
|
||||
</Box>
|
||||
{input.description && <QuestionTip ml={2} label={input.description} />}
|
||||
</Flex>
|
||||
|
@@ -203,7 +203,7 @@ function Reference({
|
||||
/>
|
||||
</Flex>
|
||||
<ReferSelector
|
||||
placeholder={t(inputChildren.referencePlaceholder || '选择知识库引用')}
|
||||
placeholder={t((inputChildren.referencePlaceholder as any) || '选择知识库引用')}
|
||||
list={referenceList}
|
||||
value={formatValue}
|
||||
onSelect={onSelect}
|
||||
|
@@ -321,7 +321,7 @@ const Reference = ({
|
||||
|
||||
return (
|
||||
<ReferSelector
|
||||
placeholder={t('common:选择引用变量')}
|
||||
placeholder={t('common:select_reference_variable')}
|
||||
list={referenceList}
|
||||
value={formatValue}
|
||||
onSelect={onSelect}
|
||||
|
@@ -163,7 +163,7 @@ const FieldEditModal = ({
|
||||
}, [inputType]);
|
||||
|
||||
const valueTypeSelectList = Object.values(FlowValueTypeMap).map((item) => ({
|
||||
label: t(item.label),
|
||||
label: t(item.label as any),
|
||||
value: item.value
|
||||
}));
|
||||
const defaultValueType =
|
||||
|
@@ -116,8 +116,8 @@ const NodePluginInput = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
|
||||
const inputType = input.renderTypeList[0];
|
||||
return {
|
||||
icon: FlowNodeInputMap[inputType]?.icon as string,
|
||||
label: t(input.label),
|
||||
type: input.valueType ? t(FlowValueTypeMap[input.valueType]?.label) : '-',
|
||||
label: t(input.label as any),
|
||||
type: input.valueType ? t(FlowValueTypeMap[input.valueType]?.label as any) : '-',
|
||||
isTool: !!input.toolDescription,
|
||||
key: input.key
|
||||
};
|
||||
|
@@ -200,7 +200,7 @@ function Reference({
|
||||
/>
|
||||
</Flex>
|
||||
<ReferSelector
|
||||
placeholder={t(input.referencePlaceholder || '选择引用变量')}
|
||||
placeholder={t((input.referencePlaceholder as any) || 'select_reference_variable')}
|
||||
list={referenceList}
|
||||
value={formatValue}
|
||||
onSelect={onSelect}
|
||||
|
@@ -302,7 +302,7 @@ const Reference = ({
|
||||
|
||||
return (
|
||||
<ReferSelector
|
||||
placeholder={t('common:选择引用变量')}
|
||||
placeholder={t('common:select_reference_variable')}
|
||||
list={referenceList}
|
||||
value={formatValue}
|
||||
onSelect={onSelect}
|
||||
|
@@ -139,7 +139,7 @@ const NodeCard = (props: Props) => {
|
||||
<Flex alignItems={'center'}>
|
||||
<Avatar src={avatar} borderRadius={'0'} objectFit={'contain'} w={'30px'} h={'30px'} />
|
||||
<Box ml={3} fontSize={'md'} fontWeight={'medium'}>
|
||||
{t(name)}
|
||||
{t(name as any)}
|
||||
</Box>
|
||||
{!menuForbid?.rename && (
|
||||
<MyIcon
|
||||
@@ -443,7 +443,7 @@ const NodeIntro = React.memo(function NodeIntro({
|
||||
<>
|
||||
<Flex alignItems={'flex-end'} py={1}>
|
||||
<Box fontSize={'xs'} color={'myGray.600'} flex={'1 0 0'}>
|
||||
{t(intro)}
|
||||
{t(intro as any)}
|
||||
</Box>
|
||||
{NodeIsTool && (
|
||||
<Button
|
||||
|
@@ -62,7 +62,7 @@ const FieldModal = ({
|
||||
if (!customInputConfig.selectValueTypeList) return [];
|
||||
|
||||
const dataTypeSelectList = Object.values(FlowValueTypeMap).map((item) => ({
|
||||
label: t(item.label),
|
||||
label: t(item.label as any),
|
||||
value: item.value
|
||||
}));
|
||||
|
||||
|
@@ -52,8 +52,8 @@ const InputLabel = ({ nodeId, input }: Props) => {
|
||||
fontWeight={'medium'}
|
||||
color={'myGray.600'}
|
||||
>
|
||||
<FormLabel required={required}>{t(label)}</FormLabel>
|
||||
{description && <QuestionTip ml={1} label={t(description)}></QuestionTip>}
|
||||
<FormLabel required={required}>{t(label as any)}</FormLabel>
|
||||
{description && <QuestionTip ml={1} label={t(description as any)}></QuestionTip>}
|
||||
</Flex>
|
||||
{/* value type */}
|
||||
{renderType === FlowNodeInputTypeEnum.reference && <ValueTypeLabel valueType={valueType} />}
|
||||
|
@@ -59,7 +59,7 @@ const DynamicInputs = (props: RenderInputProps) => {
|
||||
<HStack className="nodrag" cursor={'default'} position={'relative'}>
|
||||
<HStack spacing={1} position={'relative'} fontWeight={'medium'} color={'myGray.600'}>
|
||||
<Box>{item.label || workflowT('Custom input')}</Box>
|
||||
{item.description && <QuestionTip label={t(item.description)} />}
|
||||
{item.description && <QuestionTip label={t(item.description as any)} />}
|
||||
</HStack>
|
||||
<Box flex={'1 0 0'} />
|
||||
<Button
|
||||
@@ -208,7 +208,7 @@ function Reference({
|
||||
/>
|
||||
</Flex>
|
||||
<ReferSelector
|
||||
placeholder={t(inputChildren.referencePlaceholder || '选择引用变量')}
|
||||
placeholder={t((inputChildren.referencePlaceholder as any) || 'select_reference_variable')}
|
||||
list={referenceList}
|
||||
value={formatValue}
|
||||
onSelect={onSelect}
|
||||
|
@@ -79,7 +79,7 @@ const Reference = ({ item, nodeId }: RenderInputProps) => {
|
||||
|
||||
return (
|
||||
<ReferSelector
|
||||
placeholder={t(item.referencePlaceholder || '选择引用变量')}
|
||||
placeholder={t((item.referencePlaceholder as any) || 'select_reference_variable')}
|
||||
list={referenceList}
|
||||
value={formatValue}
|
||||
onSelect={onSelect}
|
||||
@@ -121,7 +121,7 @@ export const useReference = ({
|
||||
label: (
|
||||
<Flex alignItems={'center'}>
|
||||
<Avatar mr={1} src={node.avatar} w={'14px'} borderRadius={'ms'} />
|
||||
<Box>{t(node.name)}</Box>
|
||||
<Box>{t(node.name as any)}</Box>
|
||||
</Flex>
|
||||
),
|
||||
value: node.nodeId,
|
||||
@@ -135,7 +135,7 @@ export const useReference = ({
|
||||
.filter((output) => output.id !== NodeOutputKeyEnum.addOutputParam)
|
||||
.map((output) => {
|
||||
return {
|
||||
label: t(output.label || ''),
|
||||
label: t((output.label as any) || ''),
|
||||
value: output.id
|
||||
};
|
||||
})
|
||||
|
@@ -54,10 +54,10 @@ const TextareaRender = ({ inputs = [], item, nodeId }: RenderInputProps) => {
|
||||
return (
|
||||
<PromptEditor
|
||||
variables={variables}
|
||||
title={t(item.label)}
|
||||
title={t(item.label as any)}
|
||||
maxLength={item.maxLength}
|
||||
h={150}
|
||||
placeholder={t(item.placeholder || '')}
|
||||
placeholder={t((item.placeholder as any) || '')}
|
||||
value={item.value}
|
||||
onChange={onChange}
|
||||
isFlow={true}
|
||||
|
@@ -65,7 +65,7 @@ const FieldModal = ({
|
||||
const dataTypeSelectList = Object.values(FlowValueTypeMap)
|
||||
.slice(0, -1)
|
||||
.map((item) => ({
|
||||
label: t(item.label),
|
||||
label: t(item.label as any),
|
||||
value: item.value
|
||||
}));
|
||||
|
||||
|
@@ -33,9 +33,9 @@ const OutputLabel = ({ nodeId, output }: { nodeId: string; output: FlowNodeOutpu
|
||||
mr={1}
|
||||
ml={output.type === FlowNodeOutputTypeEnum.source ? 1 : 0}
|
||||
>
|
||||
{t(label)}
|
||||
{t(label as any)}
|
||||
</Box>
|
||||
{description && <QuestionTip label={t(description)} />}
|
||||
{description && <QuestionTip label={t(description as any)} />}
|
||||
<ValueTypeLabel valueType={valueType} />
|
||||
</Flex>
|
||||
{output.type === FlowNodeOutputTypeEnum.source && (
|
||||
|
@@ -97,7 +97,7 @@ const RenderOutput = ({
|
||||
<VariableTable
|
||||
variables={filterAddOutput.map((output) => ({
|
||||
label: output.label || '-',
|
||||
type: output.valueType ? t(FlowValueTypeMap[output.valueType]?.label) : '-',
|
||||
type: output.valueType ? t(FlowValueTypeMap[output.valueType]?.label as any) : '-',
|
||||
key: output.key
|
||||
}))}
|
||||
onEdit={(key) => {
|
||||
|
@@ -197,11 +197,11 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
|
||||
<Flex alignItems={'center'}>
|
||||
<Avatar src={item.avatar} borderRadius={'md'} w={'20px'} />
|
||||
<Box ml={3} color={'myGray.900'}>
|
||||
{t(item.name)}
|
||||
{t(item.name as any)}
|
||||
</Box>
|
||||
</Flex>
|
||||
<Box fontSize={'xs'} mt={2} color={'myGray.600'}>
|
||||
{t(item.intro)}
|
||||
{t(item.intro as any)}
|
||||
</Box>
|
||||
</Card>
|
||||
))}
|
||||
|
@@ -227,7 +227,7 @@ const HttpPluginEditModal = ({
|
||||
ml={4}
|
||||
bg={'myWhite.600'}
|
||||
{...register('name', {
|
||||
required: t("common.Name Can't Be Empty")
|
||||
required: t('common:common.name_is_empty')
|
||||
})}
|
||||
/>
|
||||
</Flex>
|
||||
|
@@ -121,7 +121,7 @@ const Header = ({}: {}) => {
|
||||
FirstPathDom={
|
||||
<>
|
||||
<Box fontWeight={'bold'} fontSize={['sm', 'md']}>
|
||||
{t(DatasetTypeMap[datasetDetail?.type]?.collectionLabel)}({total})
|
||||
{t(DatasetTypeMap[datasetDetail?.type]?.collectionLabel as any)}({total})
|
||||
</Box>
|
||||
{datasetDetail?.websiteConfig?.url && (
|
||||
<Flex fontSize={'sm'}>
|
||||
|
@@ -137,7 +137,7 @@ const CollectionCard = () => {
|
||||
getData(pageNum);
|
||||
toast({
|
||||
status: 'success',
|
||||
title: t(DatasetCollectionSyncResultMap[res]?.label)
|
||||
title: t(DatasetCollectionSyncResultMap[res]?.label as any)
|
||||
});
|
||||
},
|
||||
errorToast: t('common:core.dataset.error.Start Sync Failed')
|
||||
@@ -247,7 +247,7 @@ const CollectionCard = () => {
|
||||
</Td>
|
||||
<Td py={2}>
|
||||
{!checkCollectionIsFolder(collection.type) ? (
|
||||
<>{t(getTrainingTypeLabel(collection.trainingType) || '-')}</>
|
||||
<>{t((getTrainingTypeLabel(collection.trainingType) || '-') as any)}</>
|
||||
) : (
|
||||
'-'
|
||||
)}
|
||||
@@ -259,7 +259,7 @@ const CollectionCard = () => {
|
||||
</Td>
|
||||
<Td py={2}>
|
||||
<MyTag showDot colorSchema={collection.colorSchema as any} type={'borderFill'}>
|
||||
{t(collection.statusText)}
|
||||
{t(collection.statusText as any)}
|
||||
</MyTag>
|
||||
</Td>
|
||||
<Td py={2} onClick={(e) => e.stopPropagation()}>
|
||||
|
@@ -142,7 +142,7 @@ const DataCard = () => {
|
||||
return [
|
||||
{
|
||||
label: t('common:core.dataset.collection.metadata.source'),
|
||||
value: t(DatasetCollectionTypeMap[collection.type]?.name)
|
||||
value: t(DatasetCollectionTypeMap[collection.type]?.name as any)
|
||||
},
|
||||
{
|
||||
label: t('common:core.dataset.collection.metadata.source name'),
|
||||
@@ -166,7 +166,7 @@ const DataCard = () => {
|
||||
},
|
||||
{
|
||||
label: t('common:core.dataset.collection.metadata.Training Type'),
|
||||
value: t(TrainingTypeMap[collection.trainingType]?.label)
|
||||
value: t(TrainingTypeMap[collection.trainingType]?.label as any)
|
||||
},
|
||||
{
|
||||
label: t('common:core.dataset.collection.metadata.Chunk Size'),
|
||||
|
@@ -85,9 +85,9 @@ function DataProcess({ showPreviewChunks = true }: { showPreviewChunks: boolean
|
||||
<FormLabel flex={'0 0 100px'}>{t('common:core.dataset.import.Training mode')}</FormLabel>
|
||||
<LeftRadio
|
||||
list={trainingModeList.map(([key, value]) => ({
|
||||
title: t(value.label),
|
||||
title: t(value.label as any),
|
||||
value: key,
|
||||
tooltip: t(value.tooltip)
|
||||
tooltip: t(value.tooltip as any)
|
||||
}))}
|
||||
px={3}
|
||||
py={2}
|
||||
|
@@ -81,7 +81,7 @@ const InputDataModal = ({
|
||||
icon: 'common/overviewLight'
|
||||
},
|
||||
{
|
||||
label: t('dataset.data.edit.Index', { amount: indexes.length }),
|
||||
label: t('common:dataset.data.edit.Index', { amount: indexes.length }),
|
||||
value: TabEnum.index,
|
||||
icon: 'kbTest'
|
||||
},
|
||||
@@ -126,7 +126,7 @@ const InputDataModal = ({
|
||||
onError(err) {
|
||||
toast({
|
||||
status: 'error',
|
||||
title: t(getErrText(err))
|
||||
title: t(getErrText(err) as any)
|
||||
});
|
||||
onClose();
|
||||
}
|
||||
|
@@ -196,7 +196,7 @@ const Test = ({ datasetId }: { datasetId: string }) => {
|
||||
size={'sm'}
|
||||
onClick={onOpenSelectMode}
|
||||
>
|
||||
{t(searchModeData.title)}
|
||||
{t(searchModeData.title as any)}
|
||||
</Button>
|
||||
</Flex>
|
||||
|
||||
@@ -371,7 +371,7 @@ const TestHistories = React.memo(function TestHistories({
|
||||
w={'12px'}
|
||||
mr={'1px'}
|
||||
/>
|
||||
{t(DatasetSearchModeMap[item.searchMode].title)}
|
||||
{t(DatasetSearchModeMap[item.searchMode].title as any)}
|
||||
</Flex>
|
||||
) : (
|
||||
'-'
|
||||
@@ -382,7 +382,7 @@ const TestHistories = React.memo(function TestHistories({
|
||||
</Box>
|
||||
<Box flex={'0 0 70px'}>
|
||||
{formatTimeToChatTime(item.time).includes('.')
|
||||
? t(formatTimeToChatTime(item.time))
|
||||
? t(formatTimeToChatTime(item.time) as any)
|
||||
: formatTimeToChatTime(item.time)}
|
||||
</Box>
|
||||
<MyTooltip label={t('common:core.dataset.test.delete test history')}>
|
||||
|
@@ -45,7 +45,7 @@ const Detail = ({ datasetId, currentTab }: Props) => {
|
||||
onError(err: any) {
|
||||
router.replace(`/dataset/list`);
|
||||
toast({
|
||||
title: t(getErrText(err, t('common:common.Load Failed'))),
|
||||
title: t(getErrText(err, t('common:common.Load Failed')) as any),
|
||||
status: 'error'
|
||||
});
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ const WechatForm = ({ setPageType, loginSuccess }: Props) => {
|
||||
<FormLayout setPageType={setPageType} pageType={LoginPageTypeEnum.wechat}>
|
||||
<Box>
|
||||
<Box w={'full'} textAlign={'center'} pt={5}>
|
||||
{t('common:support.user.login.Wx qr login')}
|
||||
{t('common:support.user.login.wx_qr_login')}
|
||||
</Box>
|
||||
<Box p={5} display={'flex'} w={'full'} justifyContent={'center'}>
|
||||
{wechatInfo?.codeUrl ? (
|
||||
|
@@ -71,7 +71,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
|
||||
defaultAppTemplates.forEach((template) => {
|
||||
postCreateApp({
|
||||
avatar: template.avatar,
|
||||
name: t(template.name),
|
||||
name: t(template.name as any),
|
||||
modules: template.modules,
|
||||
edges: template.edges,
|
||||
type: template.type
|
||||
|
@@ -157,13 +157,13 @@ const Standard = ({
|
||||
})}
|
||||
>
|
||||
<Box fontSize={'md'} fontWeight={'500'}>
|
||||
{t(item.label)}
|
||||
{t(item.label as any)}
|
||||
</Box>
|
||||
<Box fontSize={['32px', '42px']} fontWeight={'bold'}>
|
||||
¥{item.price}
|
||||
</Box>
|
||||
<Box color={'myGray.500'} h={'40px'} fontSize={'xs'}>
|
||||
{t(item.desc, { title: feConfigs?.systemTitle })}
|
||||
{t(item.desc as any, { title: feConfigs?.systemTitle })}
|
||||
</Box>
|
||||
{(() => {
|
||||
if (
|
||||
|
41
projects/app/src/types/i18next.d.ts
vendored
41
projects/app/src/types/i18next.d.ts
vendored
@@ -1,41 +0,0 @@
|
||||
import 'i18next';
|
||||
import common from '@fastgpt/web/i18n/zh/common.json';
|
||||
import dataset from '@fastgpt/web/i18n/zh/dataset.json';
|
||||
import app from '@fastgpt/web/i18n/zh/app.json';
|
||||
import file from '@fastgpt/web/i18n/zh/file.json';
|
||||
import publish from '@fastgpt/web/i18n/zh/publish.json';
|
||||
import workflow from '@fastgpt/web/i18n/zh/workflow.json';
|
||||
import user from '@fastgpt/web/i18n/zh/user.json';
|
||||
import chat from '@fastgpt/web/i18n/zh/chat.json';
|
||||
|
||||
export interface I18nNamespaces {
|
||||
common: typeof common;
|
||||
dataset: typeof dataset;
|
||||
app: typeof app;
|
||||
file: typeof file;
|
||||
publish: typeof publish;
|
||||
workflow: typeof workflow;
|
||||
user: typeof user;
|
||||
chat: typeof chat;
|
||||
}
|
||||
|
||||
export type I18nNsType = (keyof I18nNamespaces)[];
|
||||
|
||||
const defaultNS: I18nNsType = [
|
||||
'common',
|
||||
'dataset',
|
||||
'app',
|
||||
'file',
|
||||
'publish',
|
||||
'workflow',
|
||||
'user',
|
||||
'chat'
|
||||
];
|
||||
|
||||
declare module 'i18next' {
|
||||
interface CustomTypeOptions {
|
||||
returnNull: false;
|
||||
defaultNS: defaultNS;
|
||||
resources: I18nNamespaces;
|
||||
}
|
||||
}
|
@@ -26,7 +26,7 @@ export const useRequest = ({ successToast, errorToast, onSuccess, onError, ...pr
|
||||
onError?.(err, variables, context);
|
||||
|
||||
if (errorToast !== undefined) {
|
||||
const errText = t(getErrText(err, errorToast || ''));
|
||||
const errText = t(getErrText(err, errorToast || '') as any);
|
||||
if (errText) {
|
||||
toast({
|
||||
title: errText,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { I18nNsType } from '@/types/i18next';
|
||||
import { I18nNsType } from '@fastgpt/web/types/i18next';
|
||||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
||||
|
||||
export const LANG_KEY = 'NEXT_LOCALE_LANG';
|
||||
|
Reference in New Issue
Block a user