-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(resend): added env variablers #673
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
/home/runner/work/quivr/quivr/backend/core/models/brains_subscription_invitations.py: LOGAF Level 3 The code is generally good, but there are a few areas for potential improvement:
Here's an example of how you might refactor the def resend_invitation_email(self):
brains_settings = BrainSettings() # pyright: ignore reportPrivateUsage=none
resend.api_key = brains_settings.resend_api_key
brain_url = self.get_brain_url()
html_body = f"""
<p>This brain has been shared with you by {self.inviter_email}.</p>
<p><a href='{brain_url}'>Click here</a> to access your brain.</p>
"""
try:
r = resend.Emails.send(
{
"from": brains_settings.resend_email_address,
"to": self.email,
"subject": "Quivr - Brain Shared With You",
"html": html_body,
}
)
logger.info("Resend response: %s", r)
except resend.ResendAPIError as e:
logger.error(f"Error sending email: {e}")
return
return r /home/runner/work/quivr/quivr/backend/core/models/settings.py: LOGAF Level 2 The code functions, but there are significant issues that need attention:
Here's an example of how you might refactor the from pydantic import BaseSettings, Field
class BrainSettings(BaseSettings):
openai_api_key: str = Field(..., env="OPENAI_API_KEY")
anthropic_api_key: str = Field(..., env="ANTHROPIC_API_KEY")
supabase_url: str = Field(..., env="SUPABASE_URL")
supabase_service_key: str = Field(..., env="SUPABASE_SERVICE_KEY")
resend_api_key: str = Field(..., env="RESEND_API_KEY")
resend_email_address: str = Field(..., env="RESEND_EMAIL_ADDRESS") In this example, the 🔒🔁🔍 Powered by Code Review GPT |
* feat(resend): added env variablers * fix(resend): made optional
Added resend as Brain settings and updated emails so we can change it