removeSource method
Remove a source and all its chunks from the database.
Implementation
Future<void> removeSource(int sourceId) async {
try {
await rust_rag.deleteSource(sourceId: sourceId);
await _markDirty(); // Mark index as dirty (Persistent)
} on RagError catch (e) {
debugPrint(
'[SmartError] Failed to remove source $sourceId: ${e.message}',
);
rethrow;
}
// Note: HNSW index is not automatically updated.
// It's recommended to call rebuildIndex() if many sources are deleted.
}