mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-12 19:39:27 +03:00
8d4980cf78
# Description Added ability to upload .bib files to brain using langchain bibtex document loader. Also changed frontend to allow the choosing of said file. Looking for guidance on how to run unit tests locally! ## Checklist before requesting a review - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented hard-to-understand areas - [x] I have ideally added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import {
|
|
BsFiletypeCsv,
|
|
BsFiletypeDocx,
|
|
BsFiletypeHtml,
|
|
BsFiletypeMd,
|
|
BsFiletypeMp3,
|
|
BsFiletypeMp4,
|
|
BsFiletypePdf,
|
|
BsFiletypePptx,
|
|
BsFiletypePy,
|
|
BsFiletypeTxt,
|
|
BsFiletypeXls,
|
|
BsFiletypeXlsx,
|
|
} from "react-icons/bs";
|
|
import { FaFile, FaRegFileAudio } from "react-icons/fa";
|
|
import { LiaFileVideo } from "react-icons/lia";
|
|
import { IconType } from "react-icons/lib";
|
|
|
|
import { getFileType } from "./getFileType";
|
|
|
|
import { SupportedFileExtensions } from "../types/SupportedFileExtensions";
|
|
|
|
const fileTypeIcons: Record<SupportedFileExtensions, IconType> = {
|
|
pdf: BsFiletypePdf,
|
|
mp3: BsFiletypeMp3,
|
|
mp4: BsFiletypeMp4,
|
|
html: BsFiletypeHtml,
|
|
txt: BsFiletypeTxt,
|
|
csv: BsFiletypeCsv,
|
|
md: BsFiletypeMd,
|
|
markdown: BsFiletypeMd,
|
|
m4a: LiaFileVideo,
|
|
mpga: FaRegFileAudio,
|
|
mpeg: LiaFileVideo,
|
|
webm: LiaFileVideo,
|
|
wav: FaRegFileAudio,
|
|
pptx: BsFiletypePptx,
|
|
docx: BsFiletypeDocx,
|
|
odt: BsFiletypeDocx,
|
|
xlsx: BsFiletypeXlsx,
|
|
xls: BsFiletypeXls,
|
|
epub: FaFile,
|
|
ipynb: BsFiletypePy,
|
|
py: BsFiletypePy,
|
|
telegram: BsFiletypeDocx,
|
|
bib: FaFile
|
|
};
|
|
|
|
export const getFileIcon = (fileName: string): JSX.Element => {
|
|
const fileType = getFileType(fileName);
|
|
|
|
const Icon = fileType !== undefined ? fileTypeIcons[fileType] : FaFile;
|
|
|
|
return <Icon width={16} />;
|
|
};
|