Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove an error that is never thrown

Manav Rathi196090152c9e
diff --git a/desktop/src/types/ipc.ts b/desktop/src/types/ipc.ts
index d963419822..d986bc4998 100644
--- a/desktop/src/types/ipc.ts
+++ b/desktop/src/types/ipc.ts
@@ -50,8 +50,6 @@ export interface PendingUploads {
export const CustomErrors = {
WINDOWS_NATIVE_IMAGE_PROCESSING_NOT_SUPPORTED:
"Windows native image processing is not supported",
- UNSUPPORTED_PLATFORM: (platform: string, arch: string) =>
- `Unsupported platform - ${platform} ${arch}`,
MODEL_DOWNLOAD_PENDING:
"Model download pending, skipping clip search request",
};
diff --git a/web/apps/photos/src/services/clip-service.ts b/web/apps/photos/src/services/clip-service.ts
index 253d8097ec..9528d50753 100644
--- a/web/apps/photos/src/services/clip-service.ts
+++ b/web/apps/photos/src/services/clip-service.ts
@@ -75,7 +75,6 @@ class CLIPService {
private onFileUploadedHandler:
| ((arg: { enteFile: EnteFile; localFile: globalThis.File }) => void)
| null = null;
- private unsupportedPlatform = false;
constructor() {
this.liveEmbeddingExtractionQueue = new PQueue({
@@ -85,7 +84,7 @@ class CLIPService {
}
isPlatformSupported = () => {
- return isElectron() && !this.unsupportedPlatform;
+ return isElectron();
};
private logoutHandler = async () => {
@@ -99,9 +98,6 @@ class CLIPService {
setupOnFileUploadListener = async () => {
try {
- if (this.unsupportedPlatform) {
- return;
- }
if (this.onFileUploadedHandler) {
log.info("file upload listener already setup");
return;
@@ -188,26 +184,12 @@ class CLIPService {
}
};
- getTextEmbedding = async (text: string): Promise<Float32Array> => {
- try {
- return ensureElectron().clipTextEmbedding(text);
- } catch (e) {
- if (e?.message?.includes(CustomError.UNSUPPORTED_PLATFORM)) {
- this.unsupportedPlatform = true;
- }
- log.error("Failed to compute CLIP text embedding", e);
- throw e;
- }
+ getTextEmbedding = async (text: string) => {
+ return ensureElectron().clipTextEmbedding(text);
};
private runClipEmbeddingExtraction = async (canceller: AbortController) => {
try {
- if (this.unsupportedPlatform) {
- log.info(
- `skipping clip embedding extraction, platform unsupported`,
- );
- return;
- }
const user = getData(LS_KEYS.USER);
if (!user) {
return;
@@ -254,11 +236,6 @@ class CLIPService {
e,
);
}
- if (
- e?.message?.includes(CustomError.UNSUPPORTED_PLATFORM)
- ) {
- this.unsupportedPlatform = true;
- }
if (
e?.message === CustomError.REQUEST_CANCELLED ||
e?.message?.includes(CustomError.UNSUPPORTED_PLATFORM)
diff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.ts
index 0628bb0ca5..b699053886 100644
--- a/web/packages/next/types/ipc.ts
+++ b/web/packages/next/types/ipc.ts
@@ -200,6 +200,14 @@ export interface Electron {
// - Conversion
+ /**
+ * Try to convert an arbitrary image into JPEG.
+ *
+ * The behaviour is OS dependent.
+ * @param fileData
+ * @param filename
+ * @returns
+ */
convertToJPEG: (
fileData: Uint8Array,
filename: string,