mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix purge extras and mistral vectors
This commit is contained in:
@@ -530,10 +530,15 @@ async function queryCollection(collectionId, searchText, topK) {
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Purges the vector index for a collection.
|
||||
* @param {string} collectionId Collection ID to purge
|
||||
* @returns <Promise<boolean>> True if deleted, false if not
|
||||
*/
|
||||
async function purgeVectorIndex(collectionId) {
|
||||
try {
|
||||
if (!settings.enabled_chats) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const response = await fetch('/api/vector/purge', {
|
||||
@@ -549,9 +554,10 @@ async function purgeVectorIndex(collectionId) {
|
||||
}
|
||||
|
||||
console.log(`Vectors: Purged vector index for collection ${collectionId}`);
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Vectors: Failed to purge', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,8 +572,11 @@ async function onPurgeClick() {
|
||||
toastr.info('No chat selected', 'Purge aborted');
|
||||
return;
|
||||
}
|
||||
await purgeVectorIndex(chatId);
|
||||
toastr.success('Vector index purged', 'Purge successful');
|
||||
if (await purgeVectorIndex(chatId)) {
|
||||
toastr.success('Vector index purged', 'Purge successful');
|
||||
} else {
|
||||
toastr.error('Failed to purge vector index', 'Purge failed');
|
||||
}
|
||||
}
|
||||
|
||||
async function onViewStatsClick() {
|
||||
|
Reference in New Issue
Block a user