Update Resend SDK and resend api url in configuration. (#1963)

This commit is contained in:
Benjamin 2024-01-10 18:15:02 +08:00 committed by GitHub
parent 9dee9e7ade
commit 1fe4e3afde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 2 deletions

View File

@ -86,6 +86,7 @@ MULTIMODAL_SEND_IMAGE_FORMAT=base64
MAIL_TYPE= MAIL_TYPE=
MAIL_DEFAULT_SEND_FROM=no-reply <no-reply@dify.ai> MAIL_DEFAULT_SEND_FROM=no-reply <no-reply@dify.ai>
RESEND_API_KEY= RESEND_API_KEY=
RESEND_API_URL=https://api.resend.com
# Sentry configuration # Sentry configuration
SENTRY_DSN= SENTRY_DSN=

View File

@ -219,6 +219,7 @@ class Config:
self.MAIL_TYPE = get_env('MAIL_TYPE') self.MAIL_TYPE = get_env('MAIL_TYPE')
self.MAIL_DEFAULT_SEND_FROM = get_env('MAIL_DEFAULT_SEND_FROM') self.MAIL_DEFAULT_SEND_FROM = get_env('MAIL_DEFAULT_SEND_FROM')
self.RESEND_API_KEY = get_env('RESEND_API_KEY') self.RESEND_API_KEY = get_env('RESEND_API_KEY')
self.RESEND_API_URL = get_env('RESEND_API_URL')
# ------------------------ # ------------------------
# Workpace Configurations. # Workpace Configurations.

View File

@ -22,6 +22,11 @@ class Mail:
if not api_key: if not api_key:
raise ValueError('RESEND_API_KEY is not set') raise ValueError('RESEND_API_KEY is not set')
api_url = app.config.get('RESEND_API_URL')
if not api_url:
raise ValueError('RESEND_API_URL is not set')
resend.api_url = api_url
resend.api_key = api_key resend.api_key = api_key
self._client = resend.Emails self._client = resend.Emails
else: else:

View File

@ -34,7 +34,7 @@ openpyxl==3.1.2
chardet~=5.1.0 chardet~=5.1.0
docx2txt==0.8 docx2txt==0.8
pypdfium2==4.16.0 pypdfium2==4.16.0
resend~=0.5.1 resend~=0.7.0
pyjwt~=2.6.0 pyjwt~=2.6.0
anthropic~=0.7.7 anthropic~=0.7.7
newspaper3k==0.2.8 newspaper3k==0.2.8

View File

@ -111,6 +111,7 @@ services:
MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)' MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
# the api-key for resend (https://resend.com) # the api-key for resend (https://resend.com)
RESEND_API_KEY: '' RESEND_API_KEY: ''
RESEND_API_URL: https://api.resend.com
# The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled. # The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
SENTRY_DSN: '' SENTRY_DSN: ''
# The sample rate for Sentry events. Default: `1.0` # The sample rate for Sentry events. Default: `1.0`
@ -191,6 +192,7 @@ services:
MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)' MAIL_DEFAULT_SEND_FROM: 'YOUR EMAIL FROM (eg: no-reply <no-reply@dify.ai>)'
# the api-key for resend (https://resend.com) # the api-key for resend (https://resend.com)
RESEND_API_KEY: '' RESEND_API_KEY: ''
RESEND_API_URL: https://api.resend.com
depends_on: depends_on:
- db - db
- redis - redis