mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Clear toast upon inserting file
This commit is contained in:
@ -426,13 +426,14 @@ async function retrieveFileChunks(queryText, collectionId) {
|
|||||||
*/
|
*/
|
||||||
async function vectorizeFile(fileText, fileName, collectionId, chunkSize) {
|
async function vectorizeFile(fileText, fileName, collectionId, chunkSize) {
|
||||||
try {
|
try {
|
||||||
toastr.info('Vectorization may take some time, please wait...', `Ingesting file ${fileName}`);
|
const toast = toastr.info('Vectorization may take some time, please wait...', `Ingesting file ${fileName}`);
|
||||||
const chunks = splitRecursive(fileText, chunkSize);
|
const chunks = splitRecursive(fileText, chunkSize);
|
||||||
console.debug(`Vectors: Split file ${fileName} into ${chunks.length} chunks`, chunks);
|
console.debug(`Vectors: Split file ${fileName} into ${chunks.length} chunks`, chunks);
|
||||||
|
|
||||||
const items = chunks.map((chunk, index) => ({ hash: getStringHash(chunk), text: chunk, index: index }));
|
const items = chunks.map((chunk, index) => ({ hash: getStringHash(chunk), text: chunk, index: index }));
|
||||||
await insertVectorItems(collectionId, items);
|
await insertVectorItems(collectionId, items);
|
||||||
|
|
||||||
|
toastr.clear(toast);
|
||||||
console.log(`Vectors: Inserted ${chunks.length} vector items for file ${fileName} into ${collectionId}`);
|
console.log(`Vectors: Inserted ${chunks.length} vector items for file ${fileName} into ${collectionId}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Vectors: Failed to vectorize file', error);
|
console.error('Vectors: Failed to vectorize file', error);
|
||||||
|
Reference in New Issue
Block a user