Skip to content

Commit

Permalink
fix: assistants load function for trending
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin committed Dec 30, 2024
1 parent f1b5bfd commit 3239b69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/routes/assistants/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ export const load = async ({ url, locals }) => {
}
}

// fetch the top assistants sorted by user count from biggest to smallest. filter by model too if modelId is provided or query if query is provided
// fetch the top assistants sorted by user count from biggest to smallest.
// filter by model too if modelId is provided or query if query is provided
// if trending only show assistants that have been used by more than 5 users
const filter: Filter<Assistant> = {
...(modelId && { modelId }),
...(user && { createdById: user._id }),
...(query && { searchTokens: { $all: generateQueryTokens(query) } }),
...(sort === SortKey.TRENDING && { userCount: { $gte: 5 } }),
...shouldBeFeatured,
};
const assistants = await Database.getInstance()
Expand Down

0 comments on commit 3239b69

Please sign in to comment.