fix i18next.d.ts (#2064)

* fix i18next.d.ts

* feat: packages web i18n

* delete file
This commit is contained in:
jingyang 2024-07-17 15:27:51 +08:00 committed by GitHub
parent 36f8755d09
commit 982325d066
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
75 changed files with 216 additions and 204 deletions

View File

@ -103,7 +103,7 @@ const DateRangePicker = ({
mr={2} mr={2}
onClick={() => setShowSelected(false)} onClick={() => setShowSelected(false)}
> >
{t('common.Close')} {t('common:common.Close')}
</Button> </Button>
<Button <Button
size={'sm'} size={'sm'}
@ -112,7 +112,7 @@ const DateRangePicker = ({
setShowSelected(false); setShowSelected(false);
}} }}
> >
{t('common.Confirm')} {t('common:common.Confirm')}
</Button> </Button>
</Flex> </Flex>
} }

View File

@ -13,7 +13,7 @@ const EmptyTip = ({ text, ...props }: Props) => {
<Flex mt={5} flexDirection={'column'} alignItems={'center'} py={'10vh'} {...props}> <Flex mt={5} flexDirection={'column'} alignItems={'center'} py={'10vh'} {...props}>
<MyIcon name="empty" w={'48px'} h={'48px'} color={'transparent'} /> <MyIcon name="empty" w={'48px'} h={'48px'} color={'transparent'} />
<Box mt={2} color={'myGray.500'} fontSize={'sm'}> <Box mt={2} color={'myGray.500'} fontSize={'sm'}>
{text || t('common.empty.Common Tip')} {text || t('common:common.empty.Common Tip')}
</Box> </Box>
</Flex> </Flex>
); );

View File

@ -41,10 +41,10 @@ const EditFolderModal = ({
() => () =>
isEdit isEdit
? { ? {
title: t('dataset.Edit Folder') title: t('common:dataset.Edit Folder')
} }
: { : {
title: t('dataset.Create Folder') title: t('common:dataset.Create Folder')
}, },
[isEdit, t] [isEdit, t]
); );
@ -67,7 +67,7 @@ const EditFolderModal = ({
<MyModal isOpen onClose={onClose} iconSrc="common/folderFill" title={typeMap.title}> <MyModal isOpen onClose={onClose} iconSrc="common/folderFill" title={typeMap.title}>
<ModalBody> <ModalBody>
<Box> <Box>
<FormLabel mb={1}>{t('common.Input name')}</FormLabel> <FormLabel mb={1}>{t('common:common.Input name')}</FormLabel>
<Input <Input
{...register('name', { required: true })} {...register('name', { required: true })}
bg={'myGray.50'} bg={'myGray.50'}
@ -76,13 +76,13 @@ const EditFolderModal = ({
/> />
</Box> </Box>
<Box mt={4}> <Box mt={4}>
<FormLabel mb={1}>{t('common.Input folder description')}</FormLabel> <FormLabel mb={1}>{t('common:common.Input folder description')}</FormLabel>
<Textarea {...register('intro')} bg={'myGray.50'} maxLength={200} /> <Textarea {...register('intro')} bg={'myGray.50'} maxLength={200} />
</Box> </Box>
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button isLoading={loading} onClick={handleSubmit(onSave)} px={6}> <Button isLoading={loading} onClick={handleSubmit(onSave)} px={6}>
{t('common.Confirm')} {t('common:common.Confirm')}
</Button> </Button>
</ModalFooter> </ModalFooter>
</MyModal> </MyModal>

View File

@ -82,11 +82,11 @@ const PopoverConfirm = ({
<HStack mt={1} justifyContent={'flex-end'}> <HStack mt={1} justifyContent={'flex-end'}>
{showCancel && ( {showCancel && (
<Button variant={'whiteBase'} size="sm" onClick={onClose}> <Button variant={'whiteBase'} size="sm" onClick={onClose}>
{t('common.Cancel')} {t('common:common.Cancel')}
</Button> </Button>
)} )}
<Button isLoading={loading} variant={map.variant} size="sm" onClick={onclickConfirm}> <Button isLoading={loading} variant={map.variant} size="sm" onClick={onclickConfirm}>
{t('common.Confirm')} {t('common:common.Confirm')}
</Button> </Button>
</HStack> </HStack>
</PopoverContent> </PopoverContent>

View File

@ -80,7 +80,11 @@ const MultipleRowSelect = ({
</Flex> </Flex>
))} ))}
{list.length === 0 && ( {list.length === 0 && (
<EmptyTip text={emptyTip ?? t('common.MultipleRowSelect.No data')} pt={1} pb={3} /> <EmptyTip
text={emptyTip ?? t('common:common.MultipleRowSelect.No data')}
pt={1}
pb={3}
/>
)} )}
</Box> </Box>
{children.length > 0 && <RenderList list={children} index={index + 1} />} {children.length > 0 && <RenderList list={children} index={index + 1} />}

View File

@ -96,13 +96,13 @@ const LeftRadio = ({
whiteSpace={'nowrap'} whiteSpace={'nowrap'}
fontSize={'sm'} fontSize={'sm'}
> >
{typeof item.title === 'string' ? t(item.title) : item.title} {typeof item.title === 'string' ? t(item.title as any) : item.title}
</Box> </Box>
{!!item.tooltip && <QuestionTip label={item.tooltip} ml={1} color={'myGray.600'} />}
</Flex> </Flex>
{!!item.tooltip && <QuestionTip label={item.tooltip} ml={1} color={'myGray.600'} />}
{!!item.desc && ( {!!item.desc && (
<Box fontSize={'xs'} color={'myGray.500'} lineHeight={1.2}> <Box fontSize={'xs'} color={'myGray.500'} lineHeight={1.2}>
{t(item.desc)} {t(item.desc as any)}
</Box> </Box>
)} )}
{item?.children} {item?.children}

View File

@ -88,7 +88,7 @@ const LightRowTabs = <ValueType = string,>({
)} )}
</> </>
)} )}
{typeof item.label === 'string' ? t(item.label) : item.label} {typeof item.label === 'string' ? t(item.label as any) : item.label}
</Flex> </Flex>
))} ))}
</Grid> </Grid>

View File

@ -17,7 +17,7 @@ const CodeEditor = (props: Props) => {
isOpen={isOpen} isOpen={isOpen}
onClose={onClose} onClose={onClose}
iconSrc="modal/edit" iconSrc="modal/edit"
title={t('Code editor')} title={t('common:Code editor')}
w={'full'} w={'full'}
> >
<ModalBody> <ModalBody>
@ -25,7 +25,7 @@ const CodeEditor = (props: Props) => {
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button mr={2} onClick={onClose} px={6}> <Button mr={2} onClick={onClose} px={6}>
{t('common.Confirm')} {t('common:common.Confirm')}
</Button> </Button>
</ModalFooter> </ModalFooter>
</MyModal> </MyModal>

View File

@ -178,7 +178,7 @@ const JSONEditor = ({
} catch (error) { } catch (error) {
toast({ toast({
status: 'warning', status: 'warning',
title: t('common.jsonEditor.Parse error') title: t('common:common.jsonEditor.Parse error')
}); });
} }
}, [value]); }, [value]);

View File

@ -79,7 +79,7 @@ const PromptEditor = ({
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button mr={2} onClick={onClose} px={6}> <Button mr={2} onClick={onClose} px={6}>
{t('common.Confirm')} {t('common:common.Confirm')}
</Button> </Button>
</ModalFooter> </ModalFooter>
</MyModal> </MyModal>

View File

@ -20,7 +20,7 @@ const NodeInputSelect = ({
}) => { }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { openConfirm, ConfirmModal } = useConfirm({ const { openConfirm, ConfirmModal } = useConfirm({
title: t('core.workflow.Change input type tip') title: t('common:core.workflow.Change input type tip')
}); });
const renderType = renderTypeList[renderTypeIndex]; const renderType = renderTypeList[renderTypeIndex];
const theme = useTheme(); const theme = useTheme();
@ -29,90 +29,90 @@ const NodeInputSelect = ({
{ {
type: FlowNodeInputTypeEnum.reference, type: FlowNodeInputTypeEnum.reference,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.reference].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.reference].icon,
title: t('core.workflow.inputType.Reference') title: t('common:core.workflow.inputType.Reference')
}, },
{ {
type: FlowNodeInputTypeEnum.input, type: FlowNodeInputTypeEnum.input,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.input].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.input].icon,
title: t('core.workflow.inputType.Manual input') title: t('common:core.workflow.inputType.Manual input')
}, },
{ {
type: FlowNodeInputTypeEnum.numberInput, type: FlowNodeInputTypeEnum.numberInput,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.numberInput].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.numberInput].icon,
title: t('core.workflow.inputType.Manual input') title: t('common:core.workflow.inputType.Manual input')
}, },
{ {
type: FlowNodeInputTypeEnum.switch, type: FlowNodeInputTypeEnum.switch,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.switch].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.switch].icon,
title: t('core.workflow.inputType.Manual select') title: t('common:core.workflow.inputType.Manual select')
}, },
{ {
type: FlowNodeInputTypeEnum.textarea, type: FlowNodeInputTypeEnum.textarea,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.textarea].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.textarea].icon,
title: t('core.workflow.inputType.Manual input') title: t('common:core.workflow.inputType.Manual input')
}, },
{ {
type: FlowNodeInputTypeEnum.JSONEditor, type: FlowNodeInputTypeEnum.JSONEditor,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.JSONEditor].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.JSONEditor].icon,
title: t('core.workflow.inputType.Manual input') title: t('common:core.workflow.inputType.Manual input')
}, },
{ {
type: FlowNodeInputTypeEnum.addInputParam, type: FlowNodeInputTypeEnum.addInputParam,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.addInputParam].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.addInputParam].icon,
title: t('core.workflow.inputType.dynamicTargetInput') title: t('common:core.workflow.inputType.dynamicTargetInput')
}, },
{ {
type: FlowNodeInputTypeEnum.selectApp, type: FlowNodeInputTypeEnum.selectApp,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.selectApp].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.selectApp].icon,
title: t('core.workflow.inputType.Manual select') title: t('common:core.workflow.inputType.Manual select')
}, },
{ {
type: FlowNodeInputTypeEnum.selectLLMModel, type: FlowNodeInputTypeEnum.selectLLMModel,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.selectLLMModel].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.selectLLMModel].icon,
title: t('core.workflow.inputType.Manual select') title: t('common:core.workflow.inputType.Manual select')
}, },
{ {
type: FlowNodeInputTypeEnum.settingLLMModel, type: FlowNodeInputTypeEnum.settingLLMModel,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.settingLLMModel].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.settingLLMModel].icon,
title: t('core.workflow.inputType.Manual select') title: t('common:core.workflow.inputType.Manual select')
}, },
{ {
type: FlowNodeInputTypeEnum.selectDataset, type: FlowNodeInputTypeEnum.selectDataset,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.selectDataset].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.selectDataset].icon,
title: t('core.workflow.inputType.Manual select') title: t('common:core.workflow.inputType.Manual select')
}, },
{ {
type: FlowNodeInputTypeEnum.selectDatasetParamsModal, type: FlowNodeInputTypeEnum.selectDatasetParamsModal,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.selectDatasetParamsModal].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.selectDatasetParamsModal].icon,
title: t('core.workflow.inputType.Manual select') title: t('common:core.workflow.inputType.Manual select')
}, },
{ {
type: FlowNodeInputTypeEnum.settingDatasetQuotePrompt, type: FlowNodeInputTypeEnum.settingDatasetQuotePrompt,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.settingDatasetQuotePrompt].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.settingDatasetQuotePrompt].icon,
title: t('core.workflow.inputType.Manual input') title: t('common:core.workflow.inputType.Manual input')
}, },
{ {
type: FlowNodeInputTypeEnum.hidden, type: FlowNodeInputTypeEnum.hidden,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.hidden].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.hidden].icon,
title: t('core.workflow.inputType.Manual input') title: t('common:core.workflow.inputType.Manual input')
}, },
{ {
type: FlowNodeInputTypeEnum.custom, type: FlowNodeInputTypeEnum.custom,
icon: FlowNodeInputMap[FlowNodeInputTypeEnum.custom].icon, icon: FlowNodeInputMap[FlowNodeInputTypeEnum.custom].icon,
title: t('core.workflow.inputType.Manual input') title: t('common:core.workflow.inputType.Manual input')
} }
]); ]);

View File

@ -5,22 +5,22 @@ import { TFunction } from 'next-i18next';
export const workflowNodeTemplateList = (t: TFunction): NodeTemplateListType => [ export const workflowNodeTemplateList = (t: TFunction): NodeTemplateListType => [
{ {
type: FlowNodeTemplateTypeEnum.systemInput, type: FlowNodeTemplateTypeEnum.systemInput,
label: t('core.module.template.System input module'), label: t('common:core.module.template.System input module'),
list: [] list: []
}, },
{ {
type: FlowNodeTemplateTypeEnum.ai, type: FlowNodeTemplateTypeEnum.ai,
label: t('core.module.template.AI function'), label: t('common:core.module.template.AI function'),
list: [] list: []
}, },
{ {
type: FlowNodeTemplateTypeEnum.tools, type: FlowNodeTemplateTypeEnum.tools,
label: t('core.module.template.Tool module'), label: t('common:core.module.template.Tool module'),
list: [] list: []
}, },
{ {
type: FlowNodeTemplateTypeEnum.other, type: FlowNodeTemplateTypeEnum.other,
label: t('common.Other'), label: t('common:common.Other'),
list: [] list: []
}, },
{ {

View File

@ -4,7 +4,7 @@ import { useEffect } from 'react';
export const useBeforeunload = (props?: { callback?: () => any; tip?: string }) => { export const useBeforeunload = (props?: { callback?: () => any; tip?: string }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { tip = t('common.Confirm to leave the page'), callback } = props || {}; const { tip = t('common:common.Confirm to leave the page'), callback } = props || {};
useEffect(() => { useEffect(() => {
const listen = const listen =

View File

@ -16,12 +16,12 @@ export const useConfirm = (props?: {
const map = useMemo(() => { const map = useMemo(() => {
const map = { const map = {
common: { common: {
title: t('common.confirm.Common Tip'), title: t('common:common.confirm.Common Tip'),
variant: 'primary', variant: 'primary',
iconSrc: 'common/confirm/commonTip' iconSrc: 'common/confirm/commonTip'
}, },
delete: { delete: {
title: t('common.Delete Warning'), title: t('common:common.Delete Warning'),
variant: 'dangerFill', variant: 'dangerFill',
iconSrc: 'common/confirm/deleteTip' iconSrc: 'common/confirm/deleteTip'
} }
@ -31,7 +31,7 @@ export const useConfirm = (props?: {
}, [props?.type, t]); }, [props?.type, t]);
const { const {
title = map?.title || t('Warning'), title = map?.title || t('common:Warning'),
iconSrc = map?.iconSrc, iconSrc = map?.iconSrc,
content, content,
showCancel = true, showCancel = true,
@ -58,8 +58,8 @@ export const useConfirm = (props?: {
const ConfirmModal = useCallback( const ConfirmModal = useCallback(
({ ({
closeText = t('common.Cancel'), closeText = t('common:common.Cancel'),
confirmText = t('common.Confirm'), confirmText = t('common:common.Confirm'),
isLoading, isLoading,
bg, bg,
countDown = 0 countDown = 0

View File

@ -85,7 +85,7 @@ export const useEditTextarea = ({
({ ({
maxLength = 30, maxLength = 30,
iconSrc = 'modal/edit', iconSrc = 'modal/edit',
closeBtnText = t('common.Close') closeBtnText = t('common:common.Close')
}: { }: {
maxLength?: number; maxLength?: number;
iconSrc?: string; iconSrc?: string;
@ -116,7 +116,7 @@ export const useEditTextarea = ({
</Button> </Button>
)} )}
<Button onClick={onclickConfirm} px={6}> <Button onClick={onclickConfirm} px={6}>
{t('common.Confirm')} {t('common:common.Confirm')}
</Button> </Button>
</ModalFooter> </ModalFooter>
</MyModal> </MyModal>

View File

@ -27,7 +27,7 @@ export const useRequest = ({ successToast, errorToast, onSuccess, onError, ...pr
onError?.(err, variables, context); onError?.(err, variables, context);
if (errorToast !== undefined) { if (errorToast !== undefined) {
const errText = t(getErrText(err, errorToast || '')); const errText = t(getErrText(err, errorToast || '') as any);
if (errText) { if (errText) {
toast({ toast({
title: errText, title: errText,
@ -64,7 +64,7 @@ export const useRequest2 = <TData, TParams extends any[]>(
onError: (err, params) => { onError: (err, params) => {
rest?.onError?.(err, params); rest?.onError?.(err, params);
if (errorToast !== undefined) { if (errorToast !== undefined) {
const errText = t(getErrText(err, errorToast || '')); const errText = t(getErrText(err, errorToast || '') as any);
if (errText) { if (errText) {
toast({ toast({
title: errText, title: errText,

View File

@ -116,7 +116,7 @@ export function useScrollPagination<
<Box ref={wrapperRef}>{children}</Box> <Box ref={wrapperRef}>{children}</Box>
{noMore.current && list.length > 0 && ( {noMore.current && list.length > 0 && (
<Box py={4} textAlign={'center'} color={'myGray.600'} fontSize={'xs'}> <Box py={4} textAlign={'center'} color={'myGray.600'} fontSize={'xs'}>
{t('common.No more data')} {t('common:common.No more data')}
</Box> </Box>
)} )}
{list.length === 0 && !isLoading && EmptyChildren && <>{EmptyChildren}</>} {list.length === 0 && !isLoading && EmptyChildren && <>{EmptyChildren}</>}

View File

@ -82,8 +82,7 @@
"No data": "No data available" "No data": "No data available"
}, },
"Name": "Name", "Name": "Name",
"Name Can": "Name cannot be empty", "name_is_empty": "Name cannot be empty",
"Name is empty": "Name cannot be empty",
"Next Step": "Next Step", "Next Step": "Next Step",
"No more data": "No more data~", "No more data": "No more data~",
"Not open": "Not open", "Not open": "Not open",
@ -864,6 +863,7 @@
"http": { "http": {
"Add props": "Add parameters", "Add props": "Add parameters",
"AppId": "Application ID", "AppId": "Application ID",
"AppSecret": "AppSecret",
"ChatId": "Current chat ID", "ChatId": "Current chat ID",
"Current time": "Current time", "Current time": "Current time",
"Histories": "Last 10 chat records", "Histories": "Last 10 chat records",
@ -1294,6 +1294,8 @@
"path": "Path", "path": "Path",
"update params": "Update parameters" "update params": "Update parameters"
}, },
"select_reference_variable": "Select Reference Variable",
"share_link": "Share Link",
"support": { "support": {
"account": { "account": {
"Individuation": "Personalization" "Individuation": "Personalization"
@ -1519,10 +1521,13 @@
} }
} }
}, },
"sync_link": "Sync Link",
"system": { "system": {
"Concat us": "Concat", "Concat us": "Concat",
"Help Document": "Help document" "Help Document": "Help document"
}, },
"tag_list": "Tag List",
"team_tag": "Team Tag",
"template": { "template": {
"Quote Content Tip": "You can customize the structure of the quote content to better adapt to different scenarios. You can use some variables for template configuration:\n{{q}} - search content, {{a}} - expected content, {{source}} - source, {{sourceId}} - source file name, {{index}} - the nth quote, they are all optional, here are the default values:\n{{default}}", "Quote Content Tip": "You can customize the structure of the quote content to better adapt to different scenarios. You can use some variables for template configuration:\n{{q}} - search content, {{a}} - expected content, {{source}} - source, {{sourceId}} - source file name, {{index}} - the nth quote, they are all optional, here are the default values:\n{{default}}",
"Quote Prompt Tip": "You can use {{quote}} to insert the quote content template, and use {{question}} to insert the question. Here are the default values:\n{{default}}" "Quote Prompt Tip": "You can use {{quote}} to insert the quote content template, and use {{question}} to insert the question. Here are the default values:\n{{default}}"

View File

@ -82,8 +82,7 @@
"No data": "没有可选值" "No data": "没有可选值"
}, },
"Name": "名称", "Name": "名称",
"Name Can": "名称不能为空", "name_is_empty": "名称不能为空",
"Name is empty": "名称不能为空",
"Next Step": "下一步", "Next Step": "下一步",
"No more data": "没有更多了~", "No more data": "没有更多了~",
"Not open": "未开启", "Not open": "未开启",
@ -873,6 +872,7 @@
"http": { "http": {
"Add props": "添加参数", "Add props": "添加参数",
"AppId": "应用 ID", "AppId": "应用 ID",
"AppSecret": "AppSecret",
"ChatId": "当前对话 ID", "ChatId": "当前对话 ID",
"Current time": "当前时间", "Current time": "当前时间",
"Histories": "最近 10 条聊天记录", "Histories": "最近 10 条聊天记录",
@ -1303,6 +1303,8 @@
"path": "", "path": "",
"update params": "更新参数" "update params": "更新参数"
}, },
"select_reference_variable": "选择引用变量",
"share_link": "分享链接",
"support": { "support": {
"account": { "account": {
"Individuation": "个性化" "Individuation": "个性化"
@ -1528,10 +1530,13 @@
} }
} }
}, },
"sync_link": "同步链接",
"system": { "system": {
"Concat us": "联系我们", "Concat us": "联系我们",
"Help Document": "帮助文档" "Help Document": "帮助文档"
}, },
"tag_list": "标签列表",
"team_tag": "团队标签",
"template": { "template": {
"Quote Content Tip": "可以自定义引用内容的结构,以更好的适配不同场景。可以使用一些变量来进行模板配置:\n{{q}} - 检索内容,{{a}} - 预期内容,{{source}} - 来源,{{sourceId}} - 来源文件名,{{index}} - 第 n 个引用,他们都是可选的,下面是默认值:\n{{default}}", "Quote Content Tip": "可以自定义引用内容的结构,以更好的适配不同场景。可以使用一些变量来进行模板配置:\n{{q}} - 检索内容,{{a}} - 预期内容,{{source}} - 来源,{{sourceId}} - 来源文件名,{{index}} - 第 n 个引用,他们都是可选的,下面是默认值:\n{{default}}",
"Quote Prompt Tip": "可以用 {{quote}} 来插入引用内容模板,使用 {{question}} 来插入问题。下面是默认值:\n{{default}}" "Quote Prompt Tip": "可以用 {{quote}} 来插入引用内容模板,使用 {{question}} 来插入问题。下面是默认值:\n{{default}}"

38
packages/web/types/i18next.d.ts vendored Normal file
View File

@ -0,0 +1,38 @@
import 'i18next';
import common from '../i18n/zh/common.json';
import dataset from '../i18n/zh/dataset.json';
import app from '../i18n/zh/app.json';
import file from '../i18n/zh/file.json';
import publish from '../i18n/zh/publish.json';
import workflow from '../i18n/zh/workflow.json';
import user from '../i18n/zh/user.json';
import chat from '../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)[];
export type I18nCommonKey = keyof I18nNamespaces['common'];
export type I18nDataSetKey = keyof I18nNamespaces['dataset'];
export type I18nAppKey = keyof I18nNamespaces['app'];
export type I18nPublishKey = keyof I18nNamespaces['publish'];
export type I18nWorkflowKey = keyof I18nNamespaces['workflow'];
export type I18nUserKey = keyof I18nNamespaces['user'];
export type I18nChatKey = keyof I18nNamespaces['chat'];
declare module 'i18next' {
interface CustomTypeOptions {
returnNull: false;
defaultNS: ['common', 'dataset', 'app', 'file', 'publish', 'workflow', 'user', 'chat'];
resources: I18nNamespaces;
}
}

View File

@ -83,11 +83,11 @@ const MyRadio = ({
)} )}
<Box pr={hiddenCircle ? 0 : 2} flex={'1 0 0'}> <Box pr={hiddenCircle ? 0 : 2} flex={'1 0 0'}>
<Box fontSize={'sm'} color={'myGray.800'}> <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> </Box>
{!!item.desc && ( {!!item.desc && (
<Box fontSize={'mini'} color={'myGray.500'} lineHeight={1.2}> <Box fontSize={'mini'} color={'myGray.500'} lineHeight={1.2}>
{t(item.desc)} {t(item.desc as any)}
</Box> </Box>
)} )}
</Box> </Box>

View File

@ -52,7 +52,7 @@ const VariableEdit = ({
const VariableTypeList = useMemo( const VariableTypeList = useMemo(
() => () =>
Object.entries(variableMap).map(([key, value]) => ({ Object.entries(variableMap).map(([key, value]) => ({
title: t(value.title), title: t(value.title as any),
icon: value.icon, icon: value.icon,
value: key value: key
})), })),
@ -219,7 +219,7 @@ const VariableEdit = ({
{/* desc */} {/* desc */}
{variableMap[variableType]?.desc && ( {variableMap[variableType]?.desc && (
<Box mt={2} fontSize={'sm'} color={'myGray.500'} whiteSpace={'pre-wrap'}> <Box mt={2} fontSize={'sm'} color={'myGray.500'} whiteSpace={'pre-wrap'}>
{t(variableMap[variableType].desc)} {t(variableMap[variableType].desc as any)}
</Box> </Box>
)} )}

View File

@ -510,7 +510,7 @@ const ChatBox = (
autoTTSResponse && splitText2Audio(responseText, true); autoTTSResponse && splitText2Audio(responseText, true);
} catch (err: any) { } catch (err: any) {
toast({ toast({
title: t(getErrText(err, 'core.chat.error.Chat error')), title: t(getErrText(err, 'core.chat.error.Chat error') as any),
status: 'error', status: 'error',
duration: 5000, duration: 5000,
isClosable: true isClosable: true
@ -814,7 +814,7 @@ const ChatBox = (
return { return {
status: chatContent.status || 'loading', 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]); }, [chatHistories, isChatting, t]);

View File

@ -50,7 +50,7 @@ const RenderPluginInput = ({
value={value} value={value}
onChange={onChange} onChange={onChange}
isDisabled={isDisabled} isDisabled={isDisabled}
placeholder={t(placeholder)} placeholder={t(placeholder as any)}
bg={'myGray.50'} bg={'myGray.50'}
isInvalid={isInvalid} isInvalid={isInvalid}
/> />
@ -88,7 +88,7 @@ const RenderPluginInput = ({
return ( return (
<JsonEditor <JsonEditor
bg={'myGray.50'} bg={'myGray.50'}
placeholder={t(placeholder || '')} placeholder={t(placeholder || ('' as any))}
resize resize
value={value} value={value}
onChange={onChange} onChange={onChange}

View File

@ -136,7 +136,7 @@ export const ResponseBox = React.memo(function ResponseBox({
alt={''} alt={''}
w={['14px', '16px']} w={['14px', '16px']}
/> />
{t(item.moduleName)} {t(item.moduleName as any)}
</Flex> </Flex>
), ),
value: `${i}` value: `${i}`
@ -177,7 +177,7 @@ export const ResponseBox = React.memo(function ResponseBox({
<> <>
<Row <Row
label={t('common:core.chat.response.module name')} label={t('common:core.chat.response.module name')}
value={t(activeModule.moduleName)} value={t(activeModule.moduleName as any)}
/> />
{activeModule?.totalPoints !== undefined && ( {activeModule?.totalPoints !== undefined && (
<Row <Row

View File

@ -112,7 +112,7 @@ const QuoteItem = ({
{score?.primaryScore && ( {score?.primaryScore && (
<> <>
{canViewSource ? ( {canViewSource ? (
<MyTooltip label={t(SearchScoreTypeMap[score.primaryScore.type]?.desc)}> <MyTooltip label={t(SearchScoreTypeMap[score.primaryScore.type]?.desc as any)}>
<Flex <Flex
px={'12px'} px={'12px'}
py={'5px'} py={'5px'}
@ -132,7 +132,7 @@ const QuoteItem = ({
mx={2} mx={2}
/> />
<Box> <Box>
{t(SearchScoreTypeMap[score.primaryScore.type]?.label)} {t(SearchScoreTypeMap[score.primaryScore.type]?.label as any)}
{SearchScoreTypeMap[score.primaryScore.type]?.showScore {SearchScoreTypeMap[score.primaryScore.type]?.showScore
? ` ${score.primaryScore.value.toFixed(4)}` ? ` ${score.primaryScore.value.toFixed(4)}`
: ''} : ''}
@ -159,7 +159,7 @@ const QuoteItem = ({
)} )}
{canViewSource && {canViewSource &&
score.secondaryScore.map((item, i) => ( 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'}> <Box fontSize={'xs'}>
<Flex alignItems={'flex-start'} lineHeight={1.2} mb={1}> <Flex alignItems={'flex-start'} lineHeight={1.2} mb={1}>
<Box <Box
@ -172,7 +172,7 @@ const QuoteItem = ({
<Box transform={'scale(0.9)'}>#{item.index + 1}</Box> <Box transform={'scale(0.9)'}>#{item.index + 1}</Box>
</Box> </Box>
<Box transform={'scale(0.9)'}> <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> </Box>
</Flex> </Flex>
<Box h={'4px'}> <Box h={'4px'}>

View File

@ -68,7 +68,7 @@ const SearchParamsTip = ({
w={'12px'} w={'12px'}
mr={'1px'} mr={'1px'}
/> />
{t(DatasetSearchModeMap[searchMode]?.title)} {t(DatasetSearchModeMap[searchMode]?.title as any)}
</Flex> </Flex>
</Td> </Td>
<Td pt={0} pb={2}> <Td pt={0} pb={2}>

View File

@ -343,7 +343,7 @@ function EditKeyModal({
placeholder={publishT('key alias') || 'key alias'} placeholder={publishT('key alias') || 'key alias'}
maxLength={20} maxLength={20}
{...register('name', { {...register('name', {
required: t('common:common.Name is empty') || 'Name is empty' required: t('common:common.name_is_empty') || 'name_is_empty'
})} })}
/> />
</Flex> </Flex>

View File

@ -34,7 +34,7 @@ const PermissionIconText = ({
return PermissionTypeMap[per] ? ( return PermissionTypeMap[per] ? (
<HStack spacing={1} fontSize={fontSize} {...props}> <HStack spacing={1} fontSize={fontSize} {...props}>
<MyIcon name={PermissionTypeMap[per]?.iconLight as any} w={w} color={iconColor} /> <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> </HStack>
) : null; ) : null;
}; };

View File

@ -189,7 +189,7 @@ function PermissionSelect({
<Box ml={4}> <Box ml={4}>
<Box>{item.name}</Box> <Box>{item.name}</Box>
<Box color={'myGray.500'} fontSize={'mini'}> <Box color={'myGray.500'} fontSize={'mini'}>
{t(item.description)} {t(item.description as any)}
</Box> </Box>
</Box> </Box>
</Flex> </Flex>

View File

@ -68,7 +68,7 @@ function MemberTable() {
/> />
</Td> </Td>
<Td color={TeamMemberStatusMap[item.status].color}> <Td color={TeamMemberStatusMap[item.status].color}>
{t(TeamMemberStatusMap[item.status]?.label || '')} {t(TeamMemberStatusMap[item.status]?.label || ('' as any))}
</Td> </Td>
<Td> <Td>
{userInfo?.team.permission.hasManagePer && {userInfo?.team.permission.hasManagePer &&

View File

@ -103,7 +103,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
<ModalBody style={{ padding: '10rpx' }}> <ModalBody style={{ padding: '10rpx' }}>
<Flex mt={3} alignItems={'center'}> <Flex mt={3} alignItems={'center'}>
<Box mb={2} fontWeight="semibold"> <Box mb={2} fontWeight="semibold">
{t('common:同步链接')} {t('common:sync_link')}
</Box> </Box>
<Input <Input
flex={1} flex={1}
@ -118,7 +118,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
</Flex> </Flex>
<Flex mt={3} alignItems={'center'}> <Flex mt={3} alignItems={'center'}>
<Box mb={2} fontWeight="semibold"> <Box mb={2} fontWeight="semibold">
{t('common:分享链接')} {t('common:share_link')}
</Box> </Box>
{/* code */} {/* code */}
<Box ml={4} borderRadius={'md'} overflow={'hidden'}> <Box ml={4} borderRadius={'md'} overflow={'hidden'}>
@ -143,7 +143,7 @@ const TeamTagsAsync = ({ onClose }: { onClose: () => void }) => {
</Flex> </Flex>
<Flex mt={3} alignItems={'center'}> <Flex mt={3} alignItems={'center'}>
<Box mb={2} fontWeight="semibold"> <Box mb={2} fontWeight="semibold">
{t('common:标签列表')} {t('common:tag_list')}
</Box> </Box>
<HStack <HStack
ml={4} ml={4}

View File

@ -45,7 +45,7 @@ const BillTable = () => {
[ [
{ label: t('common:common.All'), value: '' }, { label: t('common:common.All'), value: '' },
...Object.entries(billTypeMap).map(([key, value]) => ({ ...Object.entries(billTypeMap).map(([key, value]) => ({
label: t(value.label), label: t(value.label as any),
value: key value: key
})) }))
] as { ] as {
@ -130,12 +130,12 @@ const BillTable = () => {
{bills.map((item, i) => ( {bills.map((item, i) => (
<Tr key={item._id}> <Tr key={item._id}>
<Td>{i + 1}</Td> <Td>{i + 1}</Td>
<Td>{t(billTypeMap[item.type]?.label)}</Td> <Td>{t(billTypeMap[item.type]?.label as any)}</Td>
<Td> <Td>
{item.createTime ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') : '-'} {item.createTime ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') : '-'}
</Td> </Td>
<Td>{formatStorePrice2Read(item.price)}</Td> <Td>{formatStorePrice2Read(item.price)}</Td>
<Td>{t(billStatusMap[item.status]?.label)}</Td> <Td>{t(billStatusMap[item.status]?.label as any)}</Td>
<Td> <Td>
{item.status === 'NOTPAY' && ( {item.status === 'NOTPAY' && (
<Button mr={4} onClick={() => handleRefreshPayOrder(item._id)} size={'sm'}> <Button mr={4} onClick={() => handleRefreshPayOrder(item._id)} size={'sm'}>
@ -201,12 +201,12 @@ function BillDetailModal({ bill, onClose }: { bill: BillSchemaType; onClose: ()
</Flex> </Flex>
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
<FormLabel flex={'0 0 120px'}>{t('common:support.wallet.bill.Status')}:</FormLabel> <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> </Flex>
{!!bill.metadata?.payWay && ( {!!bill.metadata?.payWay && (
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
<FormLabel flex={'0 0 120px'}>{t('common:support.wallet.bill.payWay.Way')}:</FormLabel> <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>
)} )}
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
@ -215,14 +215,14 @@ function BillDetailModal({ bill, onClose }: { bill: BillSchemaType; onClose: ()
</Flex> </Flex>
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
<FormLabel flex={'0 0 120px'}>{t('common:support.wallet.bill.Type')}:</FormLabel> <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> </Flex>
{!!bill.metadata?.subMode && ( {!!bill.metadata?.subMode && (
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
<FormLabel flex={'0 0 120px'}> <FormLabel flex={'0 0 120px'}>
{t('common:support.wallet.subscription.mode.Period')}: {t('common:support.wallet.subscription.mode.Period')}:
</FormLabel> </FormLabel>
<Box>{t(subModeMap[bill.metadata.subMode]?.label)}</Box> <Box>{t(subModeMap[bill.metadata.subMode]?.label as any)}</Box>
</Flex> </Flex>
)} )}
{!!bill.metadata?.standSubLevel && ( {!!bill.metadata?.standSubLevel && (
@ -230,7 +230,7 @@ function BillDetailModal({ bill, onClose }: { bill: BillSchemaType; onClose: ()
<FormLabel flex={'0 0 120px'}> <FormLabel flex={'0 0 120px'}>
{t('common:support.wallet.subscription.Stand plan level')}: {t('common:support.wallet.subscription.Stand plan level')}:
</FormLabel> </FormLabel>
<Box>{t(standardSubLevelMap[bill.metadata.standSubLevel]?.label)}</Box> <Box>{t(standardSubLevelMap[bill.metadata.standSubLevel]?.label as any)}</Box>
</Flex> </Flex>
)} )}
{bill.metadata?.month !== undefined && ( {bill.metadata?.month !== undefined && (

View File

@ -404,7 +404,7 @@ const PlanUsage = () => {
{t('common:support.wallet.subscription.Current plan')} {t('common:support.wallet.subscription.Current plan')}
</Box> </Box>
<Box fontWeight={'bold'} fontSize="lg"> <Box fontWeight={'bold'} fontSize="lg">
{t(planName)} {t(planName as any)}
</Box> </Box>
{isFreeTeam ? ( {isFreeTeam ? (

View File

@ -77,11 +77,11 @@ const UsageDetail = ({ usage, onClose }: { usage: UsageItemType; onClose: () =>
</Flex> </Flex>
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
<FormLabel flex={'0 0 80px'}>{t('common:support.wallet.usage.App name')}:</FormLabel> <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>
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
<FormLabel flex={'0 0 80px'}>{t('common:support.wallet.usage.Source')}:</FormLabel> <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>
<Flex alignItems={'center'} pb={4}> <Flex alignItems={'center'} pb={4}>
<FormLabel flex={'0 0 80px'}>{t('common:support.wallet.usage.Total points')}:</FormLabel> <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> <Tbody>
{filterBillList.map((item, i) => ( {filterBillList.map((item, i) => (
<Tr key={i}> <Tr key={i}>
<Td>{t(item.moduleName)}</Td> <Td>{t(item.moduleName as any)}</Td>
{hasModel && <Td>{item.model ?? '-'}</Td>} {hasModel && <Td>{item.model ?? '-'}</Td>}
{hasToken && <Td>{item.tokens ?? '-'}</Td>} {hasToken && <Td>{item.tokens ?? '-'}</Td>}
{hasCharsLen && <Td>{item.charsLength ?? '-'}</Td>} {hasCharsLen && <Td>{item.charsLength ?? '-'}</Td>}

View File

@ -51,7 +51,7 @@ const UsageTable = () => {
[ [
{ label: t('common:common.All'), value: '' }, { label: t('common:common.All'), value: '' },
...Object.entries(UsageSourceMap).map(([key, value]) => ({ ...Object.entries(UsageSourceMap).map(([key, value]) => ({
label: t(value.label), label: t(value.label as any),
value: key value: key
})) }))
] as { ] as {
@ -169,8 +169,8 @@ const UsageTable = () => {
<Tr key={item.id}> <Tr key={item.id}>
{/* <Td>{item.memberName}</Td> */} {/* <Td>{item.memberName}</Td> */}
<Td>{dayjs(item.time).format('YYYY/MM/DD HH:mm:ss')}</Td> <Td>{dayjs(item.time).format('YYYY/MM/DD HH:mm:ss')}</Td>
<Td>{t(UsageSourceMap[item.source]?.label) || '-'}</Td> <Td>{t(UsageSourceMap[item.source]?.label as any) || '-'}</Td>
<Td>{t(item.appName) || '-'}</Td> <Td>{t(item.appName as any) || '-'}</Td>
<Td>{formatNumber(item.totalPoints) || 0}</Td> <Td>{formatNumber(item.totalPoints) || 0}</Td>
<Td> <Td>
<Button size={'sm'} variant={'whitePrimary'} onClick={() => setUsageDetail(item)}> <Button size={'sm'} variant={'whitePrimary'} onClick={() => setUsageDetail(item)}>

View File

@ -73,8 +73,9 @@ const StandDetailModal = ({ onClose }: { onClose: () => void }) => {
w={'20px'} w={'20px'}
color={'myGray.800'} color={'myGray.800'}
/> />
{t(subTypeMap[type]?.label)} {t(subTypeMap[type]?.label as any)}
{currentSubLevel && `(${t(standardSubLevelMap[currentSubLevel]?.label)})`} {currentSubLevel &&
`(${t(standardSubLevelMap[currentSubLevel]?.label as any)})`}
</Td> </Td>
<Td>{datasetSize ? `${datasetSize}` : '-'}</Td> <Td>{datasetSize ? `${datasetSize}` : '-'}</Td>
<Td> <Td>

View File

@ -126,7 +126,7 @@ const Logs = () => {
onClick={() => setDetailLogsId(item.id)} onClick={() => setDetailLogsId(item.id)}
> >
<Td> <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> <Box color={'myGray.500'}>{dayjs(item.time).format('YYYY/MM/DD HH:mm')}</Box>
</Td> </Td>
<Td className="textEllipsis" maxW={'250px'}> <Td className="textEllipsis" maxW={'250px'}>

View File

@ -69,7 +69,7 @@ const FeiShuEditModal = ({
placeholder={publishT('Feishu name') || 'Link Name'} // TODO: i18n placeholder={publishT('Feishu name') || 'Link Name'} // TODO: i18n
maxLength={20} maxLength={20}
{...register('name', { {...register('name', {
required: t('common:common.Name is empty') || 'Name is empty' required: t('common:common.name_is_empty') || 'name_is_empty'
})} })}
/> />
</Flex> </Flex>
@ -150,7 +150,7 @@ const FeiShuEditModal = ({
<Flex alignItems={'center'} mt={4}> <Flex alignItems={'center'} mt={4}>
<Box flex={'0 0 90px'}>{t('common:core.module.http.AppId')}</Box> <Box flex={'0 0 90px'}>{t('common:core.module.http.AppId')}</Box>
<Input <Input
placeholder={t('common:core.module.http.appId') || 'Link Name'} placeholder={t('common:core.module.http.AppId') || 'Link Name'}
// maxLength={20} // maxLength={20}
{...register('app.appId', { {...register('app.appId', {
required: true required: true
@ -158,12 +158,12 @@ const FeiShuEditModal = ({
/> />
</Flex> </Flex>
<Flex alignItems={'center'} mt={4}> <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 <Input
placeholder={'App Secret'} placeholder={'App Secret'}
// maxLength={20} // maxLength={20}
{...register('app.appSecret', { {...register('app.appSecret', {
required: t('common:common.Name is empty') || 'Name is empty' required: t('common:common.name_is_empty') || 'name_is_empty'
})} })}
/> />
</Flex> </Flex>
@ -173,7 +173,7 @@ const FeiShuEditModal = ({
placeholder="Encrypt Key" placeholder="Encrypt Key"
// maxLength={20} // maxLength={20}
{...register('app.encryptKey', { {...register('app.encryptKey', {
required: t('common:common.Name is empty') || 'Name is empty' required: t('common:common.name_is_empty') || 'name_is_empty'
})} })}
/> />
</Flex> </Flex>
@ -183,7 +183,7 @@ const FeiShuEditModal = ({
placeholder="Verification Token" placeholder="Verification Token"
// maxLength={20} // maxLength={20}
{...register('app.verificationToken', { {...register('app.verificationToken', {
required: t('common:common.Name is empty') || 'Name is empty' required: t('common:common.name_is_empty') || 'name_is_empty'
})} })}
/> />
</Flex> </Flex>

View File

@ -108,7 +108,7 @@ const FeiShu = ({ appId }: { appId: string }) => {
)} )}
<Td> <Td>
{item.lastTime {item.lastTime
? t(formatTimeToChatTime(item.lastTime)) ? t(formatTimeToChatTime(item.lastTime) as any)
: t('common:common.Un used')} : t('common:common.Un used')}
</Td> </Td>
<Td display={'flex'} alignItems={'center'}> <Td display={'flex'} alignItems={'center'}>

View File

@ -308,7 +308,7 @@ function EditLinkModal({
placeholder={publishT('Link Name')} placeholder={publishT('Link Name')}
maxLength={20} maxLength={20}
{...register('name', { {...register('name', {
required: t('common:common.Name is empty') || 'Name is empty' required: t('common:common.name_is_empty') || 'name_is_empty'
})} })}
/> />
</Flex> </Flex>

View File

@ -214,10 +214,10 @@ const RenderList = React.memo(function RenderList({
borderRadius={'0'} borderRadius={'0'}
/> />
<Box ml={5} flex={'1 0 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 && ( {item.intro && (
<Box className="textEllipsis3" color={'myGray.500'} fontSize={'xs'}> <Box className="textEllipsis3" color={'myGray.500'} fontSize={'xs'}>
{t(item.intro)} {t(item.intro as any)}
</Box> </Box>
)} )}
</Box> </Box>
@ -264,7 +264,7 @@ const RenderList = React.memo(function RenderList({
return ( return (
<Box key={input.key} _notLast={{ mb: 4 }} px={1}> <Box key={input.key} _notLast={{ mb: 4 }} px={1}>
<Flex position={'relative'} mb={1} alignItems={'center'}> <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} />} {input.description && <QuestionTip label={input.description} ml={1} />}
</Flex> </Flex>
{(() => { {(() => {
@ -274,7 +274,7 @@ const RenderList = React.memo(function RenderList({
{...register(input.key, { {...register(input.key, {
required required
})} })}
placeholder={t(input.placeholder || '')} placeholder={t(input.placeholder || ('' as any))}
bg={'myGray.50'} bg={'myGray.50'}
/> />
); );
@ -308,7 +308,7 @@ const RenderList = React.memo(function RenderList({
return ( return (
<JsonEditor <JsonEditor
bg={'myGray.50'} bg={'myGray.50'}
placeholder={t(input.placeholder || '')} placeholder={t(input.placeholder || ('' as any))}
resize resize
value={getValues(input.key)} value={getValues(input.key)}
onChange={(e) => { onChange={(e) => {

View File

@ -64,7 +64,7 @@ const TagsEditModal = ({ onClose }: { onClose: () => void }) => {
> >
<ModalBody> <ModalBody>
<Box mb={3} fontWeight="semibold"> <Box mb={3} fontWeight="semibold">
{t('common:团队标签')} {t('common:team_tag')}
</Box> </Box>
<Menu closeOnSelect={false}> <Menu closeOnSelect={false}>
<MenuButton className="menu-btn" maxHeight={'250'} w={'100%'}> <MenuButton className="menu-btn" maxHeight={'250'} w={'100%'}>

View File

@ -333,11 +333,11 @@ const RenderList = React.memo(function RenderList({
template: { template: {
...templateNode, ...templateNode,
name: computedNewNodeName({ name: computedNewNodeName({
templateName: t(templateNode.name), templateName: t(templateNode.name as any),
flowNodeType: templateNode.flowNodeType, flowNodeType: templateNode.flowNodeType,
pluginId: templateNode.pluginId pluginId: templateNode.pluginId
}), }),
intro: t(templateNode.intro || '') intro: t(templateNode.intro || ('' as any))
}, },
position: { x: mouseX, y: mouseY - 20 }, position: { x: mouseX, y: mouseY - 20 },
selected: true selected: true
@ -374,7 +374,7 @@ const RenderList = React.memo(function RenderList({
{item.label && ( {item.label && (
<Flex> <Flex>
<Box fontSize={'sm'} fontWeight={'bold'} flex={1}> <Box fontSize={'sm'} fontWeight={'bold'} flex={1}>
{t(item.label)} {t(item.label as any)}
</Box> </Box>
</Flex> </Flex>
)} )}
@ -394,11 +394,11 @@ const RenderList = React.memo(function RenderList({
borderRadius={'0'} borderRadius={'0'}
/> />
<Box fontWeight={'bold'} ml={3}> <Box fontWeight={'bold'} ml={3}>
{t(template.name)} {t(template.name as any)}
</Box> </Box>
</Flex> </Flex>
<Box mt={2} color={'myGray.500'}> <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>
</Box> </Box>
} }
@ -441,7 +441,7 @@ const RenderList = React.memo(function RenderList({
borderRadius={'0'} borderRadius={'0'}
/> />
<Box color={'black'} fontSize={'sm'} ml={5} flex={'1 0 0'}> <Box color={'black'} fontSize={'sm'} ml={5} flex={'1 0 0'}>
{t(template.name)} {t(template.name as any)}
</Box> </Box>
</Flex> </Flex>
</MyTooltip> </MyTooltip>

View File

@ -193,7 +193,7 @@ export const useDebug = () => {
{...register(input.key, { {...register(input.key, {
required required
})} })}
placeholder={t(input.placeholder || '')} placeholder={t(input.placeholder || ('' as any))}
bg={'myGray.50'} bg={'myGray.50'}
/> />
); );
@ -232,7 +232,7 @@ export const useDebug = () => {
return ( return (
<JsonEditor <JsonEditor
bg={'myGray.50'} bg={'myGray.50'}
placeholder={t(input.placeholder || '')} placeholder={t(input.placeholder || ('' as any))}
resize resize
value={value} value={value}
onChange={(e) => { onChange={(e) => {
@ -251,7 +251,7 @@ export const useDebug = () => {
* *
</Box> </Box>
)} )}
{t(input.debugLabel || input.label)} {t(input.debugLabel || (input.label as any))}
</Box> </Box>
{input.description && <QuestionTip ml={2} label={input.description} />} {input.description && <QuestionTip ml={2} label={input.description} />}
</Flex> </Flex>

View File

@ -203,7 +203,7 @@ function Reference({
/> />
</Flex> </Flex>
<ReferSelector <ReferSelector
placeholder={t(inputChildren.referencePlaceholder || '选择知识库引用')} placeholder={t((inputChildren.referencePlaceholder as any) || '选择知识库引用')}
list={referenceList} list={referenceList}
value={formatValue} value={formatValue}
onSelect={onSelect} onSelect={onSelect}

View File

@ -321,7 +321,7 @@ const Reference = ({
return ( return (
<ReferSelector <ReferSelector
placeholder={t('common:选择引用变量')} placeholder={t('common:select_reference_variable')}
list={referenceList} list={referenceList}
value={formatValue} value={formatValue}
onSelect={onSelect} onSelect={onSelect}

View File

@ -163,7 +163,7 @@ const FieldEditModal = ({
}, [inputType]); }, [inputType]);
const valueTypeSelectList = Object.values(FlowValueTypeMap).map((item) => ({ const valueTypeSelectList = Object.values(FlowValueTypeMap).map((item) => ({
label: t(item.label), label: t(item.label as any),
value: item.value value: item.value
})); }));
const defaultValueType = const defaultValueType =

View File

@ -116,8 +116,8 @@ const NodePluginInput = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
const inputType = input.renderTypeList[0]; const inputType = input.renderTypeList[0];
return { return {
icon: FlowNodeInputMap[inputType]?.icon as string, icon: FlowNodeInputMap[inputType]?.icon as string,
label: t(input.label), label: t(input.label as any),
type: input.valueType ? t(FlowValueTypeMap[input.valueType]?.label) : '-', type: input.valueType ? t(FlowValueTypeMap[input.valueType]?.label as any) : '-',
isTool: !!input.toolDescription, isTool: !!input.toolDescription,
key: input.key key: input.key
}; };

View File

@ -200,7 +200,7 @@ function Reference({
/> />
</Flex> </Flex>
<ReferSelector <ReferSelector
placeholder={t(input.referencePlaceholder || '选择引用变量')} placeholder={t((input.referencePlaceholder as any) || 'select_reference_variable')}
list={referenceList} list={referenceList}
value={formatValue} value={formatValue}
onSelect={onSelect} onSelect={onSelect}

View File

@ -302,7 +302,7 @@ const Reference = ({
return ( return (
<ReferSelector <ReferSelector
placeholder={t('common:选择引用变量')} placeholder={t('common:select_reference_variable')}
list={referenceList} list={referenceList}
value={formatValue} value={formatValue}
onSelect={onSelect} onSelect={onSelect}

View File

@ -139,7 +139,7 @@ const NodeCard = (props: Props) => {
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<Avatar src={avatar} borderRadius={'0'} objectFit={'contain'} w={'30px'} h={'30px'} /> <Avatar src={avatar} borderRadius={'0'} objectFit={'contain'} w={'30px'} h={'30px'} />
<Box ml={3} fontSize={'md'} fontWeight={'medium'}> <Box ml={3} fontSize={'md'} fontWeight={'medium'}>
{t(name)} {t(name as any)}
</Box> </Box>
{!menuForbid?.rename && ( {!menuForbid?.rename && (
<MyIcon <MyIcon
@ -443,7 +443,7 @@ const NodeIntro = React.memo(function NodeIntro({
<> <>
<Flex alignItems={'flex-end'} py={1}> <Flex alignItems={'flex-end'} py={1}>
<Box fontSize={'xs'} color={'myGray.600'} flex={'1 0 0'}> <Box fontSize={'xs'} color={'myGray.600'} flex={'1 0 0'}>
{t(intro)} {t(intro as any)}
</Box> </Box>
{NodeIsTool && ( {NodeIsTool && (
<Button <Button

View File

@ -62,7 +62,7 @@ const FieldModal = ({
if (!customInputConfig.selectValueTypeList) return []; if (!customInputConfig.selectValueTypeList) return [];
const dataTypeSelectList = Object.values(FlowValueTypeMap).map((item) => ({ const dataTypeSelectList = Object.values(FlowValueTypeMap).map((item) => ({
label: t(item.label), label: t(item.label as any),
value: item.value value: item.value
})); }));

View File

@ -52,8 +52,8 @@ const InputLabel = ({ nodeId, input }: Props) => {
fontWeight={'medium'} fontWeight={'medium'}
color={'myGray.600'} color={'myGray.600'}
> >
<FormLabel required={required}>{t(label)}</FormLabel> <FormLabel required={required}>{t(label as any)}</FormLabel>
{description && <QuestionTip ml={1} label={t(description)}></QuestionTip>} {description && <QuestionTip ml={1} label={t(description as any)}></QuestionTip>}
</Flex> </Flex>
{/* value type */} {/* value type */}
{renderType === FlowNodeInputTypeEnum.reference && <ValueTypeLabel valueType={valueType} />} {renderType === FlowNodeInputTypeEnum.reference && <ValueTypeLabel valueType={valueType} />}

View File

@ -59,7 +59,7 @@ const DynamicInputs = (props: RenderInputProps) => {
<HStack className="nodrag" cursor={'default'} position={'relative'}> <HStack className="nodrag" cursor={'default'} position={'relative'}>
<HStack spacing={1} position={'relative'} fontWeight={'medium'} color={'myGray.600'}> <HStack spacing={1} position={'relative'} fontWeight={'medium'} color={'myGray.600'}>
<Box>{item.label || workflowT('Custom input')}</Box> <Box>{item.label || workflowT('Custom input')}</Box>
{item.description && <QuestionTip label={t(item.description)} />} {item.description && <QuestionTip label={t(item.description as any)} />}
</HStack> </HStack>
<Box flex={'1 0 0'} /> <Box flex={'1 0 0'} />
<Button <Button
@ -208,7 +208,7 @@ function Reference({
/> />
</Flex> </Flex>
<ReferSelector <ReferSelector
placeholder={t(inputChildren.referencePlaceholder || '选择引用变量')} placeholder={t((inputChildren.referencePlaceholder as any) || 'select_reference_variable')}
list={referenceList} list={referenceList}
value={formatValue} value={formatValue}
onSelect={onSelect} onSelect={onSelect}

View File

@ -79,7 +79,7 @@ const Reference = ({ item, nodeId }: RenderInputProps) => {
return ( return (
<ReferSelector <ReferSelector
placeholder={t(item.referencePlaceholder || '选择引用变量')} placeholder={t((item.referencePlaceholder as any) || 'select_reference_variable')}
list={referenceList} list={referenceList}
value={formatValue} value={formatValue}
onSelect={onSelect} onSelect={onSelect}
@ -121,7 +121,7 @@ export const useReference = ({
label: ( label: (
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<Avatar mr={1} src={node.avatar} w={'14px'} borderRadius={'ms'} /> <Avatar mr={1} src={node.avatar} w={'14px'} borderRadius={'ms'} />
<Box>{t(node.name)}</Box> <Box>{t(node.name as any)}</Box>
</Flex> </Flex>
), ),
value: node.nodeId, value: node.nodeId,
@ -135,7 +135,7 @@ export const useReference = ({
.filter((output) => output.id !== NodeOutputKeyEnum.addOutputParam) .filter((output) => output.id !== NodeOutputKeyEnum.addOutputParam)
.map((output) => { .map((output) => {
return { return {
label: t(output.label || ''), label: t((output.label as any) || ''),
value: output.id value: output.id
}; };
}) })

View File

@ -54,10 +54,10 @@ const TextareaRender = ({ inputs = [], item, nodeId }: RenderInputProps) => {
return ( return (
<PromptEditor <PromptEditor
variables={variables} variables={variables}
title={t(item.label)} title={t(item.label as any)}
maxLength={item.maxLength} maxLength={item.maxLength}
h={150} h={150}
placeholder={t(item.placeholder || '')} placeholder={t((item.placeholder as any) || '')}
value={item.value} value={item.value}
onChange={onChange} onChange={onChange}
isFlow={true} isFlow={true}

View File

@ -65,7 +65,7 @@ const FieldModal = ({
const dataTypeSelectList = Object.values(FlowValueTypeMap) const dataTypeSelectList = Object.values(FlowValueTypeMap)
.slice(0, -1) .slice(0, -1)
.map((item) => ({ .map((item) => ({
label: t(item.label), label: t(item.label as any),
value: item.value value: item.value
})); }));

View File

@ -33,9 +33,9 @@ const OutputLabel = ({ nodeId, output }: { nodeId: string; output: FlowNodeOutpu
mr={1} mr={1}
ml={output.type === FlowNodeOutputTypeEnum.source ? 1 : 0} ml={output.type === FlowNodeOutputTypeEnum.source ? 1 : 0}
> >
{t(label)} {t(label as any)}
</Box> </Box>
{description && <QuestionTip label={t(description)} />} {description && <QuestionTip label={t(description as any)} />}
<ValueTypeLabel valueType={valueType} /> <ValueTypeLabel valueType={valueType} />
</Flex> </Flex>
{output.type === FlowNodeOutputTypeEnum.source && ( {output.type === FlowNodeOutputTypeEnum.source && (

View File

@ -97,7 +97,7 @@ const RenderOutput = ({
<VariableTable <VariableTable
variables={filterAddOutput.map((output) => ({ variables={filterAddOutput.map((output) => ({
label: output.label || '-', label: output.label || '-',
type: output.valueType ? t(FlowValueTypeMap[output.valueType]?.label) : '-', type: output.valueType ? t(FlowValueTypeMap[output.valueType]?.label as any) : '-',
key: output.key key: output.key
}))} }))}
onEdit={(key) => { onEdit={(key) => {

View File

@ -197,11 +197,11 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<Avatar src={item.avatar} borderRadius={'md'} w={'20px'} /> <Avatar src={item.avatar} borderRadius={'md'} w={'20px'} />
<Box ml={3} color={'myGray.900'}> <Box ml={3} color={'myGray.900'}>
{t(item.name)} {t(item.name as any)}
</Box> </Box>
</Flex> </Flex>
<Box fontSize={'xs'} mt={2} color={'myGray.600'}> <Box fontSize={'xs'} mt={2} color={'myGray.600'}>
{t(item.intro)} {t(item.intro as any)}
</Box> </Box>
</Card> </Card>
))} ))}

View File

@ -227,7 +227,7 @@ const HttpPluginEditModal = ({
ml={4} ml={4}
bg={'myWhite.600'} bg={'myWhite.600'}
{...register('name', { {...register('name', {
required: t("common.Name Can't Be Empty") required: t('common:common.name_is_empty')
})} })}
/> />
</Flex> </Flex>

View File

@ -121,7 +121,7 @@ const Header = ({}: {}) => {
FirstPathDom={ FirstPathDom={
<> <>
<Box fontWeight={'bold'} fontSize={['sm', 'md']}> <Box fontWeight={'bold'} fontSize={['sm', 'md']}>
{t(DatasetTypeMap[datasetDetail?.type]?.collectionLabel)}({total}) {t(DatasetTypeMap[datasetDetail?.type]?.collectionLabel as any)}({total})
</Box> </Box>
{datasetDetail?.websiteConfig?.url && ( {datasetDetail?.websiteConfig?.url && (
<Flex fontSize={'sm'}> <Flex fontSize={'sm'}>

View File

@ -137,7 +137,7 @@ const CollectionCard = () => {
getData(pageNum); getData(pageNum);
toast({ toast({
status: 'success', status: 'success',
title: t(DatasetCollectionSyncResultMap[res]?.label) title: t(DatasetCollectionSyncResultMap[res]?.label as any)
}); });
}, },
errorToast: t('common:core.dataset.error.Start Sync Failed') errorToast: t('common:core.dataset.error.Start Sync Failed')
@ -247,7 +247,7 @@ const CollectionCard = () => {
</Td> </Td>
<Td py={2}> <Td py={2}>
{!checkCollectionIsFolder(collection.type) ? ( {!checkCollectionIsFolder(collection.type) ? (
<>{t(getTrainingTypeLabel(collection.trainingType) || '-')}</> <>{t((getTrainingTypeLabel(collection.trainingType) || '-') as any)}</>
) : ( ) : (
'-' '-'
)} )}
@ -259,7 +259,7 @@ const CollectionCard = () => {
</Td> </Td>
<Td py={2}> <Td py={2}>
<MyTag showDot colorSchema={collection.colorSchema as any} type={'borderFill'}> <MyTag showDot colorSchema={collection.colorSchema as any} type={'borderFill'}>
{t(collection.statusText)} {t(collection.statusText as any)}
</MyTag> </MyTag>
</Td> </Td>
<Td py={2} onClick={(e) => e.stopPropagation()}> <Td py={2} onClick={(e) => e.stopPropagation()}>

View File

@ -142,7 +142,7 @@ const DataCard = () => {
return [ return [
{ {
label: t('common:core.dataset.collection.metadata.source'), 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'), label: t('common:core.dataset.collection.metadata.source name'),
@ -166,7 +166,7 @@ const DataCard = () => {
}, },
{ {
label: t('common:core.dataset.collection.metadata.Training Type'), 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'), label: t('common:core.dataset.collection.metadata.Chunk Size'),

View File

@ -85,9 +85,9 @@ function DataProcess({ showPreviewChunks = true }: { showPreviewChunks: boolean
<FormLabel flex={'0 0 100px'}>{t('common:core.dataset.import.Training mode')}</FormLabel> <FormLabel flex={'0 0 100px'}>{t('common:core.dataset.import.Training mode')}</FormLabel>
<LeftRadio <LeftRadio
list={trainingModeList.map(([key, value]) => ({ list={trainingModeList.map(([key, value]) => ({
title: t(value.label), title: t(value.label as any),
value: key, value: key,
tooltip: t(value.tooltip) tooltip: t(value.tooltip as any)
}))} }))}
px={3} px={3}
py={2} py={2}

View File

@ -81,7 +81,7 @@ const InputDataModal = ({
icon: 'common/overviewLight' 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, value: TabEnum.index,
icon: 'kbTest' icon: 'kbTest'
}, },
@ -126,7 +126,7 @@ const InputDataModal = ({
onError(err) { onError(err) {
toast({ toast({
status: 'error', status: 'error',
title: t(getErrText(err)) title: t(getErrText(err) as any)
}); });
onClose(); onClose();
} }

View File

@ -196,7 +196,7 @@ const Test = ({ datasetId }: { datasetId: string }) => {
size={'sm'} size={'sm'}
onClick={onOpenSelectMode} onClick={onOpenSelectMode}
> >
{t(searchModeData.title)} {t(searchModeData.title as any)}
</Button> </Button>
</Flex> </Flex>
@ -371,7 +371,7 @@ const TestHistories = React.memo(function TestHistories({
w={'12px'} w={'12px'}
mr={'1px'} mr={'1px'}
/> />
{t(DatasetSearchModeMap[item.searchMode].title)} {t(DatasetSearchModeMap[item.searchMode].title as any)}
</Flex> </Flex>
) : ( ) : (
'-' '-'
@ -382,7 +382,7 @@ const TestHistories = React.memo(function TestHistories({
</Box> </Box>
<Box flex={'0 0 70px'}> <Box flex={'0 0 70px'}>
{formatTimeToChatTime(item.time).includes('.') {formatTimeToChatTime(item.time).includes('.')
? t(formatTimeToChatTime(item.time)) ? t(formatTimeToChatTime(item.time) as any)
: formatTimeToChatTime(item.time)} : formatTimeToChatTime(item.time)}
</Box> </Box>
<MyTooltip label={t('common:core.dataset.test.delete test history')}> <MyTooltip label={t('common:core.dataset.test.delete test history')}>

View File

@ -45,7 +45,7 @@ const Detail = ({ datasetId, currentTab }: Props) => {
onError(err: any) { onError(err: any) {
router.replace(`/dataset/list`); router.replace(`/dataset/list`);
toast({ toast({
title: t(getErrText(err, t('common:common.Load Failed'))), title: t(getErrText(err, t('common:common.Load Failed')) as any),
status: 'error' status: 'error'
}); });
} }

View File

@ -41,7 +41,7 @@ const WechatForm = ({ setPageType, loginSuccess }: Props) => {
<FormLayout setPageType={setPageType} pageType={LoginPageTypeEnum.wechat}> <FormLayout setPageType={setPageType} pageType={LoginPageTypeEnum.wechat}>
<Box> <Box>
<Box w={'full'} textAlign={'center'} pt={5}> <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>
<Box p={5} display={'flex'} w={'full'} justifyContent={'center'}> <Box p={5} display={'flex'} w={'full'} justifyContent={'center'}>
{wechatInfo?.codeUrl ? ( {wechatInfo?.codeUrl ? (

View File

@ -71,7 +71,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
defaultAppTemplates.forEach((template) => { defaultAppTemplates.forEach((template) => {
postCreateApp({ postCreateApp({
avatar: template.avatar, avatar: template.avatar,
name: t(template.name), name: t(template.name as any),
modules: template.modules, modules: template.modules,
edges: template.edges, edges: template.edges,
type: template.type type: template.type

View File

@ -157,13 +157,13 @@ const Standard = ({
})} })}
> >
<Box fontSize={'md'} fontWeight={'500'}> <Box fontSize={'md'} fontWeight={'500'}>
{t(item.label)} {t(item.label as any)}
</Box> </Box>
<Box fontSize={['32px', '42px']} fontWeight={'bold'}> <Box fontSize={['32px', '42px']} fontWeight={'bold'}>
{item.price} {item.price}
</Box> </Box>
<Box color={'myGray.500'} h={'40px'} fontSize={'xs'}> <Box color={'myGray.500'} h={'40px'} fontSize={'xs'}>
{t(item.desc, { title: feConfigs?.systemTitle })} {t(item.desc as any, { title: feConfigs?.systemTitle })}
</Box> </Box>
{(() => { {(() => {
if ( if (

View File

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

View File

@ -26,7 +26,7 @@ export const useRequest = ({ successToast, errorToast, onSuccess, onError, ...pr
onError?.(err, variables, context); onError?.(err, variables, context);
if (errorToast !== undefined) { if (errorToast !== undefined) {
const errText = t(getErrText(err, errorToast || '')); const errText = t(getErrText(err, errorToast || '') as any);
if (errText) { if (errText) {
toast({ toast({
title: errText, title: errText,

View File

@ -1,4 +1,4 @@
import { I18nNsType } from '@/types/i18next'; import { I18nNsType } from '@fastgpt/web/types/i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
export const LANG_KEY = 'NEXT_LOCALE_LANG'; export const LANG_KEY = 'NEXT_LOCALE_LANG';