Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

Merge branch 'feat-resubmit' into refactors

Danny Avilac230fe41f491
diff --cc api/models/Conversation.js
index c3b23d85fb,6e3c646c64..622744d27a
--- a/api/models/Conversation.js
+++ b/api/models/Conversation.js
@@@ -91,15 -91,13 +91,13 @@@ module.exports =
}
},
// getConvos: async () => await Conversation.find({}).sort({ createdAt: -1 }).exec(),
- getConvos: async (pageNumber = 1, pageSize = 12) => {
+ getConvosByPage: async (pageNumber = 1, pageSize = 12) => {
try {
- const skip = (pageNumber - 1) * pageSize;
- // const limit = pageNumber * pageSize;
-
- const conversations = await Conversation.find({})
+ const totalConvos = await Conversation.countDocuments();
+ const totalPages = Math.ceil(totalConvos / pageSize);
+ const convos = await Conversation.find()
- .sort({ createdAt: -1 })
+ .sort({ createdAt: -1, created: -1 })
- .skip(skip)
- // .limit(limit)
+ .skip((pageNumber - 1) * pageSize)
.limit(pageSize)
.exec();