delete table option
This commit is contained in:
@@ -111,6 +111,17 @@ class ClipVectorDB {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deleteIndex() async {
|
||||
final db = await _vectorDB;
|
||||
try {
|
||||
await db.deleteIndex();
|
||||
_vectorDbFuture = null;
|
||||
} catch (e, s) {
|
||||
_logger.severe("Error deleting index", e, s);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<(int, int, int)> getIndexStats() async {
|
||||
final db = await _vectorDB;
|
||||
try {
|
||||
|
||||
@@ -211,7 +211,7 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {
|
||||
sectionOptionSpacing,
|
||||
MenuItemWidget(
|
||||
captionedTextWidget: const CaptionedTextWidget(
|
||||
title: "Empty ClipVectorDB",
|
||||
title: "Delete/Empty ClipVectorDB",
|
||||
),
|
||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
||||
trailingIcon: Icons.chevron_right_outlined,
|
||||
@@ -219,22 +219,7 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {
|
||||
onTap: () async {
|
||||
try {
|
||||
final clipVectorDB = ClipVectorDB.instance;
|
||||
final stats = await clipVectorDB.getIndexStats();
|
||||
logger.info("ClipVectorDB stats: size: ${stats.$1}, "
|
||||
"capacity: ${stats.$2}, dimensions: ${stats.$3}");
|
||||
showShortToast(
|
||||
context,
|
||||
"ClipVectorDB stats: size: ${stats.$1}, "
|
||||
"capacity: ${stats.$2}, dimensions: ${stats.$3}");
|
||||
|
||||
await clipVectorDB.deleteAllEmbeddings();
|
||||
final statsAfter = await clipVectorDB.getIndexStats();
|
||||
logger.info("ClipVectorDB stats after: size: ${statsAfter.$1}, "
|
||||
"capacity: ${statsAfter.$2}, dimensions: ${statsAfter.$3}");
|
||||
showShortToast(
|
||||
context,
|
||||
"ClipVectorDB stats after: size: ${statsAfter.$1}, "
|
||||
"capacity: ${statsAfter.$2}, dimensions: ${statsAfter.$3}");
|
||||
await clipVectorDB.deleteIndex();
|
||||
} catch (e, s) {
|
||||
logger.warning('ClipVectorDB cleanup failed ', e, s);
|
||||
await showGenericErrorDialog(context: context, error: e);
|
||||
|
||||
Reference in New Issue
Block a user