From 3118e54b69c52fb18270c0295cf0e672a2a73936 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 4 Sep 2025 10:24:11 -0300 Subject: [PATCH] Add ingest flow handling and UI updates in KnowledgeSourcesPage This commit introduces state management for ingest flow IDs and corresponding edit URLs in the KnowledgeSourcesPage component. It enhances the user interface by adding a new section for file ingestion, allowing users to customize their file processing pipeline. The changes improve the overall functionality and maintainability of the settings page, contributing to a more robust and well-documented codebase. --- frontend/src/app/admin/page.tsx | 12 +++++----- frontend/src/app/settings/page.tsx | 37 ++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/admin/page.tsx b/frontend/src/app/admin/page.tsx index 121a460b..c3262156 100644 --- a/frontend/src/app/admin/page.tsx +++ b/frontend/src/app/admin/page.tsx @@ -57,7 +57,7 @@ function AdminPage() { }) const result = await response.json() - + if (response.ok) { setUploadStatus(`File uploaded successfully! ID: ${result.id}`) setSelectedFile(null) @@ -132,23 +132,23 @@ function AdminPage() { }) const result = await response.json() - + if (response.status === 201) { // New flow: Got task ID, use centralized tracking const taskId = result.task_id || result.id const totalFiles = result.total_files || 0 - + if (!taskId) { throw new Error("No task ID received from server") } - + // Add task to centralized tracking addTask(taskId) - + setUploadStatus(`🔄 Processing started for ${totalFiles} files. Check the task notification panel for real-time progress. (Task ID: ${taskId})`) setFolderPath("") setPathUploadLoading(false) - + } else if (response.ok) { // Original flow: Direct response with results const successful = result.results?.filter((r: {status: string}) => r.status === "indexed").length || 0 diff --git a/frontend/src/app/settings/page.tsx b/frontend/src/app/settings/page.tsx index c42cbeb8..e1352434 100644 --- a/frontend/src/app/settings/page.tsx +++ b/frontend/src/app/settings/page.tsx @@ -57,7 +57,9 @@ function KnowledgeSourcesPage() { // Settings state // Note: backend internal Langflow URL is not needed on the frontend const [flowId, setFlowId] = useState('1098eea1-6649-4e1d-aed1-b77249fb8dd0') + const [ingestFlowId, setIngestFlowId] = useState('') const [langflowEditUrl, setLangflowEditUrl] = useState('') + const [langflowIngestEditUrl, setLangflowIngestEditUrl] = useState('') const [publicLangflowUrl, setPublicLangflowUrl] = useState('') // Fetch settings from backend @@ -69,9 +71,18 @@ function KnowledgeSourcesPage() { if (settings.flow_id) { setFlowId(settings.flow_id) } + if (settings.ingest_flow_id) { + console.log('Setting ingestFlowId to:', settings.ingest_flow_id) + setIngestFlowId(settings.ingest_flow_id) + } else { + console.log('No ingest_flow_id in settings:', settings) + } if (settings.langflow_edit_url) { setLangflowEditUrl(settings.langflow_edit_url) } + if (settings.langflow_ingest_edit_url) { + setLangflowIngestEditUrl(settings.langflow_ingest_edit_url) + } if (settings.langflow_public_url) { setPublicLangflowUrl(settings.langflow_public_url) } @@ -344,6 +355,32 @@ function KnowledgeSourcesPage() { + {/* Ingest Flow Section */} +
+
+

File ingestion

+

Customize your file processing and indexing pipeline

+
+ +
+ {/* Connectors Section */}