From fd6f28fa57cf45b74f060633d4894fae1cca14ac Mon Sep 17 00:00:00 2001 From: Swifty Date: Fri, 10 Jan 2025 13:02:53 +0100 Subject: [PATCH] feature(platform): Implement library add, update, remove, archive functionality (#9218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Changes 🏗️ 1. **Core Features**: - Add agents to the user's library. - Update library agents (auto-update, favorite, archive, delete). - Paginate library agents and presets. - Execute graphs using presets. 2. **Refactoring**: - Replaced `UserAgent` with `LibraryAgent`. - Separated routes for agents and presets. 3. **Schema Changes**: - Added `LibraryAgent` table with fields like `isArchived`, `isDeleted`, etc. - Soft delete functionality for `AgentPreset`. 4. **Testing**: - Updated tests for `LibraryAgent` operations. - Added edge case tests for deletion, archiving, and pagination. 5. **Database Migrations**: - Migration to drop `UserAgent` and add `LibraryAgent`. - Added fields for soft deletion and auto-update. Note this includes the changes from the following PR's to avoid merge conflicts with them: #9179 #9211 --------- Co-authored-by: Reinier van der Leer --- autogpt_platform/backend/backend/server/v2/library/db.py | 2 -- autogpt_platform/backend/backend/server/v2/library/model.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/autogpt_platform/backend/backend/server/v2/library/db.py b/autogpt_platform/backend/backend/server/v2/library/db.py index 97313ccdb009..ba2b2a235acd 100644 --- a/autogpt_platform/backend/backend/server/v2/library/db.py +++ b/autogpt_platform/backend/backend/server/v2/library/db.py @@ -294,8 +294,6 @@ async def create_or_update_preset( preset_id: str | None = None, ) -> backend.server.v2.library.model.LibraryAgentPreset: try: - - logger.info(f"DB Creating Preset with inputs: {preset.inputs}") new_preset = await prisma.models.AgentPreset.prisma().upsert( where={ "id": preset_id if preset_id else "", diff --git a/autogpt_platform/backend/backend/server/v2/library/model.py b/autogpt_platform/backend/backend/server/v2/library/model.py index 86e42f8a07a8..43f4f11aa618 100644 --- a/autogpt_platform/backend/backend/server/v2/library/model.py +++ b/autogpt_platform/backend/backend/server/v2/library/model.py @@ -76,6 +76,7 @@ class LibraryAgentPreset(pydantic.BaseModel): description: str is_active: bool + inputs: dict[str, typing.Union[backend.data.block.BlockInput, typing.Any]] @staticmethod