(null)
const modelCostNoticeId = useId()
// Network retries of the same model choice reuse the key; any model change starts a new intent.
const idempotencyKeyRef = useRef<{ fingerprint: string; key: string } | undefined>(undefined)
@@ -163,14 +161,6 @@ export function KnowledgeUpgradeDialog({
/>
-
- {t(($) => $.learnMore, { ns: 'knowledgeSpace' })}
-
{(discoveryQuery.isError || startMutation.isError) && (
{modelsRejected
diff --git a/demo-dify/dify/web/i18n/locales/en-US/app-overview.json b/demo-dify/dify/web/i18n/locales/en-US/app-overview.json
index e0919ea7..62b64d55 100644
--- a/demo-dify/dify/web/i18n/locales/en-US/app-overview.json
+++ b/demo-dify/dify/web/i18n/locales/en-US/app-overview.json
@@ -73,7 +73,7 @@
"overview.appInfo.settings.more.inputPlaceholderTooltip": "Upgrade to customize the placeholder",
"overview.appInfo.settings.more.privacyPolicy": "Privacy Policy",
"overview.appInfo.settings.more.privacyPolicyPlaceholder": "Enter the privacy policy link",
- "overview.appInfo.settings.more.privacyPolicyTip": "Helps visitors understand the data the application collects, see Privacy Policy.",
+ "overview.appInfo.settings.more.privacyPolicyTip": "Helps visitors understand the data the application collects.",
"overview.appInfo.settings.multiEnvironmentNotice": "Web app settings apply to all environments.",
"overview.appInfo.settings.title": "Branding",
"overview.appInfo.settings.webDesc": "Web App Description",
diff --git a/demo-dify/dify/web/i18n/locales/en-US/billing.json b/demo-dify/dify/web/i18n/locales/en-US/billing.json
index c25cf058..6df95e1d 100644
--- a/demo-dify/dify/web/i18n/locales/en-US/billing.json
+++ b/demo-dify/dify/web/i18n/locales/en-US/billing.json
@@ -16,7 +16,7 @@
"plans.community.features": [
"All Core Features Released Under the Public Repository",
"Single Workspace",
- "Complies with Dify Open Source License"
+ "Complies with the Open Source License"
],
"plans.community.includesTitle": "Free Features:",
"plans.community.name": "Community",
@@ -30,9 +30,9 @@
"Exclusive Enterprise Features",
"Multiple Workspaces & Enterprise Management",
"SSO",
- "Negotiated SLAs by Dify Partners",
+ "Negotiated SLAs by partners",
"Advanced Security & Controls",
- "Updates and Maintenance by Dify Officially",
+ "Official updates and maintenance",
"Professional Technical Support"
],
"plans.enterprise.includesTitle": "Everything from Premium, plus:",
diff --git a/demo-dify/dify/web/i18n/locales/zh-Hans/agent-v-2.json b/demo-dify/dify/web/i18n/locales/zh-Hans/agent-v-2.json
index 3535eb48..78d1755f 100644
--- a/demo-dify/dify/web/i18n/locales/zh-Hans/agent-v-2.json
+++ b/demo-dify/dify/web/i18n/locales/zh-Hans/agent-v-2.json
@@ -91,7 +91,7 @@
"agentDetail.configure.communityEditionIsolationTip": "免责声明:在 Community Edition 中,sandbox 以非 root 用户身份运行,采用 Docker 默认 capability 配置,并且只通过 Landlock 为 Agent 自有文件和会话文件提供有限保护。服务器和所有 shell 子进程共享同一个 PID namespace 和容器级 capability 边界,因此不应将其视为具备强隔离能力的多层安全 sandbox。",
"agentDetail.configure.files.add": "添加文件",
"agentDetail.configure.files.buildNote.generated": "已生成",
- "agentDetail.configure.files.buildNote.richTooltip": "Agent 在构建模式中完成的设置都记录在这里。每次对话开始时,它会连同提示词一起读取这份记录。了解更多",
+ "agentDetail.configure.files.buildNote.richTooltip": "Agent 在构建模式中完成的设置都记录在这里。每次对话开始时,它会连同提示词一起读取这份记录。",
"agentDetail.configure.files.download": "下载 {{name}}",
"agentDetail.configure.files.empty.description": "上传 Agent 可读取的文档,例如规格、模板或指南",
"agentDetail.configure.files.empty.title": "暂无文件",
@@ -102,8 +102,8 @@
"agentDetail.configure.files.preview.truncated": "仅显示该文件的开头部分。",
"agentDetail.configure.files.preview.unsupported": "该文件不支持预览。",
"agentDetail.configure.files.remove": "移除 {{name}}",
- "agentDetail.configure.files.richTip": "上传过长、不适合放入提示词的参考资料:规格、模板、指南。了解更多\n\n在构建模式中,Agent 可帮你完成这些设置。",
- "agentDetail.configure.files.tip": "上传过长、不适合放入提示词的参考资料:规格、模板、指南。了解更多\n\n在构建模式中,Agent 可帮你完成这些设置。",
+ "agentDetail.configure.files.richTip": "上传过长、不适合放入提示词的参考资料:规格、模板、指南。\n\n在构建模式中,Agent 可帮你完成这些设置。",
+ "agentDetail.configure.files.tip": "上传过长、不适合放入提示词的参考资料:规格、模板、指南。\n\n在构建模式中,Agent 可帮你完成这些设置。",
"agentDetail.configure.files.treeLabel": "Agent 文件",
"agentDetail.configure.files.upload.action": "上传",
"agentDetail.configure.files.upload.browse": "选择",
@@ -153,8 +153,8 @@
"agentDetail.configure.knowledgeRetrieval.remove": "删除 {{name}}",
"agentDetail.configure.knowledgeRetrieval.retrievalOne": "Retrieval 1",
"agentDetail.configure.knowledgeRetrieval.retrievalTwo": "Retrieval 2",
- "agentDetail.configure.knowledgeRetrieval.richTip": "连接 Agent 工作时可检索的知识库,以基于其内容生成回复。了解更多",
- "agentDetail.configure.knowledgeRetrieval.tip": "连接 Agent 工作时可检索的知识库,以基于其内容生成回复。了解更多",
+ "agentDetail.configure.knowledgeRetrieval.richTip": "连接 Agent 工作时可检索的知识库,以基于其内容生成回复。",
+ "agentDetail.configure.knowledgeRetrieval.tip": "连接 Agent 工作时可检索的知识库,以基于其内容生成回复。",
"agentDetail.configure.knowledgeRetrieval.toggle": "展开或收起知识检索",
"agentDetail.configure.knowledgeRetrieval.validation.metadataModelRequired": "请在元数据过滤中配置模型",
"agentDetail.configure.model.label": "模型",
@@ -175,7 +175,7 @@
"agentDetail.configure.prompt.label": "提示词",
"agentDetail.configure.prompt.placeholder": "在此编写指令,",
"agentDetail.configure.prompt.referenceMissing": "{{name}} 不存在",
- "agentDetail.configure.prompt.richTip": "设定 Agent 的角色和工作方式。了解更多",
+ "agentDetail.configure.prompt.richTip": "设定 Agent 的角色和工作方式。",
"agentDetail.configure.publishBar.draft": "草稿",
"agentDetail.configure.publishBar.publishUpdate": "发布更新",
"agentDetail.configure.publishBar.published": "已发布",
@@ -223,8 +223,8 @@
"agentDetail.configure.skills.moreActions": "{{name}} 的更多操作",
"agentDetail.configure.skills.openInLibrary": "在 Skill 库中打开",
"agentDetail.configure.skills.removeAction": "移除",
- "agentDetail.configure.skills.richTip": "将重复任务所需的指令、文件和脚本打包成 Skill。了解更多\n\n在构建模式中,Agent 可帮你完成这些设置。",
- "agentDetail.configure.skills.tip": "将重复任务所需的指令、文件和脚本打包成 Skill。了解更多\n\n在构建模式中,Agent 可帮你完成这些设置。",
+ "agentDetail.configure.skills.richTip": "将重复任务所需的指令、文件和脚本打包成 Skill。\n\n在构建模式中,Agent 可帮你完成这些设置。",
+ "agentDetail.configure.skills.tip": "将重复任务所需的指令、文件和脚本打包成 Skill。\n\n在构建模式中,Agent 可帮你完成这些设置。",
"agentDetail.configure.skills.upload.action": "上传",
"agentDetail.configure.skills.upload.browse": "选择",
"agentDetail.configure.skills.upload.description": "为此 Agent 上传 .zip 或 .skill 格式的 Skill 包。",
@@ -276,7 +276,7 @@
"agentDetail.configure.tools.moreActions": "{{name}} 的更多操作",
"agentDetail.configure.tools.removeAction": "移除 {{name}}",
"agentDetail.configure.tools.removeProvider": "移除所有工具",
- "agentDetail.configure.tools.richTip": "添加工作空间中的 工具。了解更多\n\nAgent 在沙箱中自行安装的工具不会显示在这里,但仍然可用。",
+ "agentDetail.configure.tools.richTip": "添加工作空间中的 工具。\n\nAgent 在沙箱中自行安装的工具不会显示在这里,但仍然可用。",
"agentDetail.configure.tools.toolTabs.all": "全部",
"agentDetail.configure.tools.toolTabs.cli": "CLI",
"agentDetail.configure.tools.toolTabs.custom": "自定义",
diff --git a/demo-dify/dify/web/i18n/locales/zh-Hans/app-debug.json b/demo-dify/dify/web/i18n/locales/zh-Hans/app-debug.json
index cf342c49..d530a484 100644
--- a/demo-dify/dify/web/i18n/locales/zh-Hans/app-debug.json
+++ b/demo-dify/dify/web/i18n/locales/zh-Hans/app-debug.json
@@ -194,7 +194,7 @@
"variableConfig.file.supportFileTypes": "支持的文件类型",
"variableConfig.file.video.name": "视频",
"variableConfig.hidden": "隐藏并预填",
- "variableConfig.hiddenDescription": "对终端用户隐藏此字段,并由你预填字段值。与 必填 互斥。了解更多",
+ "variableConfig.hiddenDescription": "对终端用户隐藏此字段,并由你预填字段值。与 必填 互斥。",
"variableConfig.inputPlaceholder": "请输入",
"variableConfig.json": "JSON",
"variableConfig.jsonSchema": "JSON Schema",
diff --git a/demo-dify/dify/web/i18n/locales/zh-Hans/app-overview.json b/demo-dify/dify/web/i18n/locales/zh-Hans/app-overview.json
index 9cbabdc4..b54da021 100644
--- a/demo-dify/dify/web/i18n/locales/zh-Hans/app-overview.json
+++ b/demo-dify/dify/web/i18n/locales/zh-Hans/app-overview.json
@@ -73,7 +73,7 @@
"overview.appInfo.settings.more.inputPlaceholderTooltip": "升级后可自定义提示语",
"overview.appInfo.settings.more.privacyPolicy": "隐私政策",
"overview.appInfo.settings.more.privacyPolicyPlaceholder": "请输入隐私政策链接",
- "overview.appInfo.settings.more.privacyPolicyTip": "帮助访问者了解该应用收集的数据,可参考 隐私政策。",
+ "overview.appInfo.settings.more.privacyPolicyTip": "帮助访问者了解该应用收集的数据。",
"overview.appInfo.settings.multiEnvironmentNotice": "Web App 设置将应用于所有环境。",
"overview.appInfo.settings.title": "品牌设置",
"overview.appInfo.settings.webDesc": "Web App 描述",
diff --git a/demo-dify/dify/web/i18n/locales/zh-Hans/billing.json b/demo-dify/dify/web/i18n/locales/zh-Hans/billing.json
index d019bf61..7a626d9a 100644
--- a/demo-dify/dify/web/i18n/locales/zh-Hans/billing.json
+++ b/demo-dify/dify/web/i18n/locales/zh-Hans/billing.json
@@ -16,7 +16,7 @@
"plans.community.features": [
"所有核心功能已在公共仓库发布",
"单一工作区",
- "遵守 Dify 开源许可证"
+ "遵守开源许可证"
],
"plans.community.includesTitle": "免费功能:",
"plans.community.name": "Community",
@@ -30,9 +30,9 @@
"专属企业功能",
"多个工作区与企业管理",
"单点登录",
- "由 Dify 合作伙伴协商的服务水平协议",
+ "由合作伙伴协商的服务水平协议",
"高级安全与控制",
- "由 Dify 官方进行的更新和维护",
+ "由官方进行的更新和维护",
"专业技术支持"
],
"plans.enterprise.includesTitle": "Premium 版的所有功能,加上:",
diff --git a/demo-dify/dify/web/i18n/locales/zh-Hans/dataset.json b/demo-dify/dify/web/i18n/locales/zh-Hans/dataset.json
index 4280c931..ce809b68 100644
--- a/demo-dify/dify/web/i18n/locales/zh-Hans/dataset.json
+++ b/demo-dify/dify/web/i18n/locales/zh-Hans/dataset.json
@@ -17,7 +17,7 @@
"chunkingMode.qa": "问答",
"connectDataset": "连接外部知识库",
"connectDatasetIntro.content.end": "。然后找到相应的知识库 ID 并填写在左侧表单中。如果所有信息正确,点击连接按钮后将自动跳转到知识库中的检索测试。",
- "connectDatasetIntro.content.front": "要连接到外部知识库,您需要先创建一个外部 API。请仔细阅读并参考",
+ "connectDatasetIntro.content.front": "要连接到外部知识库,您需要先创建一个外部 API",
"connectDatasetIntro.content.link": "了解如何创建外部 API",
"connectDatasetIntro.learnMore": "了解更多",
"connectDatasetIntro.title": "如何连接到外部知识库",
diff --git a/demo-dify/dify/web/i18n/locales/zh-Hans/education.json b/demo-dify/dify/web/i18n/locales/zh-Hans/education.json
index 5aee8fb3..9018510e 100644
--- a/demo-dify/dify/web/i18n/locales/zh-Hans/education.json
+++ b/demo-dify/dify/web/i18n/locales/zh-Hans/education.json
@@ -19,7 +19,7 @@
"form.schoolRole.option.teacher": "教师",
"form.schoolRole.title": "您在学校的身份",
"form.terms.desc.and": "和",
- "form.terms.desc.end": "。提交即表示:",
+ "form.terms.desc.end": "提交即表示您确认以下内容:",
"form.terms.desc.front": "您的信息和教育版认证资格的使用需遵守我们的",
"form.terms.desc.privacyPolicy": "隐私政策",
"form.terms.desc.termsOfService": "服务条款",
diff --git a/demo-dify/dify/web/service/__tests__/chinese-system-message.spec.ts b/demo-dify/dify/web/service/__tests__/chinese-system-message.spec.ts
new file mode 100644
index 00000000..0c098436
--- /dev/null
+++ b/demo-dify/dify/web/service/__tests__/chinese-system-message.spec.ts
@@ -0,0 +1,19 @@
+import { describe, expect, it } from 'vite-plus/test'
+import { localizeSystemMessage } from '../chinese-system-message'
+
+const INTERNAL_ERROR = 'The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.'
+
+describe('localizeSystemMessage', () => {
+ it('translates known system errors when the locale is Chinese', () => {
+ expect(localizeSystemMessage(INTERNAL_ERROR, 'zh-Hans')).toBe('服务器处理这次请求时出错,暂时无法完成。请稍后重试。')
+ expect(localizeSystemMessage('App not found.', 'zh-Hans')).toBe('找不到该应用。')
+ expect(localizeSystemMessage('File size exceeded. 12MB', 'zh-Hans')).toBe('文件超出大小限制。12MB')
+ expect(localizeSystemMessage('Too many login emails have been sent. Please try again in 5 minutes.', 'zh-Hans')).toBe('登录邮件发送过于频繁,请在 5 分钟后再试。')
+ })
+
+ it('keeps the original message for English locales and unknown text', () => {
+ expect(localizeSystemMessage(INTERNAL_ERROR, 'en-US')).toBe(INTERNAL_ERROR)
+ expect(localizeSystemMessage('插件作者撰写的介绍', 'zh-Hans')).toBe('插件作者撰写的介绍')
+ expect(localizeSystemMessage('A custom provider detail', 'zh-Hans')).toBe('A custom provider detail')
+ })
+})
diff --git a/demo-dify/dify/web/service/chinese-system-message.ts b/demo-dify/dify/web/service/chinese-system-message.ts
new file mode 100644
index 00000000..8c1f2d80
--- /dev/null
+++ b/demo-dify/dify/web/service/chinese-system-message.ts
@@ -0,0 +1,292 @@
+import Cookies from 'js-cookie'
+import { getI18n } from 'react-i18next'
+import { LOCALE_COOKIE_NAME } from '@/config'
+
+const ZH_MESSAGES: Record = {
+ 'The specified filename does not exist.': '指定的文件名不存在。',
+ 'Error uploading remote file.': '上传远程文件失败。',
+ 'The remote file URL is invalid.': '远程文件地址无效。',
+ 'The remote file URL is not allowed.': '不允许使用该远程文件地址。',
+ 'The remote file could not be found.': '找不到该远程文件。',
+ 'The remote file cannot be accessed without authorization.': '访问该远程文件需要授权。',
+ 'The remote file is temporarily unavailable.': '远程文件暂时无法访问。',
+ 'The remote file server returned an invalid response.': '远程文件服务器返回了无效响应。',
+ 'File size exceeded. {message}': '文件超出大小限制。',
+ 'File type not allowed.': '不允许上传该类型的文件。',
+ 'The file extension is blocked for security reasons.': '出于安全原因,已禁止该文件扩展名。',
+ 'Only one file is allowed.': '只能上传一个文件。',
+ 'Please upload your file.': '请上传文件。',
+ 'The conversation was not found for this user and app.': '找不到该用户在此应用中的对话。',
+ 'The conversation cursor is not in the current list. Refresh the list and try again.': '当前列表中没有这条对话位置。请刷新列表后再试。',
+ 'The conversation variable was not found for this conversation.': '找不到该对话中的变量。',
+ 'The new value does not match the conversation variable\'s type.': '新的值与对话变量的类型不一致。',
+ 'The conversation has no message from which to generate a name.': '这条对话还没有可用于生成名称的消息。',
+ 'A rating is required when there is no existing feedback to remove.': '没有可取消的反馈时,需要先给出评分。',
+ 'Authentication is required.': '请先登录。',
+ 'You don\'t have the permission to access the requested resource.': '你没有访问该内容的权限。',
+ 'The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.': '服务器处理这次请求时出错,暂时无法完成。请稍后重试。',
+ 'Server Error': '服务器出错,请稍后重试。',
+ 'Failed to fetch': '无法连接服务器,请检查网络后重试。',
+ 'TypeError: Failed to fetch': '无法连接服务器,请检查网络后重试。',
+ 'Network Error': '无法连接服务器,请检查网络后重试。',
+ 'NetworkError when attempting to fetch resource.': '无法连接服务器,请检查网络后重试。',
+ 'Load failed': '加载失败,请稍后重试。',
+ 'App unavailable, please check your app configurations.': '应用暂不可用,请检查应用配置。',
+ 'Agent has not been published. Please publish the Agent before using the web app.': '智能体尚未发布。请先发布后再使用网页应用。',
+ 'Please check if your Completion app mode matches the right API route.': '请确认文本生成应用的模式与接口路径一致。',
+ 'Please check if your app mode matches the right API route.': '请确认应用模式与接口路径一致。',
+ 'Please check if your Workflow app mode matches the right API route.': '请确认工作流应用的模式与接口路径一致。',
+ 'The conversation has ended. Please start a new conversation.': '这条对话已结束,请开始新的对话。',
+ 'No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials.': '没有可用的模型供应商凭证。请前往「设置 → 模型供应商」填写凭证。',
+ 'Your quota for Dify Hosted OpenAI has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials.': '托管 OpenAI 的可用额度已用完。请前往「设置 → 模型供应商」填写自己的供应商凭证。',
+ 'Dify Hosted OpenAI trial currently not support the GPT-4 model.': '托管 OpenAI 试用暂不支持 GPT-4 模型。',
+ 'Completion request failed.': '文本生成请求失败。',
+ 'The \'More like this\' feature is disabled. Please refresh your page.': '「类似内容」功能未开启。请刷新页面。',
+ 'The \'Suggested Questions After Answer\' feature is disabled. Please refresh your page.': '「回答后推荐问题」功能未开启。请刷新页面。',
+ 'Please upload your audio.': '请上传音频。',
+ 'Audio size exceeded. {message}': '音频超出大小限制。',
+ 'Audio type not allowed.': '不允许上传该类型的音频。',
+ 'Provider not support speech to text.': '该供应商不支持语音转文字。',
+ 'Speech to text is disabled.': '语音转文字未开启。',
+ 'Web app authentication required.': '使用网页应用需要先登录。',
+ 'You do not have permission to access this web app.': '你没有访问该网页应用的权限。',
+ 'App not found.': '找不到该应用。',
+ 'Web app access service is unavailable.': '网页应用访问服务暂不可用。',
+ 'Rate Limit Error': '请求过于频繁。',
+ 'Too many form requests. Please try again later.': '表单提交过于频繁,请稍后再试。',
+ 'This feature requires a paid plan.': '此功能需要付费方案。',
+ 'Dify has been successfully installed. Please refresh the page or return to the dashboard homepage.': '系统已安装完成。请刷新页面或返回首页。',
+ 'Dify has not been initialized and installed yet. Please proceed with the initialization and installation process first.': '系统尚未初始化安装。请先完成初始化。',
+ 'Init validation has not been completed yet. Please proceed with the init validation process first.': '初始化校验尚未完成。请先完成校验。',
+ 'Init validation failed. Please check the password and try again.': '初始化校验失败。请核对密码后再试。',
+ 'Account not link tenant.': '账号尚未加入工作区。',
+ 'Auth Token is invalid or account already activated, please check again.': '验证令牌无效,或账号已激活,请再检查一次。',
+ 'Workspace not found, please contact system admin to invite you to join in a workspace.': '找不到工作区。请联系管理员邀请你加入。',
+ 'Unable to add member because the maximum workspace\'s member limit was exceeded': '已达到工作区成员上限,无法继续添加。',
+ 'Unable to create workspace because the maximum workspace limit was exceeded': '已达到工作区数量上限,无法继续创建。',
+ 'Unable to create account because the licensed seats limit was exceeded': '已达到授权席位上限,无法继续创建账号。',
+ 'Account is banned.': '该账号已被停用。',
+ 'Account not found.': '找不到该账号。',
+ 'The password does not satisfy the account password policy.': '密码不符合账号密码规则。',
+ 'Too many emails have been sent from this IP address recently. Please try again later.': '该 IP 近期发送的邮件过多,请稍后再试。',
+ 'Unauthorized and force logout.': '登录已失效,请重新登录。',
+ 'This email account has been deleted within the past 30 days and is temporarily unavailable for new account registration.': '该邮箱在过去 30 天内注销过,暂时不能用于注册新账号。',
+ 'This email domain has been suspended.': '该邮箱域名已被停用。',
+ 'Rate limit exceeded': '请求过于频繁。',
+ 'We couldn\'t verify your education status.': '无法核验教育身份。',
+ 'We couldn\'t activate your education discount.': '无法开通教育优惠。',
+ 'The API key limit has been reached.': '已达到 API 密钥数量上限。',
+ 'annotation_ids are required if the parameter is provided.': '传入该参数时必须提供标注编号。',
+ 'Trigger not found.': '找不到该触发器。',
+ 'Webhook trigger not found for this node.': '找不到该节点的 Webhook 触发器。',
+ 'Your quota for Dify Hosted Model Provider has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials.': '托管模型供应商的可用额度已用完。请前往「设置 → 模型供应商」填写自己的供应商凭证。',
+ 'Provider does not support text to speech.': '该供应商不支持文字转语音。',
+ 'Draft workflow need to be initialized.': '需要先初始化草稿工作流。',
+ 'Workflow graph might have been modified, please refresh and resubmit.': '工作流可能已被修改,请刷新后再提交。',
+ 'Tracing configuration not found.': '找不到追踪配置。',
+ 'A tracing configuration already exists for this provider.': '该供应商已有追踪配置。',
+ 'The tracing provider is not supported.': '不支持该追踪供应商。',
+ 'The tracing provider is not available in this deployment.': '当前部署不提供该追踪供应商。',
+ 'The tracing configuration is invalid.': '追踪配置无效。',
+ 'The tracing configuration could not be verified.': '无法校验追踪配置。',
+ 'The tracing configuration could not be processed.': '无法处理追踪配置。',
+ 'Need to add ids.': '需要添加编号。',
+ 'No active sandbox binding.': '没有正在使用的沙箱绑定。',
+ 'Sandbox inspector is unavailable.': '沙箱检查器暂不可用。',
+ 'Sandbox file download is unavailable.': '沙箱文件暂时无法下载。',
+ 'Agent backend is unreachable.': '无法连接智能体后端。',
+ 'no agent is bound for this app/node': '该应用或节点尚未绑定智能体。',
+ 'Tracing configuration changed. Refresh and try again.': '追踪配置已变化。请刷新后再试。',
+ 'The data-source API-key authentication provider is not supported.': '不支持该数据源的 API 密钥认证。',
+ 'The data-source API-key authentication credentials are invalid.': '数据源的 API 密钥凭证无效。',
+ 'The data-source provider rejected the API-key authentication credentials.': '数据源供应商拒绝了该 API 密钥凭证。',
+ 'The data-source API-key authentication provider is temporarily unavailable.': '数据源的 API 密钥认证暂时不可用。',
+ 'The email address is not valid.': '邮箱地址无效。',
+ 'This invitation was sent to another account. Please sign in with the invited account.': '该邀请发给了另一个账号。请使用受邀账号登录。',
+ 'The passwords do not match.': '两次输入的密码不一致。',
+ 'The token is invalid or has expired.': '令牌无效或已过期。',
+ 'Email code is invalid or expired.': '邮箱验证码无效或已过期。',
+ 'Email code verification is temporarily unavailable. Please try again later.': '邮箱验证码暂时无法校验,请稍后再试。',
+ 'The email or password is mismatched.': '邮箱或密码不正确。',
+ 'Invalid email or password.': '邮箱或密码不正确。',
+ 'Too many incorrect password attempts. Please try again later.': '密码错误次数过多,请稍后再试。',
+ 'Turnstile verification failed. Please try again.': '人机验证失败,请重试。',
+ 'Turnstile verification is temporarily unavailable. Please try again later.': '人机验证暂时不可用,请稍后再试。',
+ 'Too many failed password reset attempts. Please try again in 24 hours.': '重置密码失败次数过多,请 24 小时后再试。',
+ 'Too many failed email register attempts. Please try again in 24 hours.': '邮箱注册失败次数过多,请 24 小时后再试。',
+ 'Too many failed email change attempts. Please try again in 24 hours.': '更换邮箱失败次数过多,请 24 小时后再试。',
+ 'A user with this email already exists.': '该邮箱已被注册。',
+ 'An account with an equivalent email address already exists.': '已有使用相同邮箱的账号。',
+ 'Too many failed owner transfer attempts. Please try again in 24 hours.': '转让所有者失败次数过多,请 24 小时后再试。',
+ 'You are not the owner of the workspace.': '你不是该工作区的所有者。',
+ 'You cannot transfer ownership to yourself.': '不能把所有权转让给自己。',
+ 'The member is not in the workspace.': '该成员不在此工作区中。',
+ 'The current workspace has been archived.': '当前工作区已归档。',
+ 'New password and repeat password does not match.': '新密码与确认密码不一致。',
+ 'Current password is incorrect.': '当前密码不正确。',
+ 'Invalid invitation code.': '邀请码无效。',
+ 'Invitation code is required.': '请填写邀请码。',
+ 'The account has been initialized. Please refresh the page.': '账号已完成初始化。请刷新页面。',
+ 'The account has not been initialized yet. Please proceed with the initialization process first.': '账号尚未初始化。请先完成初始化。',
+ 'Invalid account deletion code.': '账号注销验证码无效。',
+ 'Invalid role.': '角色无效。',
+ 'Centrally managed IM bindings cannot be edited from a workspace.': '集中管理的即时通讯绑定不能在工作区里修改。',
+ 'Workspace IM overrides require centrally managed bindings.': '工作区覆盖即时通讯设置前,需要先有集中管理的绑定。',
+ 'Plugin operation failed.': '插件操作失败。',
+ 'Invalid skill request.': '技能请求无效。',
+ 'filename is required': '请填写文件名。',
+ 'Cannot operate on yourself.': '不能对自己执行该操作。',
+ 'Member not found.': '找不到该成员。',
+ 'Role already assigned.': '该角色已经分配。',
+ 'Invalid network access group request.': '网络访问组请求无效。',
+ 'Network access groups are not available for this workspace.': '此工作区不提供网络访问组。',
+ 'Network access group was not found.': '找不到该网络访问组。',
+ 'The network access resource changed. Refresh it and try again.': '网络访问设置已变化。请刷新后再试。',
+ 'An IP policy with this name already exists.': '已有同名的 IP 策略。',
+ 'This IP policy is still used by one or more apps.': '仍有应用在使用该 IP 策略。',
+ 'Your workspace role does not allow this network access operation.': '你的工作区角色不能执行该网络访问操作。',
+ 'Network access control is not supported for this app mode.': '该应用模式不支持网络访问控制。',
+ 'Some access points are not supported for this app.': '此应用不支持其中部分访问入口。',
+ 'A Channel is already configured for this kind.': '该类型已经配置了渠道。',
+ 'Channel not found.': '找不到该渠道。',
+ 'The Channel configuration was updated.': '渠道配置已更新。',
+ 'Explicit IM Channel replacement is required.': '需要明确替换即时通讯渠道。',
+ 'The dataset is still being initialized or indexing. Please wait a moment.': '知识库仍在初始化或建立索引,请稍候。',
+ 'One or more selected upgrade models are unavailable.': '所选的一个或多个升级模型不可用。',
+ 'The archived document is not editable.': '已归档的文档不能编辑。',
+ 'The dataset name already exists. Please modify your dataset name.': '知识库名称已存在,请修改名称。',
+ 'Invalid action.': '操作无效。',
+ 'Dataset access denied.': '没有访问该知识库的权限。',
+ 'The document has been processed. Please refresh the page or go to the document details.': '文档已处理完成。请刷新页面或查看文档详情。',
+ 'The document is being processed and cannot be edited.': '文档正在处理,暂时不能编辑。',
+ 'The metadata content is incorrect. Please check and verify.': '元数据内容不正确,请核对后再试。',
+ '{message}': '请求没有完成。',
+ 'Pipeline not found.': '找不到该流水线。',
+ 'Agent config version not found.': '找不到该智能体配置版本。',
+ 'The app was not found in this workspace.': '在此工作区中找不到该应用。',
+ 'The app is not available in this app library.': '应用库中没有该应用。',
+ 'The app list cursor is invalid. Refresh the list and try again.': '应用列表位置无效。请刷新列表后再试。',
+ 'The app access service is unavailable. Try again later.': '应用访问服务暂不可用,请稍后再试。',
+ 'The conversation was not found for this account and app.': '找不到该账号在此应用中的对话。',
+ 'A name is required when automatic naming is disabled.': '关闭自动命名后,需要填写名称。',
+ 'The message was not found for this account and app.': '找不到该账号在此应用中的消息。',
+ 'The message cursor is not in this conversation. Refresh the list and try again.': '这条对话中没有该消息位置。请刷新列表后再试。',
+ 'Not Completion App': '这不是文本生成应用。',
+ 'App mode is invalid.': '应用模式无效。',
+ 'Only support workflow app.': '仅支持工作流应用。',
+ 'Function Suggested questions after answer disabled.': '回答后推荐问题功能未开启。',
+ 'App access denied.': '没有访问该应用的权限。',
+ 'Recommended app not found.': '找不到推荐应用。',
+ 'The app preview site is unavailable.': '应用预览站暂不可用。',
+ 'The app preview owner is unavailable.': '应用预览所有者暂不可用。',
+ 'the app is not allowed to be trial.': '该应用不能试用。',
+ 'The user has exceeded the trial app limit.': '已超过可试用的应用数量。',
+ 'Trial app feature is not enabled.': '试用应用功能未开启。',
+ 'Agent Knowledge Base was not found.': '找不到智能体知识库。',
+ 'Agent Knowledge Base resource was not found.': '找不到智能体知识库中的资源。',
+ 'Agent Knowledge Base operation is not available.': '智能体知识库操作暂不可用。',
+ 'Agent Knowledge Base is unavailable.': '智能体知识库暂不可用。',
+ 'Agent Knowledge Base request timed out.': '智能体知识库请求超时。',
+ 'Agent Knowledge Base request is invalid.': '智能体知识库请求无效。',
+ 'Agent Knowledge Base operation is not allowed.': '不允许执行该智能体知识库操作。',
+ 'Agent Knowledge Base operation conflicts with the current resource state.': '智能体知识库操作与当前资源状态冲突。',
+ 'Agent Knowledge Base request is too large.': '智能体知识库请求过大。',
+ 'Agent Knowledge Base request was rejected.': '智能体知识库请求被拒绝。',
+ 'Agent Knowledge Base request rate limit exceeded.': '智能体知识库请求过于频繁。',
+ 'Rate limit exceeded for downloading compliance report.': '下载合规报告过于频繁。',
+ 'The compliance document was not found.': '找不到该合规文档。',
+ 'Your current plan does not allow downloading this compliance document.': '当前方案不能下载该合规文档。',
+ 'A previous request is still being processed. Please try again shortly.': '上一条请求仍在处理,请稍后再试。',
+ 'We couldn\'t complete this request. Please try again. If the problem persists, contact support.': '这次请求没有完成。请重试;如果仍然失败,请联系管理员。',
+ 'This operation is temporarily unavailable. Please try again later.': '该操作暂时不可用,请稍后再试。',
+ 'Subscription builder not initialized': '订阅配置尚未初始化。',
+ 'Please fill in all required credentials': '请填写所有必填凭证。',
+ 'Subscription builder not found': '找不到订阅配置。',
+ 'SSO protocol is not supported.': '不支持该单点登录协议。',
+ 'Verifying email failed': '邮箱验证失败。',
+ 'Web Audio API is not supported in this browser': '当前浏览器不支持网页音频。',
+ 'Audio element not found': '找不到音频。',
+ 'Missing plugin metadata for GitHub update': '缺少用于 GitHub 更新的插件信息。',
+ 'Invalid email format': '邮箱格式不正确。',
+ 'tag name is empty': '标签名称不能为空。',
+}
+
+const ZH_PATTERNS: Array<{ pattern: RegExp, translate: (match: RegExpMatchArray) => string }> = [
+ {
+ pattern: /^File size exceeded\. ?(.*)$/,
+ translate: match => match[1] ? `文件超出大小限制。${match[1]}` : '文件超出大小限制。',
+ },
+ {
+ pattern: /^Audio size exceeded\. ?(.*)$/,
+ translate: match => match[1] ? `音频超出大小限制。${match[1]}` : '音频超出大小限制。',
+ },
+ {
+ pattern: /^Knowledge indexing estimate failed: ?(.*)$/,
+ translate: match => `知识库索引估算失败:${match[1]}`,
+ },
+ {
+ pattern: /^Create child chunk index failed: ?(.*)$/,
+ translate: match => `创建子分段索引失败:${match[1]}`,
+ },
+ {
+ pattern: /^Delete child chunk index failed: ?(.*)$/,
+ translate: match => `删除子分段索引失败:${match[1]}`,
+ },
+ {
+ pattern: /^Too many password reset emails have been sent\. Please try again in (.+) minutes\.?$/,
+ translate: match => `重置密码邮件发送过于频繁,请在 ${match[1]} 分钟后再试。`,
+ },
+ {
+ pattern: /^Too many email register emails have been sent\. Please try again in (.+) minutes\.?$/,
+ translate: match => `注册邮件发送过于频繁,请在 ${match[1]} 分钟后再试。`,
+ },
+ {
+ pattern: /^Too many email change emails have been sent\. Please try again in (.+) minutes\.?$/,
+ translate: match => `更换邮箱邮件发送过于频繁,请在 ${match[1]} 分钟后再试。`,
+ },
+ {
+ pattern: /^Too many owner transfer emails have been sent\. Please try again in (.+) minutes\.?$/,
+ translate: match => `转让所有者邮件发送过于频繁,请在 ${match[1]} 分钟后再试。`,
+ },
+ {
+ pattern: /^Too many login emails have been sent\. Please try again in (.+) minutes\.?$/,
+ translate: match => `登录邮件发送过于频繁,请在 ${match[1]} 分钟后再试。`,
+ },
+ {
+ pattern: /^Too many account deletion emails have been sent\. Please try again in (.+) minutes\.?$/,
+ translate: match => `注销账号邮件发送过于频繁,请在 ${match[1]} 分钟后再试。`,
+ },
+]
+
+function readLocale(): string {
+ try {
+ const language = getI18n()?.language
+ if (language)
+ return language
+ }
+ catch {
+ // i18next is not ready during the first paint.
+ }
+ if (typeof document === 'undefined')
+ return ''
+ return Cookies.get(LOCALE_COOKIE_NAME) ?? ''
+}
+
+export function isChineseLocale(locale?: string) {
+ return (locale ?? readLocale()).toLowerCase().startsWith('zh')
+}
+
+export function localizeSystemMessage(message: string, locale?: string) {
+ if (!isChineseLocale(locale))
+ return message
+ const normalized = message.replace(/\s+/g, ' ').trim()
+ const exact = ZH_MESSAGES[normalized]
+ if (exact)
+ return exact
+ for (const { pattern, translate } of ZH_PATTERNS) {
+ const match = pattern.exec(normalized)
+ if (match)
+ return translate(match)
+ }
+ return message
+}
diff --git a/demo-dify/dify/web/utils/official-link.ts b/demo-dify/dify/web/utils/official-link.ts
new file mode 100644
index 00000000..4482716d
--- /dev/null
+++ b/demo-dify/dify/web/utils/official-link.ts
@@ -0,0 +1,18 @@
+const OFFICIAL_HOST = /(^|\.)dify\.(ai|com)$/i
+
+export function isOfficialDifyUrl(value?: string | null): boolean {
+ const trimmed = value?.trim() ?? ''
+ if (!trimmed) return false
+
+ const mailto = trimmed.match(/^mailto:([^?]+)/i)
+ if (mailto) {
+ const host = mailto[1]?.split('@').pop() ?? ''
+ return OFFICIAL_HOST.test(host)
+ }
+
+ try {
+ return OFFICIAL_HOST.test(new URL(trimmed).hostname)
+ } catch {
+ return false
+ }
+}
diff --git a/demo-dify/dify/web/utils/visible-author.ts b/demo-dify/dify/web/utils/visible-author.ts
new file mode 100644
index 00000000..4f78830e
--- /dev/null
+++ b/demo-dify/dify/web/utils/visible-author.ts
@@ -0,0 +1,8 @@
+// Official plugin metadata still uses the upstream product name as the author.
+// Local deployments hide that label and keep other authors visible.
+export function visibleAuthorName(value?: string | null): string {
+ const text = value?.trim() ?? ''
+ if (!text) return ''
+ if (text.toLowerCase() === 'dify' || text.toLowerCase().startsWith('dify ')) return ''
+ return text
+}