Unverified Commit bf6f0c38 authored by Timothy Jaeryang Baek's avatar Timothy Jaeryang Baek Committed by GitHub
Browse files

Merge pull request #2501 from cheahjs/feat/speed-up-loading

refac: speed up app mount by parallelizing API requests
parents f8778333 929384e3
...@@ -87,17 +87,29 @@ ...@@ -87,17 +87,29 @@
// IndexedDB Not Found // IndexedDB Not Found
} }
await models.set(await getModels()); settings.set(JSON.parse(localStorage.getItem('settings') ?? '{}'));
await settings.set(JSON.parse(localStorage.getItem('settings') ?? '{}'));
await Promise.all([
await modelfiles.set(await getModelfiles(localStorage.token)); (async () => {
await prompts.set(await getPrompts(localStorage.token)); models.set(await getModels());
await documents.set(await getDocs(localStorage.token)); })(),
await tags.set(await getAllChatTags(localStorage.token)); (async () => {
modelfiles.set(await getModelfiles(localStorage.token));
})(),
(async () => {
prompts.set(await getPrompts(localStorage.token));
})(),
(async () => {
documents.set(await getDocs(localStorage.token));
})(),
(async () => {
tags.set(await getAllChatTags(localStorage.token));
})()
]);
modelfiles.subscribe(async () => { modelfiles.subscribe(async () => {
// should fetch models // should fetch models
await models.set(await getModels()); models.set(await getModels());
}); });
document.addEventListener('keydown', function (event) { document.addEventListener('keydown', function (event) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment