Skip to content

Commit

Permalink
Fix add_store_agent_to_library
Browse files Browse the repository at this point in the history
  • Loading branch information
kcze committed Jan 11, 2025
1 parent 887ef58 commit 5ee23cc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions autogpt_platform/backend/backend/server/v2/library/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,13 @@ async def add_store_agent_to_library(
logger.debug(
f"User {user_id} already has agent {agent.id} in their library"
)
return existing_user_agent.Agent
return backend.data.graph.Graph(
id=agent.id,
version=agent.version,
is_active=agent.isActive,
name=agent.name or "",
description=agent.description or "",
)

# Create LibraryAgent entry
library_agent = await prisma.models.LibraryAgent.prisma().create(
Expand All @@ -277,7 +283,13 @@ async def add_store_agent_to_library(
)
)
logger.debug(f"Added agent {agent.id} to library for user {user_id}")
return library_agent.Agent
return backend.data.graph.Graph(
id=library_agent.agentId,
version=library_agent.agentVersion,
is_active=agent.isActive,
name=agent.name or "",
description=agent.description or "",
)

except backend.server.v2.store.exceptions.AgentNotFoundError:
raise
Expand Down

0 comments on commit 5ee23cc

Please sign in to comment.