Skip to content

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

Python

fix: Ingest document from chat is not working (OSS) (#1463)

Mike Pawlowski3820ff8ba2a5
diff --git a/frontend/app/api/queries/useGetSettingsQuery.ts b/frontend/app/api/queries/useGetSettingsQuery.ts
index 5ee5e74c8..7572f277c 100644
--- a/frontend/app/api/queries/useGetSettingsQuery.ts
+++ b/frontend/app/api/queries/useGetSettingsQuery.ts
@@ -74,6 +74,7 @@ export interface Settings {
embeddingModel?: string;
};
localhost_url?: string;
+ ingest_via_chat?: boolean;
}
export const useGetSettingsQuery = (
diff --git a/frontend/app/chat/_components/chat-input.tsx b/frontend/app/chat/_components/chat-input.tsx
index c030850b2..31123a391 100644
--- a/frontend/app/chat/_components/chat-input.tsx
+++ b/frontend/app/chat/_components/chat-input.tsx
@@ -39,6 +39,7 @@ interface ChatInputProps {
input: string;
loading: boolean;
isUploading: boolean;
+ ingestViaChat: boolean;
selectedFilter: KnowledgeFilterData | null;
parsedFilterData: { color?: FilterColor } | null;
uploadedFile: File | null;
@@ -60,6 +61,7 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
input,
loading,
isUploading,
+ ingestViaChat,
selectedFilter,
parsedFilterData,
uploadedFile,
@@ -502,21 +504,23 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(
</Button>
))}
<div className="flex items-center gap-2">
- <Button
- type="button"
- variant="ghost"
- size="iconSm"
- onClick={onFilePickerClick}
- disabled={isUploading}
- className={cn(
- "h-8 w-8 p-0 !rounded-md",
- isCloudBrand
- ? "hover:bg-[var(--layered-select-bg)]"
- : "hover:bg-muted/50",
- )}
- >
- <Plus className="h-4 w-4" />
- </Button>
+ {ingestViaChat && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="iconSm"
+ onClick={onFilePickerClick}
+ disabled={isUploading}
+ className={cn(
+ "h-8 w-8 p-0 !rounded-md",
+ isCloudBrand
+ ? "hover:bg-[var(--layered-select-bg)]"
+ : "hover:bg-muted/50",
+ )}
+ >
+ <Plus className="h-4 w-4" />
+ </Button>
+ )}
<Button
variant="default"
type="submit"
diff --git a/frontend/app/chat/page.tsx b/frontend/app/chat/page.tsx
index c30649bcd..2dfc68cc1 100644
--- a/frontend/app/chat/page.tsx
+++ b/frontend/app/chat/page.tsx
@@ -1216,6 +1216,7 @@ function ChatPage() {
}
}
}}
+ ingestViaChat={settings?.ingest_via_chat ?? false}
onFilterSelect={handleFilterSelect}
onFilePickerClick={handleFilePickerClick}
onFileSelected={setUploadedFile}
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
index 705f5ce5e..4b73c4bcc 100644
--- a/frontend/tsconfig.json
+++ b/frontend/tsconfig.json
@@ -11,7 +11,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
- "jsx": "react-jsx",
+ "jsx": "preserve",
"incremental": true,
"plugins": [
{
diff --git a/src/api/settings.py b/src/api/settings.py
index 5d4a8618e..61d3c1b3a 100644
--- a/src/api/settings.py
+++ b/src/api/settings.py
@@ -16,6 +16,7 @@ from config.settings import (
LANGFLOW_INGEST_FLOW_ID,
LANGFLOW_PUBLIC_URL,
LOCALHOST_URL,
+ OPENRAG_INGEST_VIA_CHAT,
clients,
get_openrag_config,
config_manager,
@@ -173,6 +174,7 @@ class SettingsResponse(BaseModel):
langflow_edit_url: Optional[str] = None
langflow_ingest_edit_url: Optional[str] = None
ingestion_defaults: Optional[IngestionDefaultsConfig] = None
+ ingest_via_chat: bool = False
class OnboardingResponse(BaseModel):
@@ -376,6 +378,7 @@ async def get_settings(
langflow_edit_url=langflow_edit_url,
langflow_ingest_edit_url=langflow_ingest_edit_url,
ingestion_defaults=ingestion_defaults_obj,
+ ingest_via_chat=OPENRAG_INGEST_VIA_CHAT,
)
except Exception as e:
diff --git a/src/config/settings.py b/src/config/settings.py
index a07c24ed1..5ae72b630 100644
--- a/src/config/settings.py
+++ b/src/config/settings.py
@@ -74,6 +74,11 @@ DISABLE_INGEST_WITH_LANGFLOW = os.getenv(
"DISABLE_INGEST_WITH_LANGFLOW", "false"
).lower() in ("true", "1", "yes")
+# Show the "+" file upload button in the chat input
+OPENRAG_INGEST_VIA_CHAT = os.getenv(
+ "OPENRAG_INGEST_VIA_CHAT", "false"
+).lower() in ("true", "1", "yes")
+
# Ingest sample data configuration
INGEST_SAMPLE_DATA = os.getenv(
"INGEST_SAMPLE_DATA", "true"