|
|
@@ -27,9 +27,9 @@ const supportedFormats = {
|
|
|
|
|
|
type SupportedExtension = keyof typeof supportedFormats;
|
|
|
|
|
|
-export const isVectorStoreCompatible = (originalName: string, mimeType: string): boolean => {
|
|
|
+export const isVectorStoreCompatible = (file: Express.Multer.File): boolean => {
|
|
|
// Get extension
|
|
|
- const extension = path.extname(originalName);
|
|
|
+ const extension = path.extname(file.originalname);
|
|
|
|
|
|
// Check if the file extension is supported
|
|
|
if (!(extension in supportedFormats)) {
|
|
|
@@ -40,6 +40,7 @@ export const isVectorStoreCompatible = (originalName: string, mimeType: string):
|
|
|
const supportedMimeType = supportedFormats[extension as SupportedExtension];
|
|
|
|
|
|
// Check if the mimeType is supported
|
|
|
+ const mimeType = file.mimetype;
|
|
|
return Array.isArray(supportedMimeType)
|
|
|
? supportedMimeType.includes(mimeType)
|
|
|
: supportedMimeType === mimeType;
|