refac: frontend

This commit is contained in:
Timothy J. Baek 2024-04-10 01:01:42 -07:00
parent 582d11f191
commit 098ba6ea4e

View file

@ -35,9 +35,6 @@
k: 4 k: 4
}; };
let embeddingModelConfig = {
embedding_model: ''
};
let embeddingModel = ''; let embeddingModel = '';
const scanHandler = async () => { const scanHandler = async () => {
@ -66,9 +63,9 @@
updateEmbeddingModelLoading = true; updateEmbeddingModelLoading = true;
const res = await updateEmbeddingModel(localStorage.token, { const res = await updateEmbeddingModel(localStorage.token, {
embedding_model: embeddingModel embedding_model: embeddingModel
}).catch((error) => { }).catch(async (error) => {
toast.error(error); toast.error(error);
embeddingModel = embeddingModelConfig.embedding_model; embeddingModel = (await getEmbeddingModel(localStorage.token)).embedding_model;
return null; return null;
}); });
updateEmbeddingModelLoading = false; updateEmbeddingModelLoading = false;
@ -79,10 +76,6 @@
toast.success($i18n.t('Model {{embedding_model}} update complete!', res), { toast.success($i18n.t('Model {{embedding_model}} update complete!', res), {
duration: 1000 * 10 duration: 1000 * 10
}); });
} else {
toast.error($i18n.t('Model {{embedding_model}} update failed or not required!', res), {
duration: 1000 * 10
});
} }
} }
}; };
@ -108,8 +101,7 @@
chunkOverlap = res.chunk.chunk_overlap; chunkOverlap = res.chunk.chunk_overlap;
} }
embeddingModelConfig = await getEmbeddingModel(localStorage.token); embeddingModel = (await getEmbeddingModel(localStorage.token)).embedding_model;
embeddingModel = embeddingModelConfig.embedding_model;
querySettings = await getQuerySettings(localStorage.token); querySettings = await getQuerySettings(localStorage.token);
}); });