add fallback value to get embedding
This commit is contained in:
parent
ce28f030fe
commit
d788d13d55
|
@ -27,9 +27,8 @@ const EMBEDDINGS_TABLE = 'embeddings_v2';
|
|||
const EMBEDDING_SYNC_TIME_TABLE = 'embedding_sync_time';
|
||||
|
||||
export const getLocalEmbeddings = async (model?: Model) => {
|
||||
const embeddings: Array<Embedding> = await localForage.getItem<Embedding[]>(
|
||||
EMBEDDINGS_TABLE
|
||||
);
|
||||
const embeddings: Array<Embedding> =
|
||||
(await localForage.getItem<Embedding[]>(EMBEDDINGS_TABLE)) ?? [];
|
||||
if (!embeddings) {
|
||||
await localForage.removeItem(EMBEDDINGS_TABLE_V1);
|
||||
await localForage.setItem(EMBEDDINGS_TABLE, []);
|
||||
|
|
Loading…
Reference in a new issue