fix(platform): Restore See runs button on marketplace listing page (#9970)

This makes button on the marketplace listing page show `See runs` if
user has an agent in the library.

### Changes 🏗️

- Remove `/` from the related endpoint
- Use `active_version_id` instead of `store_listing_version_id` to check
for the library agent
- Fix `get_store_agent_details`

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - Log in and pick an agent that has never been in user library
  - [x] Button says `Add to library`
  - Add the agent and return to the listing page
  - [x] Button says `See runs`
  - Remove agent from library
  - [x] Button says `Add to library`
  - Add agent again
  - [x] Button says `See runs`

---------

Co-authored-by: Zamil Majdy <zamil.majdy@agpt.co>
This commit is contained in:
Krzysztof Czerwinski
2025-05-28 09:15:42 +02:00
committed by GitHub
parent 35a5755958
commit b91b026164
3 changed files with 8 additions and 3 deletions

View File

@@ -86,7 +86,7 @@ async def get_library_agent(
@router.get(
"/marketplace/{store_listing_version_id}/",
"/marketplace/{store_listing_version_id}",
tags=["store, library"],
response_model=library_model.LibraryAgent | None,
)

View File

@@ -146,11 +146,16 @@ async def get_store_agent_details(
f"Agent {username}/{agent_name} not found"
)
profile = await prisma.models.Profile.prisma().find_first(
where={"username": username}
)
user_id = profile.userId if profile else None
# Retrieve StoreListing to get active_version_id and has_approved_version
store_listing = await prisma.models.StoreListing.prisma().find_first(
where=prisma.types.StoreListingWhereInput(
slug=agent_name,
owningUserId=username, # Direct equality check instead of 'has'
owningUserId=user_id or "",
),
include={"ActiveVersion": True},
)

View File

@@ -47,7 +47,7 @@ export default async function Page({
});
const libraryAgent = user
? await api
.getLibraryAgentByStoreListingVersionID(agent.store_listing_version_id)
.getLibraryAgentByStoreListingVersionID(agent.active_version_id || "")
.catch((error) => {
console.error("Failed to fetch library agent:", error);
return null;