mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 17:43:03 +03:00
10af0c949a
* feat: rename ChatMessages to MessagesDialog * feat: rename history to messages * feat: add notifications to ChatContext * feat: add getNotificationsFromChatHistory * feat: add getMergedChatHistoryWithReducedNotifications * refactor: update useActionBar * refactor: update <ChatMessage />-n * feat: update crawler and endpoint notifications content * feat: display notifications * test: update <MessageDialog /> tests * feat: rename ChatMessage to QADisplay * feat: rename ChatHistory to ChatMessage * feat(upload): throw error when file missing * feat: rename getMergedChatHistoryWithReducedNotifications to getMergedChatMessagesWithReducedNotifications * feat: change history wording to message * feat: move getFileIcon to lib * refactor(NotificationDisplayer): move types to types.ts * chore: improve ux * feat: rename MessagesDialog to ChatDialogue
53 lines
1.2 KiB
TypeScript
53 lines
1.2 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,
|
|
};
|
|
|
|
export const getFileIcon = (fileName: string): JSX.Element => {
|
|
const fileType = getFileType(fileName);
|
|
|
|
const Icon = fileType !== undefined ? fileTypeIcons[fileType] : FaFile;
|
|
|
|
return <Icon className="text-2xl" />;
|
|
};
|