AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): Unbreak `UserIntegrations` parsing for missing `None` values (#9994)
Reinier van der Leer73ee6e272a29
diff --git a/autogpt_platform/backend/backend/data/model.py b/autogpt_platform/backend/backend/data/model.pyindex 8ee88e726a..9592e6abc6 100644--- a/autogpt_platform/backend/backend/data/model.py+++ b/autogpt_platform/backend/backend/data/model.py@@ -189,7 +189,7 @@ def SchemaField(class _BaseCredentials(BaseModel):id: str = Field(default_factory=lambda: str(uuid4()))provider: str- title: Optional[str]+ title: Optional[str] = None@field_serializer("*")def dump_secret_strings(value: Any, _info):@@ -200,13 +200,13 @@ class _BaseCredentials(BaseModel):class OAuth2Credentials(_BaseCredentials):type: Literal["oauth2"] = "oauth2"- username: Optional[str]+ username: Optional[str] = None"""Username of the third-party service user that these credentials belong to"""access_token: SecretStr- access_token_expires_at: Optional[int]+ access_token_expires_at: Optional[int] = None"""Unix timestamp (seconds) indicating when the access token expires (if at all)"""- refresh_token: Optional[SecretStr]- refresh_token_expires_at: Optional[int]+ refresh_token: Optional[SecretStr] = None+ refresh_token_expires_at: Optional[int] = None"""Unix timestamp (seconds) indicating when the refresh token expires (if at all)"""scopes: list[str]metadata: dict[str, Any] = Field(default_factory=dict)diff --git a/autogpt_platform/backend/backend/data/user.py b/autogpt_platform/backend/backend/data/user.pyindex 31e4c46b51..6e92203769 100644--- a/autogpt_platform/backend/backend/data/user.py+++ b/autogpt_platform/backend/backend/data/user.py@@ -124,7 +124,7 @@ async def get_user_integrations(user_id: str) -> UserIntegrations:async def update_user_integrations(user_id: str, data: UserIntegrations):- encrypted_data = JSONCryptor().encrypt(data.model_dump())+ encrypted_data = JSONCryptor().encrypt(data.model_dump(exclude_none=True))await User.prisma().update(where={"id": user_id},data={"integrations": encrypted_data},