refactor: uses of chats.set(...) support pagi sidebar

This commit is contained in:
Aryan Kothari
2024-08-01 15:20:36 -04:00
parent 62dc486c85
commit 2c4bc7a2b2
5 changed files with 70 additions and 19 deletions
+23 -8
View File
@@ -25,7 +25,9 @@
user,
socket,
showCallOverlay,
tools
tools,
pageSkip,
pageLimit
} from '$lib/stores';
import {
convertMessagesToHistory,
@@ -418,7 +420,9 @@
params: params,
files: chatFiles
});
await chats.set(await getChatList(localStorage.token));
await chats.set(
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
);
}
}
};
@@ -464,7 +468,9 @@
params: params,
files: chatFiles
});
await chats.set(await getChatList(localStorage.token));
await chats.set(
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
);
}
}
};
@@ -624,7 +630,9 @@
tags: [],
timestamp: Date.now()
});
await chats.set(await getChatList(localStorage.token));
await chats.set(
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
);
await chatId.set(chat.id);
} else {
await chatId.set('local');
@@ -700,7 +708,8 @@
})
);
await chats.set(await getChatList(localStorage.token));
await chats.set(await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit));
return _responses;
};
@@ -947,7 +956,9 @@
params: params,
files: chatFiles
});
await chats.set(await getChatList(localStorage.token));
await chats.set(
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
);
}
}
} else {
@@ -1220,7 +1231,9 @@
params: params,
files: chatFiles
});
await chats.set(await getChatList(localStorage.token));
await chats.set(
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
);
}
}
} else {
@@ -1385,7 +1398,9 @@
if ($settings.saveChatHistory ?? true) {
chat = await updateChatById(localStorage.token, _chatId, { title: _title });
await chats.set(await getChatList(localStorage.token));
await chats.set(
await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit)
);
}
};