clearActiveEmbeddingIdentity method

  1. @override
Future<void> clearActiveEmbeddingIdentity()
override

Clears the active embedding identity (in-memory spec + persisted prefs).

See clearActiveInferenceIdentity: default throws rather than silently no-op'ing, so a non-overriding implementer fails loudly instead of leaving a stale persisted identity.

Implementation

@override
Future<void> clearActiveEmbeddingIdentity() async {
  await _ensureInitialized();
  try {
    final prefs = await SharedPreferences.getInstance();
    await prefs.remove(PreferencesKeys.activeEmbeddingFilename);
    await prefs.remove(PreferencesKeys.activeEmbeddingTokenizerFilename);
    await prefs.remove(PreferencesKeys.activeEmbeddingSource);
    await prefs.remove(PreferencesKeys.activeEmbeddingTokenizerSource);
    _activeEmbeddingModel = null;
  } catch (e) {
    gemmaLog('[ModelManager] clearActiveEmbeddingIdentity failed: $e');
    rethrow;
  }
  gemmaLog('Active embedding identity cleared');
}