π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix clip search failure breaking complete search
Abhinavcc9bf90551e0
diff --git a/apps/photos/src/services/clipService.ts b/apps/photos/src/services/clipService.tsindex dd2dc9ee09..db9fccf2fe 100644--- a/apps/photos/src/services/clipService.ts+++ b/apps/photos/src/services/clipService.ts@@ -18,6 +18,7 @@ import { FILE_TYPE } from 'constants/file';import ComlinkCryptoWorker from '@ente/shared/crypto';import { Embedding, Model } from 'types/embedding';import { getToken } from '@ente/shared/storage/localStorage/helpers';+import isElectron from 'is-electron';const CLIP_EMBEDDING_LENGTH = 512;@@ -48,7 +49,7 @@ class ClipServiceImpl {}isPlatformSupported = () => {- return !this.unsupportedPlatform;+ return isElectron() && !this.unsupportedPlatform;};setupOnFileUploadListener = async () => {@@ -145,6 +146,9 @@ class ClipServiceImpl {try {return ElectronAPIs.computeTextEmbedding(text);} catch (e) {+ if (e?.message?.includes(CustomError.UNSUPPORTED_PLATFORM)) {+ this.unsupportedPlatform = true;+ }logError(e, 'failed to compute text embedding');throw e;}diff --git a/apps/photos/src/services/searchService.ts b/apps/photos/src/services/searchService.tsindex 0db671bfd8..bba89d1d6d 100644--- a/apps/photos/src/services/searchService.ts+++ b/apps/photos/src/services/searchService.ts@@ -290,15 +290,21 @@ async function getThingSuggestion(searchPhrase: string): Promise<Suggestion[]> {}async function getClipSuggestion(searchPhrase: string): Promise<Suggestion> {- if (!ClipService.isPlatformSupported()) {+ try {+ if (!ClipService.isPlatformSupported()) {+ return null;+ }++ const clipResults = await searchClip(searchPhrase);+ return {+ type: SuggestionType.CLIP,+ value: clipResults,+ label: searchPhrase,+ };+ } catch (e) {+ logError(e, 'getClipSuggestion failed');return null;}- const clipResults = await searchClip(searchPhrase);- return {- type: SuggestionType.CLIP,- value: clipResults,- label: searchPhrase,- };}function searchCollection(