From d3d3868b4a04ea4846d8eae61d3eddfcf8af67d1 Mon Sep 17 00:00:00 2001 From: lyzno1 Date: Wed, 12 Nov 2025 12:54:29 +0800 Subject: [PATCH] feat: add trigger events usage warning email template --- api/libs/email_i18n.py | 26 ++++ ...r_events_usage_warning_template_en-US.html | 134 ++++++++++++++++++ ...r_events_usage_warning_template_zh-CN.html | 133 +++++++++++++++++ ...r_events_usage_warning_template_en-US.html | 127 +++++++++++++++++ ...r_events_usage_warning_template_zh-CN.html | 126 ++++++++++++++++ 5 files changed, 546 insertions(+) create mode 100644 api/templates/trigger_events_usage_warning_template_en-US.html create mode 100644 api/templates/trigger_events_usage_warning_template_zh-CN.html create mode 100644 api/templates/without-brand/trigger_events_usage_warning_template_en-US.html create mode 100644 api/templates/without-brand/trigger_events_usage_warning_template_zh-CN.html diff --git a/api/libs/email_i18n.py b/api/libs/email_i18n.py index 25f771c848..42cf119104 100644 --- a/api/libs/email_i18n.py +++ b/api/libs/email_i18n.py @@ -40,6 +40,8 @@ class EmailType(StrEnum): RESET_PASSWORD_WHEN_ACCOUNT_NOT_EXIST_NO_REGISTER = auto() TRIGGER_EVENTS_LIMIT_SANDBOX = auto() TRIGGER_EVENTS_LIMIT_PROFESSIONAL = auto() + TRIGGER_EVENTS_USAGE_WARNING_SANDBOX = auto() + TRIGGER_EVENTS_USAGE_WARNING_PROFESSIONAL = auto() class EmailLanguage(StrEnum): @@ -471,6 +473,30 @@ def create_default_email_config() -> EmailI18nConfig: branded_template_path="without-brand/trigger_events_limit_template_zh-CN.html", ), }, + EmailType.TRIGGER_EVENTS_USAGE_WARNING_SANDBOX: { + EmailLanguage.EN_US: EmailTemplate( + subject="You’re nearing your Sandbox Trigger Events limit", + template_path="trigger_events_usage_warning_template_en-US.html", + branded_template_path="without-brand/trigger_events_usage_warning_template_en-US.html", + ), + EmailLanguage.ZH_HANS: EmailTemplate( + subject="您的 Sandbox 触发事件额度接近上限", + template_path="trigger_events_usage_warning_template_zh-CN.html", + branded_template_path="without-brand/trigger_events_usage_warning_template_zh-CN.html", + ), + }, + EmailType.TRIGGER_EVENTS_USAGE_WARNING_PROFESSIONAL: { + EmailLanguage.EN_US: EmailTemplate( + subject="You’re nearing your Monthly Trigger Events limit", + template_path="trigger_events_usage_warning_template_en-US.html", + branded_template_path="without-brand/trigger_events_usage_warning_template_en-US.html", + ), + EmailLanguage.ZH_HANS: EmailTemplate( + subject="您的月度触发事件额度接近上限", + template_path="trigger_events_usage_warning_template_zh-CN.html", + branded_template_path="without-brand/trigger_events_usage_warning_template_zh-CN.html", + ), + }, EmailType.EMAIL_REGISTER: { EmailLanguage.EN_US: EmailTemplate( subject="Register Your {application_title} Account", diff --git a/api/templates/trigger_events_usage_warning_template_en-US.html b/api/templates/trigger_events_usage_warning_template_en-US.html new file mode 100644 index 0000000000..86517551fb --- /dev/null +++ b/api/templates/trigger_events_usage_warning_template_en-US.html @@ -0,0 +1,134 @@ + + + + + + + + +
+
+ Dify Logo +
+
+

You’re nearing your Trigger Events limit

+
+

+ Your workspace {{workspaceName}} has used {{usagePercent}} of its + {{usageScope}} for the {{planName}} Plan (limit: {{planLimit}}). +

+

+ Once the limit is reached, workflows triggered by {{triggerSources}} events will be temporarily + paused. +

+

+ {{upgradeHint}} +

+
+ {{ctaLabel}} +

+ Trigger Events for the {{planName}} Plan {{resetDescription}}. +

+
+
+ + + diff --git a/api/templates/trigger_events_usage_warning_template_zh-CN.html b/api/templates/trigger_events_usage_warning_template_zh-CN.html new file mode 100644 index 0000000000..f4ac92ce9c --- /dev/null +++ b/api/templates/trigger_events_usage_warning_template_zh-CN.html @@ -0,0 +1,133 @@ + + + + + + + + +
+
+ Dify Logo +
+
+

您的触发事件额度接近上限

+
+

+ 您的工作区 {{workspaceName}} 已使用 {{usagePercent}} 的 + {{usageScope}},触及 {{planName}} 计划(上限:{{planLimit}})。 +

+

+ 一旦达到上限,由 {{triggerSources}} 触发的工作流将被暂时暂停。 +

+

+ {{upgradeHint}} +

+
+ {{ctaLabel}} +

+ {{planName}} 计划的触发事件额度{{resetDescription}}。 +

+
+
+ + + diff --git a/api/templates/without-brand/trigger_events_usage_warning_template_en-US.html b/api/templates/without-brand/trigger_events_usage_warning_template_en-US.html new file mode 100644 index 0000000000..3d2d29a24f --- /dev/null +++ b/api/templates/without-brand/trigger_events_usage_warning_template_en-US.html @@ -0,0 +1,127 @@ + + + + + + + + +
+
+
+

You’re nearing your Trigger Events limit

+
+

+ Your workspace {{workspaceName}} has used {{usagePercent}} of its + {{usageScope}} for the {{planName}} Plan (limit: {{planLimit}}). +

+

+ Once the limit is reached, workflows triggered by {{triggerSources}} events will be temporarily + paused. +

+

+ {{upgradeHint}} +

+
+ {{ctaLabel}} +

+ Trigger Events for the {{planName}} Plan {{resetDescription}}. +

+
+
+ + + diff --git a/api/templates/without-brand/trigger_events_usage_warning_template_zh-CN.html b/api/templates/without-brand/trigger_events_usage_warning_template_zh-CN.html new file mode 100644 index 0000000000..4259aeb15e --- /dev/null +++ b/api/templates/without-brand/trigger_events_usage_warning_template_zh-CN.html @@ -0,0 +1,126 @@ + + + + + + + + +
+
+
+

您的触发事件额度接近上限

+
+

+ 您的工作区 {{workspaceName}} 已使用 {{usagePercent}} 的 + {{usageScope}},触及 {{planName}} 计划(上限:{{planLimit}})。 +

+

+ 一旦达到上限,由 {{triggerSources}} 触发的工作流将被暂时暂停。 +

+

+ {{upgradeHint}} +

+
+ {{ctaLabel}} +

+ {{planName}} 计划的触发事件额度{{resetDescription}}。 +

+
+
+ + +