[mob][photos] SemanticSearchService minor changes
This commit is contained in:
@@ -61,6 +61,7 @@ class SemanticSearchService {
|
||||
await EmbeddingsDB.instance.init();
|
||||
await _loadImageEmbeddings();
|
||||
Bus.instance.on<EmbeddingUpdatedEvent>().listen((event) {
|
||||
if (!_hasInitialized) return;
|
||||
_embeddingLoaderDebouncer.run(() async {
|
||||
await _loadImageEmbeddings();
|
||||
});
|
||||
@@ -74,6 +75,13 @@ class SemanticSearchService {
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> dispose() async {
|
||||
if (!_hasInitialized) return;
|
||||
_hasInitialized = false;
|
||||
await ClipTextEncoder.instance.release();
|
||||
_cachedImageEmbeddings.clear();
|
||||
}
|
||||
|
||||
Future<void> sync() async {
|
||||
if (_isSyncing) {
|
||||
return;
|
||||
@@ -90,6 +98,11 @@ class SemanticSearchService {
|
||||
_cachedImageEmbeddings.isNotEmpty;
|
||||
}
|
||||
|
||||
bool bothClipModelsLoaded() {
|
||||
return ClipImageEncoder.instance.isInitialized &&
|
||||
ClipTextEncoder.instance.isInitialized;
|
||||
}
|
||||
|
||||
// searchScreenQuery should only be used for the user initiate query on the search screen.
|
||||
// If there are multiple call tho this method, then for all the calls, the result will be the same as the last query.
|
||||
Future<(String, List<EnteFile>)> searchScreenQuery(String query) async {
|
||||
|
||||
Reference in New Issue
Block a user