removeSource method

Future<void> removeSource(
  1. int sourceId, {
  2. String? collectionId,
})

Remove a source and all its chunks from the database.

Implementation

Future<void> removeSource(int sourceId, {String? collectionId}) async {
  final normalized = _normalizeCollectionId(collectionId);
  final service = await _serviceForCollection(normalized);
  if (normalized == SourceRagService.defaultCollectionId) {
    _startOperation();
  }
  try {
    await service.removeSource(sourceId);
  } finally {
    if (normalized == SourceRagService.defaultCollectionId) {
      _endOperation();
    }
  }
}