Compare commits

...

2 Commits

5 changed files with 31 additions and 3 deletions

View File

@@ -105,6 +105,7 @@ def library_agent_include(
"""
result: prisma.types.LibraryAgentInclude = {
"Creator": True, # Always needed for creator info
"StoreListingVersion": True, # Always needed for marketplace metadata
}
# Build AgentGraph include based on requested options

View File

@@ -714,6 +714,7 @@ async def add_store_agent_to_library(
"graphVersionId": {"id": graph.id, "version": graph.version}
}
},
"StoreListingVersion": {"connect": {"id": store_listing_version_id}},
"isCreatedByUser": False,
},
include=library_agent_include(

View File

@@ -116,6 +116,17 @@ class LibraryAgent(pydantic.BaseModel):
# Hard-coded to True until a method to check is implemented
is_latest_version = True
# Use marketplace name and description if available (for downloaded agents)
name = graph.name
description = graph.description
instructions = graph.instructions
if agent.StoreListingVersion:
name = agent.StoreListingVersion.name
description = agent.StoreListingVersion.description
# Use marketplace instructions if available, otherwise fall back to graph instructions
if agent.StoreListingVersion.instructions:
instructions = agent.StoreListingVersion.instructions
return LibraryAgent(
id=agent.id,
graph_id=agent.agentGraphId,
@@ -125,9 +136,9 @@ class LibraryAgent(pydantic.BaseModel):
creator_image_url=creator_image_url,
status=status,
updated_at=updated_at,
name=graph.name,
description=graph.description,
instructions=graph.instructions,
name=name,
description=description,
instructions=instructions,
input_schema=graph.input_schema,
output_schema=graph.output_schema,
credentials_input_schema=(

View File

@@ -0,0 +1,8 @@
-- AlterTable
ALTER TABLE "LibraryAgent" ADD COLUMN "storeListingVersionId" TEXT;
-- CreateIndex
CREATE INDEX "LibraryAgent_storeListingVersionId_idx" ON "LibraryAgent"("storeListingVersionId");
-- AddForeignKey
ALTER TABLE "LibraryAgent" ADD CONSTRAINT "LibraryAgent_storeListingVersionId_fkey" FOREIGN KEY ("storeListingVersionId") REFERENCES "StoreListingVersion"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@@ -258,6 +258,9 @@ model LibraryAgent {
creatorId String?
Creator Profile? @relation(fields: [creatorId], references: [id])
storeListingVersionId String?
StoreListingVersion StoreListingVersion? @relation(fields: [storeListingVersionId], references: [id])
useGraphIsActiveVersion Boolean @default(false)
isFavorite Boolean @default(false)
@@ -268,6 +271,7 @@ model LibraryAgent {
@@unique([userId, agentGraphId, agentGraphVersion])
@@index([agentGraphId, agentGraphVersion])
@@index([creatorId])
@@index([storeListingVersionId])
}
////////////////////////////////////////////////////////////
@@ -834,6 +838,9 @@ model StoreListingVersion {
// Reviews for this specific version
Reviews StoreListingReview[]
// LibraryAgents that reference this version
LibraryAgents LibraryAgent[]
@@unique([storeListingId, version])
@@index([storeListingId, submissionStatus, isAvailable])
@@index([submissionStatus])