diff --git a/autogpt_platform/backend/backend/server/v2/library/db.py b/autogpt_platform/backend/backend/server/v2/library/db.py index 2b6ad1fdfb..f097160581 100644 --- a/autogpt_platform/backend/backend/server/v2/library/db.py +++ b/autogpt_platform/backend/backend/server/v2/library/db.py @@ -124,11 +124,11 @@ async def get_library_agent( agent = store_listing_version.Agent # Check if user already has this agent - existing_user_agent = await prisma.models.UserAgent.prisma().find_first( + existing_user_agent = await prisma.models.AgentGraph.prisma().find_first( where={ "userId": user_id, - "agentId": agent.id, - "agentVersion": agent.version, + "id": agent.id, + "version": agent.version, } ) diff --git a/autogpt_platform/frontend/src/components/agptui/AgentInfo.tsx b/autogpt_platform/frontend/src/components/agptui/AgentInfo.tsx index d003cbf710..bd271a61f7 100644 --- a/autogpt_platform/frontend/src/components/agptui/AgentInfo.tsx +++ b/autogpt_platform/frontend/src/components/agptui/AgentInfo.tsx @@ -45,14 +45,18 @@ export const AgentInfo: React.FC = ({ const [processing, setProcessing] = React.useState(false); React.useEffect(() => { - (async () => { + console.log("Fetching library agent..."); + const fetchAgent = async () => { try { + console.log("Trying..."); const agent = await api.getUserLibraryAgent(storeListingVersionId); setAgent(agent); + console.log("Fetched agent:", agent); } catch (error) { console.error("Failed to fetch library agent:", error); } - })(); + }; + fetchAgent(); }, [api, storeListingVersionId]); const handleAddToLibrary = React.useCallback(async () => {