Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix issues

Abhinav91b47673d5f7
diff --git a/apps/photos/src/pages/gallery/index.tsx b/apps/photos/src/pages/gallery/index.tsx
index 830a1fb761..d3e37e55ee 100644
--- a/apps/photos/src/pages/gallery/index.tsx
+++ b/apps/photos/src/pages/gallery/index.tsx
@@ -915,7 +915,7 @@ export default function Gallery() {
} else {
setSearch(newSearch);
}
- setIsClipSearchResult(!!newSearch.clip);
+ setIsClipSearchResult(!!newSearch?.clip);
if (!newSearch?.collection) {
setIsInSearchMode(!!newSearch);
setSetSearchResultSummary(summary);
diff --git a/apps/photos/src/services/embeddingService.ts b/apps/photos/src/services/embeddingService.ts
index 43fe5f759c..527f3fe7af 100644
--- a/apps/photos/src/services/embeddingService.ts
+++ b/apps/photos/src/services/embeddingService.ts
@@ -1,5 +1,6 @@
import {
Embedding,
+ EncryptedEmbedding,
GetEmbeddingDiffResponse,
PutEmbeddingRequest,
} from 'types/embedding';
@@ -20,9 +21,9 @@ const EMBEDDINGS_TABLE = 'embeddings';
const EMBEDDING_SYNC_TIME_TABLE = 'embedding_sync_time';
export const getLocalEmbeddings = async () => {
- const entities: Array<Embedding> =
+ const embeddings: Array<Embedding> =
(await localForage.getItem<Embedding[]>(EMBEDDINGS_TABLE)) || [];
- return entities;
+ return embeddings;
};
const getEmbeddingSyncTime = async () => {
@@ -43,7 +44,7 @@ export const syncEmbeddings = async () => {
let response: GetEmbeddingDiffResponse;
do {
response = await getEmbeddingsDiff(sinceTime);
- if (response.diff?.length) {
+ if (!response.diff?.length) {
return;
}
const newEmbeddings = await Promise.all(
@@ -90,6 +91,7 @@ export const getEmbeddingsDiff = async (
`${ENDPOINT}/embeddings/diff`,
{
sinceTime,
+ limit: DIFF_LIMIT,
},
{
'X-Auth-Token': token,
@@ -102,15 +104,23 @@ export const getEmbeddingsDiff = async (
}
};
-export const putEmbedding = async (putEmbeddingReq: PutEmbeddingRequest) => {
+export const putEmbedding = async (
+ putEmbeddingReq: PutEmbeddingRequest
+): Promise<EncryptedEmbedding> => {
try {
const token = getToken();
if (!token) {
return;
}
- await HTTPService.put(`${ENDPOINT}/embeddings`, putEmbeddingReq, null, {
- 'X-Auth-Token': token,
- });
+ const resp = await HTTPService.put(
+ `${ENDPOINT}/embeddings`,
+ putEmbeddingReq,
+ null,
+ {
+ 'X-Auth-Token': token,
+ }
+ );
+ return resp.data;
} catch (e) {
logError(e, 'put embedding failed');
throw e;
diff --git a/apps/photos/src/types/embedding.tsx b/apps/photos/src/types/embedding.tsx
index c1c2ea5d6d..a4a667dd98 100644
--- a/apps/photos/src/types/embedding.tsx
+++ b/apps/photos/src/types/embedding.tsx
@@ -1,5 +1,5 @@
export enum Model {
- GGML_CLIP = 'ggml_clip',
+ GGML_CLIP = 'ggml-clip',
}
export interface EncryptedEmbedding {