Skip to content
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

fix(backend): fix get agent db function #9350

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
remove raises and delattr on get agent db function
Abhi1992002 committed Jan 28, 2025
commit 5a13db8054c2eed741abf3b5de6a9f93013d87d5
14 changes: 5 additions & 9 deletions autogpt_platform/backend/backend/server/v2/store/db.py
Original file line number Diff line number Diff line change
@@ -794,7 +794,7 @@ async def get_my_agents(

async def get_agent(
store_listing_version_id: str, version_id: Optional[int]
) -> GraphModel:
) -> Optional[GraphModel]:
"""Get agent using the version ID and store listing version ID."""
try:
store_listing_version = (
@@ -804,10 +804,8 @@ async def get_agent(
)

if not store_listing_version or not store_listing_version.Agent:
raise fastapi.HTTPException(
status_code=404,
detail=f"Store listing version {store_listing_version_id} not found",
)
logger.error(f"Store listing version {store_listing_version_id} not found");
return None

agent = store_listing_version.Agent

@@ -816,14 +814,12 @@ async def get_agent(
)

if not graph:
raise fastapi.HTTPException(
status_code=404, detail=f"Agent {agent.id} not found"
)
logger.error(f"Agent {agent.id} not found");
return None

graph.version = 1
graph.is_template = False
graph.is_active = True
delattr(graph, "user_id")

return graph