nsarrazin HF staff commited on
Commit
0b2a549
1 Parent(s): b954b26

Bring back featured check on top assistants page (#765)

Browse files
src/lib/server/database.ts CHANGED
@@ -74,5 +74,6 @@ client.on("open", () => {
74
  sessions.createIndex({ sessionId: 1 }, { unique: true }).catch(console.error);
75
  assistants.createIndex({ createdBy: 1 }).catch(console.error);
76
  assistants.createIndex({ userCount: 1 }).catch(console.error);
 
77
  reports.createIndex({ assistantId: 1 }).catch(console.error);
78
  });
 
74
  sessions.createIndex({ sessionId: 1 }, { unique: true }).catch(console.error);
75
  assistants.createIndex({ createdBy: 1 }).catch(console.error);
76
  assistants.createIndex({ userCount: 1 }).catch(console.error);
77
+ assistants.createIndex({ featured: 1 }).catch(console.error);
78
  reports.createIndex({ assistantId: 1 }).catch(console.error);
79
  });
src/lib/types/Assistant.ts CHANGED
@@ -12,6 +12,6 @@ export interface Assistant extends Timestamps {
12
  modelId: string;
13
  exampleInputs: string[];
14
  preprompt: string;
15
-
16
  userCount?: number;
 
17
  }
 
12
  modelId: string;
13
  exampleInputs: string[];
14
  preprompt: string;
 
15
  userCount?: number;
16
+ featured?: boolean;
17
  }
src/routes/assistants/+page.server.ts CHANGED
@@ -13,7 +13,7 @@ export const load = async ({ url }) => {
13
 
14
  // 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
15
  const assistants = await collections.assistants
16
- .find({ userCount: { $gt: 1 }, modelId: modelId ?? { $exists: true } })
17
  .sort({ userCount: -1 })
18
  .limit(10)
19
  .toArray();
 
13
 
14
  // 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
15
  const assistants = await collections.assistants
16
+ .find({ userCount: { $gt: 1 }, modelId: modelId ?? { $exists: true }, featured: true })
17
  .sort({ userCount: -1 })
18
  .limit(10)
19
  .toArray();
src/routes/settings/assistants/new/+page.server.ts CHANGED
@@ -100,6 +100,7 @@ export const actions: Actions = {
100
  createdAt: new Date(),
101
  updatedAt: new Date(),
102
  userCount: 1,
 
103
  });
104
 
105
  // add insertedId to user settings
 
100
  createdAt: new Date(),
101
  updatedAt: new Date(),
102
  userCount: 1,
103
+ featured: false,
104
  });
105
 
106
  // add insertedId to user settings