Fix agent check

This commit is contained in:
Krzysztof Czerwinski
2025-01-08 17:26:14 +01:00
parent 725b38425a
commit 56affddad7
2 changed files with 9 additions and 5 deletions

View File

@@ -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,
}
)

View File

@@ -45,14 +45,18 @@ export const AgentInfo: React.FC<AgentInfoProps> = ({
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 () => {