diff --git a/api/libs/email_i18n.py b/api/libs/email_i18n.py index 42cf119104..ff74ccbe8e 100644 --- a/api/libs/email_i18n.py +++ b/api/libs/email_i18n.py @@ -42,6 +42,8 @@ class EmailType(StrEnum): TRIGGER_EVENTS_LIMIT_PROFESSIONAL = auto() TRIGGER_EVENTS_USAGE_WARNING_SANDBOX = auto() TRIGGER_EVENTS_USAGE_WARNING_PROFESSIONAL = auto() + API_RATE_LIMIT_LIMIT_SANDBOX = auto() + API_RATE_LIMIT_WARNING_SANDBOX = auto() class EmailLanguage(StrEnum): @@ -497,6 +499,30 @@ def create_default_email_config() -> EmailI18nConfig: branded_template_path="without-brand/trigger_events_usage_warning_template_zh-CN.html", ), }, + EmailType.API_RATE_LIMIT_LIMIT_SANDBOX: { + EmailLanguage.EN_US: EmailTemplate( + subject="You’ve reached your API Rate Limit", + template_path="api_rate_limit_limit_template_en-US.html", + branded_template_path="without-brand/api_rate_limit_limit_template_en-US.html", + ), + EmailLanguage.ZH_HANS: EmailTemplate( + subject="您的 API 速率额度已用尽", + template_path="api_rate_limit_limit_template_zh-CN.html", + branded_template_path="without-brand/api_rate_limit_limit_template_zh-CN.html", + ), + }, + EmailType.API_RATE_LIMIT_WARNING_SANDBOX: { + EmailLanguage.EN_US: EmailTemplate( + subject="You’re nearing your API Rate Limit", + template_path="api_rate_limit_warning_template_en-US.html", + branded_template_path="without-brand/api_rate_limit_warning_template_en-US.html", + ), + EmailLanguage.ZH_HANS: EmailTemplate( + subject="您的 API 速率额度接近上限", + template_path="api_rate_limit_warning_template_zh-CN.html", + branded_template_path="without-brand/api_rate_limit_warning_template_zh-CN.html", + ), + }, EmailType.EMAIL_REGISTER: { EmailLanguage.EN_US: EmailTemplate( subject="Register Your {application_title} Account", diff --git a/api/templates/api_rate_limit_limit_template_en-US.html b/api/templates/api_rate_limit_limit_template_en-US.html new file mode 100644 index 0000000000..c1c129ad0a --- /dev/null +++ b/api/templates/api_rate_limit_limit_template_en-US.html @@ -0,0 +1,133 @@ + + + +
+ + + + +
+ + Your workspace {{workspaceName}} has used all available Monthly API Rate Limit for the + {{planName}} Plan (limit: {{planLimit}}). +
++ As a result, API access has been temporarily paused. +
++ To continue using the Dify API and unlock a higher limit, please upgrade to a paid plan. +
++ Monthly API Rate Limit for the {{planName}} Plan will reset on {{resetDate}}. +
+
+ + 您的工作区 {{workspaceName}} 已用完 Monthly API Rate Limit,触及 + {{planName}} 计划(上限:{{planLimit}})。 +
++ 因此,API 访问已被暂时暂停。 +
++ 若要继续使用 Dify API 并解锁更高额度,请升级到付费套餐。 +
++ {{planName}} 计划的 Monthly API Rate Limit 将于 {{resetDate}} 重置。 +
+
+ + Your workspace {{workspaceName}} has used 80% of its Monthly API Rate Limit for the + {{planName}} Plan (limit: {{planLimit}}). +
++ Once the limit is reached, API access will be temporarily paused until the next monthly reset. +
++ To avoid service interruptions and ensure continued access to the Dify API, please consider upgrading your plan for a higher API + Rate Limit. +
++ Monthly API Rate Limit for the {{planName}} Plan will reset on {{resetDate}}. +
+
+ + 您的工作区 {{workspaceName}} 已使用 80% 的 Monthly API Rate Limit,触及 + {{planName}} 计划(上限:{{planLimit}})。 +
++ 一旦达到上限,API 访问将暂停,直至下一个月度重置。 +
++ 为避免服务中断并持续访问 Dify API,请考虑升级到额度更高的套餐。 +
++ {{planName}} 计划的 Monthly API Rate Limit 将于 {{resetDate}} 重置。 +
++ Your workspace {{workspaceName}} has used all available Monthly API Rate Limit for the + {{planName}} Plan (limit: {{planLimit}}). +
++ As a result, API access has been temporarily paused. +
++ To continue using the Dify API and unlock a higher limit, please upgrade to a paid plan. +
++ Monthly API Rate Limit for the {{planName}} Plan will reset on {{resetDate}}. +
++ 您的工作区 {{workspaceName}} 已用完 Monthly API Rate Limit,触及 + {{planName}} 计划(上限:{{planLimit}})。 +
++ 因此,API 访问已被暂时暂停。 +
++ 若要继续使用 Dify API 并解锁更高额度,请升级到付费套餐。 +
++ {{planName}} 计划的 Monthly API Rate Limit 将于 {{resetDate}} 重置。 +
++ Your workspace {{workspaceName}} has used 80% of its Monthly API Rate Limit for the + {{planName}} Plan (limit: {{planLimit}}). +
++ Once the limit is reached, API access will be temporarily paused until the next monthly reset. +
++ To avoid service interruptions and ensure continued access to the Dify API, please consider upgrading your plan for a higher API + Rate Limit. +
++ Monthly API Rate Limit for the {{planName}} Plan will reset on {{resetDate}}. +
++ 您的工作区 {{workspaceName}} 已使用 80% 的 Monthly API Rate Limit,触及 + {{planName}} 计划(上限:{{planLimit}})。 +
++ 一旦达到上限,API 访问将暂停,直至下一个月度重置。 +
++ 为避免服务中断并持续访问 Dify API,请考虑升级到额度更高的套餐。 +
++ {{planName}} 计划的 Monthly API Rate Limit 将于 {{resetDate}} 重置。 +
+