From 864eff47c7202c3091ebddfa18abc5ff59dc2203 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Mon, 5 May 2025 16:16:59 +0800 Subject: [PATCH] perf: i18n (#4740) * feat: login limit time config * doc * perf: code * i18n update * update lock * fix: ts * update package --- .vscode/i18n-ally-custom-framework.yml | 3 - .../zh-cn/docs/development/upgrading/498.md | 3 + env.d.ts | 1 + packages/global/core/dataset/constants.ts | 12 +- .../core/workflow/dispatch/dataset/concat.ts | 2 +- .../common/DateRangePicker/index.tsx | 4 +- .../web/components/common/EmptyTip/index.tsx | 2 +- .../common/MyModal/EditFolderModal.tsx | 6 +- .../common/MyPopover/PopoverConfirm.tsx | 4 +- .../common/MySelect/CronSelector.tsx | 4 +- .../common/MySelect/MultipleRowSelect.tsx | 12 +- .../common/MySelect/MultipleSelect.tsx | 4 +- .../common/Textarea/CodeEditor/index.tsx | 2 +- .../Textarea/CustomPromptEditor/index.tsx | 6 +- .../common/Textarea/JsonEditor/index.tsx | 2 +- .../common/Textarea/PromptEditor/index.tsx | 2 +- packages/web/core/workflow/constants.ts | 16 +- packages/web/hooks/useBeforeunload.ts | 2 +- packages/web/hooks/useConfirm.tsx | 8 +- packages/web/hooks/useCopyData.tsx | 4 +- packages/web/hooks/useEditTextarea.tsx | 4 +- packages/web/hooks/useLinkedScroll.tsx | 4 +- packages/web/hooks/usePagination.tsx | 12 +- packages/web/hooks/useScrollPagination.tsx | 14 +- packages/web/i18n/en/app.json | 2 +- packages/web/i18n/en/common.json | 336 ++++++++--------- packages/web/i18n/en/dataset.json | 4 +- packages/web/i18n/en/publish.json | 2 +- packages/web/i18n/en/workflow.json | 4 +- packages/web/i18n/zh-CN/app.json | 2 +- packages/web/i18n/zh-CN/common.json | 336 ++++++++--------- packages/web/i18n/zh-CN/dataset.json | 2 +- packages/web/i18n/zh-Hant/app.json | 2 +- packages/web/i18n/zh-Hant/common.json | 338 ++++++++---------- packages/web/i18n/zh-Hant/dataset.json | 2 +- pnpm-lock.yaml | 61 ++-- projects/app/.env.template | 2 + projects/app/package.json | 4 +- .../src/components/CommunityModal/index.tsx | 2 +- .../Markdown/codeBlock/CodeLight.tsx | 2 +- .../Markdown/codeBlock/iframe-html.tsx | 8 +- .../common/Modal/EditResourceModal.tsx | 6 +- .../components/common/ParentPaths/index.tsx | 8 +- .../common/Textarea/MyTextarea/index.tsx | 4 +- .../common/Textarea/TagTextarea.tsx | 2 +- .../components/common/folder/MoveModal.tsx | 6 +- .../app/src/components/common/folder/Path.tsx | 2 +- .../common/folder/SelectOneResource.tsx | 2 +- .../components/common/folder/SlideCard.tsx | 6 +- .../core/ai/AISettingModal/index.tsx | 8 +- .../components/core/ai/ModelTable/index.tsx | 12 +- .../core/app/DatasetParamsModal.tsx | 6 +- .../core/app/DatasetSelectModal.tsx | 4 +- .../src/components/core/app/FileSelect.tsx | 2 +- .../components/core/app/InputGuideConfig.tsx | 14 +- .../app/src/components/core/app/QGConfig.tsx | 2 +- .../src/components/core/app/VariableEdit.tsx | 4 +- .../ChatBox/Input/InputGuideBox.tsx | 1 - .../ChatBox/components/ChatController.tsx | 6 +- .../ChatBox/components/ChatItem.tsx | 2 +- .../ChatBox/components/FeedbackModal.tsx | 2 +- .../components/SelectMarkCollection.tsx | 2 +- .../ChatBox/components/VariablePopover.tsx | 2 +- .../core/chat/ChatContainer/ChatBox/index.tsx | 2 +- .../PluginRunBox/components/RenderInput.tsx | 2 +- .../components/core/dataset/RawSourceBox.tsx | 2 +- .../src/components/support/apikey/Table.tsx | 26 +- .../support/laf/LafAccountModal.tsx | 8 +- .../permission/ChangeOwnerModal/index.tsx | 4 +- .../permission/ConfigPerModal/index.tsx | 2 +- .../permission/MemberManager/ManageModal.tsx | 2 +- .../permission/MemberManager/MemberModal.tsx | 6 +- .../MemberManager/PermissionSelect.tsx | 2 +- .../permission/MemberManager/context.tsx | 8 +- .../permission/ResumeInheritText/index.tsx | 12 +- .../user/inform/UpdateContactModal.tsx | 4 +- .../support/user/safe/SendCodeAuthModal.tsx | 4 +- .../support/user/team/TeamTagModal/index.tsx | 4 +- .../wallet/NotSufficientModal/index.tsx | 9 +- .../account/AccountContainer.tsx | 2 +- .../account/info/RedeemCouponModal.tsx | 2 +- .../account/model/AddModelBox.tsx | 6 +- .../model/Channel/EditChannelModal.tsx | 6 +- .../account/model/Channel/ModelTest.tsx | 6 +- .../account/model/Channel/index.tsx | 2 +- .../account/model/Log/index.tsx | 10 +- .../account/model/ModelConfigTable.tsx | 24 +- .../account/team/EditInfoModal.tsx | 20 +- .../team/GroupManage/GroupInfoModal.tsx | 2 +- .../team/GroupManage/GroupManageMember.tsx | 4 +- .../GroupManage/GroupTransferOwnerModal.tsx | 4 +- .../account/team/GroupManage/index.tsx | 4 +- .../team/Invite/CreateInvitationModal.tsx | 6 +- .../account/team/Invite/HandleInviteModal.tsx | 2 +- .../account/team/Invite/InviteModal.tsx | 4 +- .../account/team/MemberTable.tsx | 6 +- .../account/team/OrgManage/OrgInfoModal.tsx | 6 +- .../team/OrgManage/OrgMemberManageModal.tsx | 6 +- .../account/team/OrgManage/OrgMoveModal.tsx | 2 +- .../account/team/OrgManage/index.tsx | 6 +- .../account/team/PermissionManage/index.tsx | 2 +- .../account/thirdParty/OpenAIAccountModal.tsx | 8 +- .../thirdParty/WorkflowVariableModal.tsx | 8 +- .../app/ImportAppConfigEditor.tsx | 4 +- .../app/detail/ExportConfigPopover.tsx | 4 +- .../pageComponents/app/detail/InfoModal.tsx | 18 +- .../app/detail/Logs/DetailLogsModal.tsx | 6 +- .../app/detail/MCPTools/AppCard.tsx | 4 +- .../app/detail/MCPTools/ChatTest.tsx | 6 +- .../app/detail/MCPTools/EditForm.tsx | 6 +- .../app/detail/MCPTools/Header.tsx | 4 +- .../app/detail/Plugin/Header.tsx | 6 +- .../Publish/DingTalk/DingTalkEditModal.tsx | 14 +- .../app/detail/Publish/DingTalk/index.tsx | 16 +- .../detail/Publish/FeiShu/FeiShuEditModal.tsx | 14 +- .../app/detail/Publish/FeiShu/index.tsx | 16 +- .../app/detail/Publish/Link/index.tsx | 28 +- .../OffiAccount/OffiAccountEditModal.tsx | 14 +- .../app/detail/Publish/OffiAccount/index.tsx | 16 +- .../detail/Publish/Wecom/WecomEditModal.tsx | 14 +- .../app/detail/Publish/Wecom/index.tsx | 14 +- .../detail/Publish/components/BasicInfo.tsx | 4 +- .../app/detail/PublishHistoriesSlider.tsx | 2 +- .../app/detail/SimpleApp/AppCard.tsx | 12 +- .../app/detail/SimpleApp/EditForm.tsx | 4 +- .../app/detail/SimpleApp/Header.tsx | 2 +- .../SimpleApp/components/ConfigToolModal.tsx | 4 +- .../SimpleApp/components/ToolSelect.tsx | 2 +- .../SimpleApp/components/ToolSelectModal.tsx | 10 +- .../app/detail/TagsEditModal.tsx | 8 +- .../app/detail/Workflow/Header.tsx | 6 +- .../detail/Workflow/components/SaveButton.tsx | 2 +- .../app/detail/WorkflowComponents/AppCard.tsx | 2 +- .../WorkflowComponents/Flow/ChatTest.tsx | 8 +- .../Flow/ImportSettings.tsx | 2 +- .../Flow/SelectAppModal.tsx | 4 +- .../Flow/components/FlowController.tsx | 14 +- .../Flow/components/SaveAndPublish.tsx | 6 +- .../Flow/hooks/useDebug.tsx | 4 +- .../Flow/nodes/Loop/NodeLoop.tsx | 2 +- .../Flow/nodes/NodeCQNode.tsx | 2 +- .../Flow/nodes/NodeCode.tsx | 4 +- .../Flow/nodes/NodeDatasetConcat.tsx | 4 +- .../nodes/NodeExtract/ExtractFieldModal.tsx | 4 +- .../Flow/nodes/NodeExtract/index.tsx | 4 +- .../NodeFormInput/InputFormEditModal.tsx | 2 +- .../Flow/nodes/NodeFormInput/index.tsx | 6 +- .../Flow/nodes/NodeHttp/CurlImportModal.tsx | 6 +- .../Flow/nodes/NodeHttp/index.tsx | 4 +- .../Flow/nodes/NodeIfElse/ListItem.tsx | 9 +- .../WorkflowComponents/Flow/nodes/NodeLaf.tsx | 6 +- .../nodes/NodePluginIO/InputEditModal.tsx | 2 +- .../nodes/NodePluginIO/InputTypeConfig.tsx | 6 +- .../Flow/nodes/NodePluginIO/PluginInput.tsx | 4 +- .../Flow/nodes/NodePluginIO/PluginOutput.tsx | 6 +- .../NodePluginIO/PluginOutputEditModal.tsx | 4 +- .../Flow/nodes/NodeSimple.tsx | 4 +- .../Flow/nodes/NodeTool.tsx | 4 +- .../NodeToolParams/ToolParamsEditModal.tsx | 4 +- .../Flow/nodes/NodeTools.tsx | 4 +- .../Flow/nodes/NodeUserSelect.tsx | 4 +- .../Flow/nodes/NodeVariableUpdate.tsx | 2 +- .../Flow/nodes/NodeWorkflowStart.tsx | 2 +- .../Flow/nodes/render/NodeCard.tsx | 6 +- .../render/RenderDebug/NodeDebugResponse.tsx | 4 +- .../render/RenderInput/FieldEditModal.tsx | 4 +- .../templates/DynamicInputs/index.tsx | 11 +- .../RenderInput/templates/SelectDataset.tsx | 2 +- .../templates/SettingQuotePrompt.tsx | 6 +- .../render/RenderOutput/FieldEditModal.tsx | 4 +- .../Flow/nodes/render/RenderOutput/index.tsx | 2 +- .../render/RenderToolInput/EditFieldModal.tsx | 4 +- .../context/workflowStatusContext.tsx | 2 +- .../src/pageComponents/app/detail/context.tsx | 4 +- .../pageComponents/chat/ChatHistorySlider.tsx | 4 +- .../ChatQuoteList/CollectionQuoteItem.tsx | 2 +- .../ChatQuoteList/CollectionQuoteReader.tsx | 2 +- .../chat/ChatQuoteList/QuoteItem.tsx | 2 +- .../chat/ChatQuoteList/QuoteReader.tsx | 2 +- .../chat/CustomPluginRunBox.tsx | 12 +- .../src/pageComponents/chat/SliderApps.tsx | 2 +- .../dashboard/apps/CreateModal.tsx | 13 +- .../dashboard/apps/HttpPluginEditModal.tsx | 22 +- .../dashboard/apps/JsonImportModal.tsx | 10 +- .../pageComponents/dashboard/apps/List.tsx | 12 +- .../dashboard/apps/MCPToolsEditModal.tsx | 16 +- .../pageComponents/dashboard/apps/TypeTag.tsx | 1 - .../dashboard/mcp/EditModal.tsx | 12 +- .../dataset/EditFolderModal.tsx | 2 +- .../dataset/detail/CollectionCard/Header.tsx | 6 +- .../detail/CollectionCard/TagManageModal.tsx | 14 +- .../detail/CollectionCard/TrainingStates.tsx | 2 +- .../detail/CollectionCard/WebsiteConfig.tsx | 14 +- .../dataset/detail/CollectionCard/index.tsx | 19 +- .../dataset/detail/DataCard.tsx | 2 +- .../detail/Form/CollectionChunkForm.tsx | 2 +- .../dataset/detail/Import/Context.tsx | 4 +- .../Import/commonProgress/DataProcess.tsx | 2 +- .../Import/commonProgress/PreviewData.tsx | 2 +- .../detail/Import/commonProgress/Upload.tsx | 12 +- .../detail/Import/components/FileSelector.tsx | 20 +- .../Import/components/FileSourceSelector.tsx | 2 +- .../detail/Import/components/RenderFiles.tsx | 11 +- .../detail/Import/diffSource/APIDataset.tsx | 2 +- .../detail/Import/diffSource/ExternalFile.tsx | 2 +- .../Import/diffSource/FileCustomText.tsx | 4 +- .../detail/Import/diffSource/FileLink.tsx | 2 +- .../detail/Import/diffSource/FileLocal.tsx | 2 +- .../detail/Import/diffSource/TableLocal.tsx | 2 +- .../Info/components/EditApiServiceModal.tsx | 4 +- .../dataset/detail/Info/index.tsx | 14 +- .../dataset/detail/InputDataModal.tsx | 8 +- .../pageComponents/dataset/detail/NavBar.tsx | 2 +- .../dataset/list/CreateModal.tsx | 14 +- .../src/pageComponents/dataset/list/List.tsx | 6 +- .../src/pageComponents/price/ExtraPlan.tsx | 8 +- projects/app/src/pages/_app.tsx | 9 +- projects/app/src/pages/account/setting.tsx | 2 +- .../support/user/account/loginByPassword.ts | 3 +- .../pages/dashboard/templateMarket/index.tsx | 4 +- .../app/src/pages/dataset/detail/index.tsx | 2 +- .../app/src/pages/dataset/list/context.tsx | 2 +- .../app/src/service/common/system/index.ts | 3 +- .../web/common/file/hooks/useSelectFile.tsx | 4 +- .../app/src/web/common/hooks/useEditTitle.tsx | 4 +- .../app/src/web/common/hooks/useSpeech.ts | 4 +- projects/app/src/web/context/I18n.tsx | 38 -- .../dataset/components/SelectCollections.tsx | 8 +- .../dataset/context/datasetPageContext.tsx | 4 +- 229 files changed, 1128 insertions(+), 1293 deletions(-) delete mode 100644 projects/app/src/web/context/I18n.tsx diff --git a/.vscode/i18n-ally-custom-framework.yml b/.vscode/i18n-ally-custom-framework.yml index a2d4fe0cc..3f810155a 100644 --- a/.vscode/i18n-ally-custom-framework.yml +++ b/.vscode/i18n-ally-custom-framework.yml @@ -16,9 +16,6 @@ usageMatchRegex: # the `{key}` will be placed by a proper keypath matching regex, # you can ignore it and use your own matching rules as well - "[^\\w\\d]t\\(['\"`]({key})['\"`]" - - "[^\\w\\d]commonT\\(['\"`]({key})['\"`]" - - "[^\\w\\d]fileT\\(['\"`]({key})['\"`]" - - "[^\\w\\d]workflowT\\(['\"`]({key})['\"`]" - "[^\\w\\d]i18nT\\(['\"`]({key})['\"`]" # A RegEx to set a custom scope range. This scope will be used as a prefix when detecting keys diff --git a/docSite/content/zh-cn/docs/development/upgrading/498.md b/docSite/content/zh-cn/docs/development/upgrading/498.md index 4fc0b0d2c..3b638afa2 100644 --- a/docSite/content/zh-cn/docs/development/upgrading/498.md +++ b/docSite/content/zh-cn/docs/development/upgrading/498.md @@ -17,7 +17,10 @@ weight: 792 ## ⚙️ 优化 1. Chat log list 优化,避免大数据时超出内存限制。 +2. 预加载 token 计算 worker,避免主任务中并发创建导致线程阻塞。 ## 🐛 修复 +1. 应用列表/知识库列表,删除行权限展示问题。 +2. 打开知识库搜索参数后,重排选项自动被打开。 diff --git a/env.d.ts b/env.d.ts index 1430a3a44..1eb9a5770 100644 --- a/env.d.ts +++ b/env.d.ts @@ -35,6 +35,7 @@ declare global { ALLOWED_ORIGINS?: string; SHOW_COUPON?: string; CONFIG_JSON_PATH?: string; + PASSWORD_LOGIN_LOCK_SECONDS?: string; } } } diff --git a/packages/global/core/dataset/constants.ts b/packages/global/core/dataset/constants.ts index 4ec67db14..1f50aadf5 100644 --- a/packages/global/core/dataset/constants.ts +++ b/packages/global/core/dataset/constants.ts @@ -19,32 +19,32 @@ export const DatasetTypeMap = { [DatasetTypeEnum.dataset]: { icon: 'core/dataset/commonDatasetOutline', label: i18nT('dataset:common_dataset'), - collectionLabel: i18nT('common:common.File') + collectionLabel: i18nT('common:File') }, [DatasetTypeEnum.websiteDataset]: { icon: 'core/dataset/websiteDatasetOutline', label: i18nT('dataset:website_dataset'), - collectionLabel: i18nT('common:common.Website') + collectionLabel: i18nT('common:Website') }, [DatasetTypeEnum.externalFile]: { icon: 'core/dataset/externalDatasetOutline', label: i18nT('dataset:external_file'), - collectionLabel: i18nT('common:common.File') + collectionLabel: i18nT('common:File') }, [DatasetTypeEnum.apiDataset]: { icon: 'core/dataset/externalDatasetOutline', label: i18nT('dataset:api_file'), - collectionLabel: i18nT('common:common.File') + collectionLabel: i18nT('common:File') }, [DatasetTypeEnum.feishu]: { icon: 'core/dataset/feishuDatasetOutline', label: i18nT('dataset:feishu_dataset'), - collectionLabel: i18nT('common:common.File') + collectionLabel: i18nT('common:File') }, [DatasetTypeEnum.yuque]: { icon: 'core/dataset/yuqueDatasetOutline', label: i18nT('dataset:yuque_dataset'), - collectionLabel: i18nT('common:common.File') + collectionLabel: i18nT('common:File') } }; diff --git a/packages/service/core/workflow/dispatch/dataset/concat.ts b/packages/service/core/workflow/dispatch/dataset/concat.ts index 0177ca8c8..fe8d58fbb 100644 --- a/packages/service/core/workflow/dispatch/dataset/concat.ts +++ b/packages/service/core/workflow/dispatch/dataset/concat.ts @@ -21,7 +21,7 @@ export async function dispatchDatasetConcat( props: DatasetConcatProps ): Promise { const { - params: { limit = 6000, ...quoteMap } + params: { limit = 5000, ...quoteMap } } = props as DatasetConcatProps; const quoteList = Object.values(quoteMap).filter((list) => Array.isArray(list)); diff --git a/packages/web/components/common/DateRangePicker/index.tsx b/packages/web/components/common/DateRangePicker/index.tsx index f62766dde..52e5caff0 100644 --- a/packages/web/components/common/DateRangePicker/index.tsx +++ b/packages/web/components/common/DateRangePicker/index.tsx @@ -118,7 +118,7 @@ const DateRangePicker = ({ mr={2} onClick={() => setShowSelected(false)} > - {t('common:common.Close')} + {t('common:Close')} } diff --git a/packages/web/components/common/EmptyTip/index.tsx b/packages/web/components/common/EmptyTip/index.tsx index e8f450281..043e02561 100644 --- a/packages/web/components/common/EmptyTip/index.tsx +++ b/packages/web/components/common/EmptyTip/index.tsx @@ -14,7 +14,7 @@ const EmptyTip = ({ text, iconSize = '48px', ...props }: Props) => { - {text || t('common:common.empty.Common Tip')} + {text || t('common:no_more_data')} ); diff --git a/packages/web/components/common/MyModal/EditFolderModal.tsx b/packages/web/components/common/MyModal/EditFolderModal.tsx index 4647066c6..58f404c97 100644 --- a/packages/web/components/common/MyModal/EditFolderModal.tsx +++ b/packages/web/components/common/MyModal/EditFolderModal.tsx @@ -67,7 +67,7 @@ const EditFolderModal = ({ - {t('common:common.Input name')} + {t('common:input_name')} - {t('common:common.Input folder description')} + {t('common:folder_description')}