feature(platform): Implement library add, update, remove, archive functionality (#9218)
### 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 <pwuts@agpt.co>
This commit is contained in:
parent
4b17cc9963
commit
fd6f28fa57
|
@ -294,8 +294,6 @@ async def create_or_update_preset(
|
||||||
preset_id: str | None = None,
|
preset_id: str | None = None,
|
||||||
) -> backend.server.v2.library.model.LibraryAgentPreset:
|
) -> backend.server.v2.library.model.LibraryAgentPreset:
|
||||||
try:
|
try:
|
||||||
|
|
||||||
logger.info(f"DB Creating Preset with inputs: {preset.inputs}")
|
|
||||||
new_preset = await prisma.models.AgentPreset.prisma().upsert(
|
new_preset = await prisma.models.AgentPreset.prisma().upsert(
|
||||||
where={
|
where={
|
||||||
"id": preset_id if preset_id else "",
|
"id": preset_id if preset_id else "",
|
||||||
|
|
|
@ -76,6 +76,7 @@ class LibraryAgentPreset(pydantic.BaseModel):
|
||||||
description: str
|
description: str
|
||||||
|
|
||||||
is_active: bool
|
is_active: bool
|
||||||
|
|
||||||
inputs: dict[str, typing.Union[backend.data.block.BlockInput, typing.Any]]
|
inputs: dict[str, typing.Union[backend.data.block.BlockInput, typing.Any]]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue