[mob] Minor fix to reflect correct status for indexing
This commit is contained in:
parent
d6599f178b
commit
e4dcdeb030
3 changed files with 6 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
||||||
import "package:photos/events/event.dart";
|
import "package:photos/events/event.dart";
|
||||||
|
|
||||||
class EmbeddingUpdatedEvent extends Event {}
|
class EmbeddingUpdatedEvent extends Event {}
|
||||||
|
|
||||||
|
class EmbeddingCacheUpdatedEvent extends Event {}
|
||||||
|
|
|
@ -190,6 +190,7 @@ class SemanticSearchService {
|
||||||
_logger.info(
|
_logger.info(
|
||||||
"Loading ${_cachedEmbeddings.length} took: ${(endTime.millisecondsSinceEpoch - startTime.millisecondsSinceEpoch)}ms",
|
"Loading ${_cachedEmbeddings.length} took: ${(endTime.millisecondsSinceEpoch - startTime.millisecondsSinceEpoch)}ms",
|
||||||
);
|
);
|
||||||
|
Bus.instance.fire(EmbeddingCacheUpdatedEvent());
|
||||||
_logger.info("Cached embeddings: " + _cachedEmbeddings.length.toString());
|
_logger.info("Cached embeddings: " + _cachedEmbeddings.length.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,6 +228,7 @@ class SemanticSearchService {
|
||||||
.getOwnedFileIDs(Configuration.instance.getUserID()!);
|
.getOwnedFileIDs(Configuration.instance.getUserID()!);
|
||||||
final embeddedFileIDs =
|
final embeddedFileIDs =
|
||||||
await EmbeddingsDB.instance.getFileIDs(_currentModel);
|
await EmbeddingsDB.instance.getFileIDs(_currentModel);
|
||||||
|
|
||||||
uploadedFileIDs.removeWhere(
|
uploadedFileIDs.removeWhere(
|
||||||
(id) => embeddedFileIDs.contains(id),
|
(id) => embeddedFileIDs.contains(id),
|
||||||
);
|
);
|
||||||
|
|
|
@ -228,13 +228,13 @@ class MagicSearchIndexStatsWidget extends StatefulWidget {
|
||||||
class _MagicSearchIndexStatsWidgetState
|
class _MagicSearchIndexStatsWidgetState
|
||||||
extends State<MagicSearchIndexStatsWidget> {
|
extends State<MagicSearchIndexStatsWidget> {
|
||||||
IndexStatus? _status;
|
IndexStatus? _status;
|
||||||
late StreamSubscription<EmbeddingUpdatedEvent> _eventSubscription;
|
late StreamSubscription<EmbeddingCacheUpdatedEvent> _eventSubscription;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_eventSubscription =
|
_eventSubscription =
|
||||||
Bus.instance.on<EmbeddingUpdatedEvent>().listen((event) {
|
Bus.instance.on<EmbeddingCacheUpdatedEvent>().listen((event) {
|
||||||
_fetchIndexStatus();
|
_fetchIndexStatus();
|
||||||
});
|
});
|
||||||
_fetchIndexStatus();
|
_fetchIndexStatus();
|
||||||
|
|
Loading…
Reference in a new issue