feat: add MDX file support (#12261)

Feat: add MDX file support  #12057 
### What problem does this PR solve?

<img width="1055" height="270" alt="image"
src="https://github.com/user-attachments/assets/a0ab49f9-7806-41cd-8a96-f593591ab36b"
/>

The page states that MDX files are supported, but uploading fails with
the error: "x.mdx: This type of file has not been supported yet!"
<img width="381" height="110" alt="image"
src="https://github.com/user-attachments/assets/4bbb7d08-cb47-416a-95fc-bc90b90fcc39"
/>


### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
lys1313013
2025-12-29 12:54:31 +08:00
committed by GitHub
parent 8d3f9d61da
commit 37e4485415
15 changed files with 41 additions and 9 deletions

View File

@ -18,6 +18,8 @@ export const fileIconMap = {
jpg: 'jpg.svg',
js: 'js.svg',
json: 'json.svg',
md: 'md.svg',
mdx: 'mdx.svg',
mkv: 'mkv.svg',
mp3: 'mp3.svg',
mp4: 'mp4.svg',
@ -142,6 +144,8 @@ export enum FileMimeType {
Xlsx = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
Mp4 = 'video/mp4',
Json = 'application/json',
Md = 'text/markdown',
Mdx = 'text/markdown',
}
export const Domain = 'demo.ragflow.io';
@ -161,7 +165,15 @@ export const Images = [
];
// Without FileViewer
export const ExceptiveType = ['xlsx', 'xls', 'pdf', 'docx', 'md', ...Images];
export const ExceptiveType = [
'xlsx',
'xls',
'pdf',
'docx',
'md',
'mdx',
...Images,
];
export const SupportedPreviewDocumentTypes = [...ExceptiveType];
//#endregion

View File

@ -12,6 +12,7 @@ export const FileIconMap = {
txt: 'text',
csv: 'pdf',
md: 'md',
mdx: 'md',
mp4: 'mp4',
avi: 'avi',
mkv: 'mkv',