Skip to content

Commit 0b2a549

Browse files
authored
Bring back featured check on top assistants page (#765)
1 parent b954b26 commit 0b2a549

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

src/lib/server/database.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ client.on("open", () => {
7474
sessions.createIndex({ sessionId: 1 }, { unique: true }).catch(console.error);
7575
assistants.createIndex({ createdBy: 1 }).catch(console.error);
7676
assistants.createIndex({ userCount: 1 }).catch(console.error);
77+
assistants.createIndex({ featured: 1 }).catch(console.error);
7778
reports.createIndex({ assistantId: 1 }).catch(console.error);
7879
});

src/lib/types/Assistant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export interface Assistant extends Timestamps {
1212
modelId: string;
1313
exampleInputs: string[];
1414
preprompt: string;
15-
1615
userCount?: number;
16+
featured?: boolean;
1717
}

src/routes/assistants/+page.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const load = async ({ url }) => {
1313

1414
// fetch the top 10 assistants sorted by user count from biggest to smallest, filter out all assistants with only 1 users. filter by model too if modelId is provided
1515
const assistants = await collections.assistants
16-
.find({ userCount: { $gt: 1 }, modelId: modelId ?? { $exists: true } })
16+
.find({ userCount: { $gt: 1 }, modelId: modelId ?? { $exists: true }, featured: true })
1717
.sort({ userCount: -1 })
1818
.limit(10)
1919
.toArray();

src/routes/settings/assistants/new/+page.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const actions: Actions = {
100100
createdAt: new Date(),
101101
updatedAt: new Date(),
102102
userCount: 1,
103+
featured: false,
103104
});
104105

105106
// add insertedId to user settings

0 commit comments

Comments
 (0)