This commit is contained in:
Timothy J. Baek 2024-08-27 15:58:02 +02:00
parent ef28330c1a
commit 628310b12b

View File

@ -15,11 +15,11 @@
user as _user
} from '$lib/stores';
import { blobToFile, findWordIndices } from '$lib/utils';
import { transcribeAudio } from '$lib/apis/audio';
import { processDocToVectorDB } from '$lib/apis/rag';
import { uploadFile } from '$lib/apis/files';
import {
SUPPORTED_FILE_TYPE,
SUPPORTED_FILE_EXTENSIONS,
@ -171,24 +171,6 @@
}
};
const processFileCountLimit = async (querySettings, inputFiles) => {
const maxFiles = querySettings.FILE_MAX_COUNT;
const currentFilesCount = files.length;
const inputFilesCount = inputFiles.length;
const totalFilesCount = currentFilesCount + inputFilesCount;
if (currentFilesCount >= maxFiles || totalFilesCount > maxFiles) {
toast.error(`File count exceeds the limit of '${maxFiles}'. Please remove some files.`);
if (currentFilesCount >= maxFiles) {
return [false, null];
}
if (totalFilesCount > maxFiles) {
inputFiles = inputFiles.slice(0, maxFiles - currentFilesCount);
}
}
return [true, inputFiles];
};
const inputFilesHandler = async (inputFiles) => {
inputFiles.forEach((file) => {
if (['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(file['type'])) {