diff --git a/src/lib/server/database.ts b/src/lib/server/database.ts index b648d95c8f1..f582ada06d2 100644 --- a/src/lib/server/database.ts +++ b/src/lib/server/database.ts @@ -70,6 +70,8 @@ client.on("open", () => { settings.createIndex({ assistants: 1 }).catch(console.error); users.createIndex({ hfUserId: 1 }, { unique: true }).catch(console.error); users.createIndex({ sessionId: 1 }, { unique: true, sparse: true }).catch(console.error); + // No unicity because due to renames & outdated info from oauth provider, there may be the same username on different users + users.createIndex({ username: 1 }).catch(console.error); messageEvents.createIndex({ createdAt: 1 }, { expireAfterSeconds: 60 }).catch(console.error); sessions.createIndex({ expiresAt: 1 }, { expireAfterSeconds: 0 }).catch(console.error); sessions.createIndex({ sessionId: 1 }, { unique: true }).catch(console.error); diff --git a/src/routes/assistants/+page.server.ts b/src/routes/assistants/+page.server.ts index 7e190e25579..7d31f1f2cad 100644 --- a/src/routes/assistants/+page.server.ts +++ b/src/routes/assistants/+page.server.ts @@ -26,7 +26,7 @@ export const load = async ({ url, locals }) => { // fetch the top 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 const filter: Filter = { - modelId: modelId ?? { $exists: true }, + ...(modelId && { modelId }), ...(!createdByCurrentUser && { userCount: { $gt: 1 } }), ...(createdByName ? { createdByName } : { featured: true }), };