mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 03:10:15 +01:00
fix: conflicting fetch with /api/convos
This commit is contained in:
parent
0f54ffd8b4
commit
b97594c000
10 changed files with 199 additions and 90 deletions
|
|
@ -145,10 +145,11 @@ module.exports = {
|
|||
const promises = convoIds.map(convo => {
|
||||
return Conversation.findOne({ user, conversationId: convo.conversationId}).exec();
|
||||
});
|
||||
const results = await Promise.all(promises);
|
||||
const results = (await Promise.all(promises)).filter(convo => convo);
|
||||
const startIndex = (pageNumber - 1) * pageSize;
|
||||
const convos = results.slice(startIndex, startIndex + pageSize);
|
||||
const totalPages = Math.ceil(results.length / pageSize);
|
||||
console.log(results.length, totalPages, convos.length);
|
||||
return { conversations: convos, pages: totalPages, pageNumber, pageSize };
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue