enable clip for windows (#1436)

This commit is contained in:
Abhinav Kumar 2023-11-17 17:41:42 +05:30 committed by GitHub
commit d8d71557da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 12 deletions

View file

@ -722,7 +722,7 @@ export default function Gallery() {
await syncTrash(collections, setTrashedFiles);
await syncEntities();
await syncMapEnabled();
if (await ClipService.isClipSupported()) {
if (isElectron()) {
await syncEmbeddings();
void ClipService.scheduleImageEmbeddingExtraction();
}

View file

@ -49,8 +49,7 @@ class ClipServiceImpl {
setupOnFileUploadListener = async () => {
try {
const isClipSupported = await this.isClipSupported();
if (!isClipSupported) {
if (!isElectron()) {
return;
}
if (this.onFileUploadedHandler) {
@ -98,14 +97,6 @@ class ClipServiceImpl {
}
};
isClipSupported = async () => {
if (!isElectron()) {
return false;
}
const platform = await ElectronAPIs.getPlatform();
return platform !== 'windows';
};
setOnUpdateHandler = (handler: (status: ClipExtractionStatus) => void) => {
this.onUpdateHandler = handler;
handler(this.clipExtractionStatus);

View file

@ -32,6 +32,7 @@ import {
computeClipMatchScore,
getLocalClipImageEmbeddings,
} from './clipService';
import isElectron from 'is-electron';
const DIGITS = new Set(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']);
@ -290,7 +291,7 @@ async function getThingSuggestion(searchPhrase: string): Promise<Suggestion[]> {
}
async function getClipSuggestion(searchPhrase: string): Promise<Suggestion> {
if (!(await ClipService.isClipSupported())) {
if (!isElectron()) {
return null;
}
const clipResults = await searchClip(searchPhrase);