Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

fix: knowledge upload file types have single source of truth (#878)

Phil Nashcf023a61716f
diff --git a/docs/docs/core-components/ingestion.mdx b/docs/docs/core-components/ingestion.mdx
index 9ef19cc7f..c5582472c 100644
--- a/docs/docs/core-components/ingestion.mdx
+++ b/docs/docs/core-components/ingestion.mdx
@@ -36,6 +36,34 @@ You can upload files and folders from your local machine to your knowledge base:
The default path is `~/.openrag/documents`.
To change this path, see [Set the local documents path](/knowledge#set-the-local-documents-path).
+### Supported file types
+
+OpenRAG supports ingesting the following document types:
+
+* .pdf
+* .doc
+* .docx
+* .pptx
+* .ppt
+* .xlsx
+* .xls
+* .csv
+* .txt
+* .md
+* .html
+* .htm
+* .rtf
+* .odt
+* .asciidoc
+* .adoc
+* .png
+* .jpg
+* .jpeg
+* .gif
+* .bmp
+* .tiff
+* .webp
+
The selected files are processed in the background through the **OpenSearch Ingestion** flow.
<PartialIngestionFlow />
diff --git a/frontend/app/chat/_components/chat-input.tsx b/frontend/app/chat/_components/chat-input.tsx
index cd343eda7..152d83a66 100644
--- a/frontend/app/chat/_components/chat-input.tsx
+++ b/frontend/app/chat/_components/chat-input.tsx
@@ -24,6 +24,7 @@ import { useGetAllFiltersQuery } from "../../api/queries/useGetAllFiltersQuery";
import type { KnowledgeFilterData } from "../_types/types";
import { FilePreview } from "./file-preview";
import { SelectedKnowledgeFilter } from "./selected-knowledge-filter";
+import { SUPPORTED_EXTENSIONS, SUPPORTED_FILE_TYPES } from "@/components/knowledge-dropdown";
export interface ChatInputHandle {
focusInput: () => void;
@@ -104,13 +105,7 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
}, [allFilters, filterSearchTerm]);
const { getRootProps, getInputProps } = useDropzone({
- accept: {
- "application/pdf": [".pdf"],
- "application/msword": [".doc"],
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
- [".docx"],
- "text/markdown": [".md"],
- },
+ accept: SUPPORTED_FILE_TYPES,
maxFiles: 1,
disabled: !isDragging,
onDrop: (acceptedFiles, fileRejections) => {
@@ -501,7 +496,7 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
type="file"
onChange={handleFilePickerChange}
className="hidden"
- accept=".pdf,.doc,.docx,.txt,.md,.rtf,.odt"
+ accept={SUPPORTED_EXTENSIONS.join(",")}
/>
<Popover
diff --git a/frontend/app/onboarding/_components/onboarding-upload.tsx b/frontend/app/onboarding/_components/onboarding-upload.tsx
index bef2610df..591c161dd 100644
--- a/frontend/app/onboarding/_components/onboarding-upload.tsx
+++ b/frontend/app/onboarding/_components/onboarding-upload.tsx
@@ -9,6 +9,7 @@ import { useGetTasksQuery } from "@/app/api/queries/useGetTasksQuery";
import { AnimatedProviderSteps } from "@/app/onboarding/_components/animated-provider-steps";
import { Button } from "@/components/ui/button";
import { uploadFile } from "@/lib/upload-utils";
+import { SUPPORTED_EXTENSIONS } from "@/components/knowledge-dropdown";
interface OnboardingUploadProps {
onComplete: () => void;
@@ -251,7 +252,7 @@ const OnboardingUpload = ({ onComplete }: OnboardingUploadProps) => {
type="file"
onChange={handleFileChange}
className="hidden"
- accept=".pdf,.doc,.docx,.txt,.md,.rtf,.odt"
+ accept={SUPPORTED_EXTENSIONS.join(",")}
/>
</motion.div>
) : (
diff --git a/frontend/components/knowledge-dropdown.tsx b/frontend/components/knowledge-dropdown.tsx
index 932eb974c..92505c401 100644
--- a/frontend/components/knowledge-dropdown.tsx
+++ b/frontend/components/knowledge-dropdown.tsx
@@ -44,31 +44,26 @@ import {
import { cn } from "@/lib/utils";
// Supported file extensions - single source of truth
-const SUPPORTED_EXTENSIONS = [
- ".pdf",
- ".doc",
- ".docx",
- ".pptx",
- ".ppt",
- ".xlsx",
- ".xls",
- ".csv",
- ".txt",
- ".md",
- ".html",
- ".htm",
- ".rtf",
- ".odt",
- ".asciidoc",
- ".adoc",
- ".png",
- ".jpg",
- ".jpeg",
- ".gif",
- ".bmp",
- ".tiff",
- ".webp",
-];
+// If modified, please also update the list in the documentation (openrag/docs/docs)
+export const SUPPORTED_FILE_TYPES = {
+ "image/*": [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".webp"],
+ "application/pdf": [".pdf"],
+ "application/msword": [".doc"],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
+ "application/vnd.ms-powerpoint": [".ppt"],
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": [".pptx"],
+ "application/vnd.ms-excel": [".xls"],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
+ "text/csv": [".csv"],
+ "text/plain": [".txt"],
+ "text/markdown": [".md"],
+ "text/html": [".html", ".htm"],
+ "application/rtf": [".rtf"],
+ "application/vnd.oasis.opendocument.text": [".odt"],
+ "text/asciidoc": [".adoc", ".asciidoc"]
+}
+
+export const SUPPORTED_EXTENSIONS = Object.values(SUPPORTED_FILE_TYPES).flat();
export function KnowledgeDropdown() {
const { addTask } = useTask();