feat: ship ingest review UI with settings, Docling preview, and chunk search - #2115
feat: ship ingest review UI with settings, Docling preview, and chunk search#2115Wallgau wants to merge 21 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds an ingest-preview flow spanning upload handling, Docling preview caching, polling APIs, settings, and a review dialog. It also adds Docling renderers, file-scoped chunk browsing, configurable search behavior, and backend/frontend tests. ChangesIngest preview backend
Preview data and settings
Chunk and Docling presentation
Review dialog and upload integration
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant KnowledgeDropdown
participant UploadAPI
participant LangflowFileService
participant IngestReviewDialog
participant PreviewQueries
User->>KnowledgeDropdown: upload file or folder
KnowledgeDropdown->>UploadAPI: submit with preview enabled
UploadAPI-->>KnowledgeDropdown: task IDs and preview mode
KnowledgeDropdown->>IngestReviewDialog: open with task IDs and files
IngestReviewDialog->>PreviewQueries: poll Docling and index-proof endpoints
PreviewQueries-->>IngestReviewDialog: document, pipeline status, and chunks
IngestReviewDialog-->>User: render preview and chunk highlights
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
There was a problem hiding this comment.
Actionable comments posted: 11
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/app/settings/[tab]/page.tsx (1)
18-25: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winApply ingest-preview run-mode gating at the route boundary.
The navigation hides this tab outside OSS/SaaS, but
VALID_TABSaccepts/settings/ingest-previewunconditionally, so direct navigation still renders the settings and sample-upload UI. Apply the sameisIngestPreviewEnabled(runMode)check server-side and redirect unsupported modes.Also applies to: 142-154
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/app/settings/`[tab]/page.tsx around lines 18 - 25, Update the settings route validation around VALID_TABS to gate “ingest-preview” with isIngestPreviewEnabled(runMode). When the tab is requested in an unsupported run mode, redirect before rendering the settings or sample-upload UI; preserve existing behavior for all other tabs and supported modes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/components/docling-preview.tsx`:
- Around line 41-51: Update the useEffect around loadDoclingComponents to catch
dynamic-import failures, clear the cached doclingComponentsLoaded promise so
later viewers can retry, and set state for rendering an error instead of leaving
the preview blank. Preserve cancellation handling so unmounted components are
not updated, and add the corresponding error-state rendering in the preview
component.
In `@frontend/components/file-chunks-panel.tsx`:
- Around line 178-188: Update handleCopy to await navigator.clipboard.writeText
before setting copiedIndex, and only update the success state and timer after
the write resolves successfully. Stop removing newlines, carriage returns, and
tabs; preserve the original text or only apply non-destructive trimming as
appropriate.
- Around line 146-149: Update the allChunks mapping in the file-scoped chunks
flow to preserve each chunk’s API-provided index instead of overwriting it with
the array position. Keep the existing chunk data and fallback to an empty array
unchanged.
In `@frontend/components/ingest-review.tsx`:
- Around line 873-877: Update the useEffect that calls markIngestPreviewSeen so
it only consumes first-run auto-open after preview mode is confirmed, using the
available confirmed task ID or successful preview response state. Keep the
dialog’s open behavior unchanged, and do not mark the preview seen when the
upload fails or previewMode is false.
- Around line 520-555: Update the file status rendering in the files map to call
isFileEntryFailed(file.entry) separately from isPreviewReady(file.entry).
Display a distinct “failed” status and appropriate styling for failed entries;
keep “ready” for preview-ready files and “processing” only for entries that are
neither ready nor failed.
- Line 819: Update the awaitingChunks prop passed to FileChunksPanel so chunk
display is enabled whenever chunks exist, including during embedding and
OpenSearch storage; use chunkCount rather than requiring ready, while still
handling failed or unavailable states appropriately.
In `@frontend/components/knowledge-dropdown.tsx`:
- Around line 465-480: Update the folder upload flow around uploadFiles and
result.previewMode so a false previewMode closes the pre-opened preview dialog
and clears its loading state instead of leaving it without task IDs. Preserve
the existing task ID assignment and refetchTasks behavior when previewMode is
enabled, matching the single-file path’s rejection handling.
- Around line 461-497: Update the folder upload flow around the batches.map
Promise.all block to process batches with a bounded concurrency limit instead of
starting every upload simultaneously. Track failed batch indices or errors while
preserving successful results, then propagate an aggregate failure after
processing completes so callers do not treat partially failed uploads as fully
successful; retain the existing tracking, logging, and toast behavior for each
failure.
In `@frontend/components/knowledge-search-input.tsx`:
- Around line 76-86: Update showClear in the knowledge search input to derive
visibility from inputValue in both controlled and uncontrolled modes, so the
clear button reflects the current typed value before submission. Keep
handleClear’s existing mode-specific clearing behavior unchanged.
In `@frontend/hooks/use-ingest-preview-settings.ts`:
- Around line 50-54: Update the localStorage parsing logic in the ingest preview
settings hook to validate the result of JSON.parse before accessing properties
such as parsed.autoOpen. Treat null and all non-object values as invalid and
return DEFAULT_INGEST_PREVIEW_SETTINGS, while preserving the existing property
extraction for valid objects.
In `@src/services/ingest_preview_service.py`:
- Around line 89-134: Update the preview cache used by store_docling_preview to
automatically evict expired entries and enforce a bounded maximum size, using a
TTL cache or an equivalent periodic eviction mechanism. Replace the global
self._entries scan used to calculate existing with an approach that avoids O(N)
insertion cost while preserving the per-task preview cap and existing retrieval
behavior.
---
Outside diff comments:
In `@frontend/app/settings/`[tab]/page.tsx:
- Around line 18-25: Update the settings route validation around VALID_TABS to
gate “ingest-preview” with isIngestPreviewEnabled(runMode). When the tab is
requested in an unsupported run mode, redirect before rendering the settings or
sample-upload UI; preserve existing behavior for all other tabs and supported
modes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 678c9e1a-3619-4f9c-90c0-226e1359bad0
⛔ Files ignored due to path filters (1)
frontend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (28)
frontend/app/api/queries/useFileScopedChunksQuery.tsfrontend/app/api/queries/useIngestPreviewQuery.tsfrontend/app/knowledge/chunks/page.tsxfrontend/app/settings/[tab]/page.tsxfrontend/app/settings/_components/ingest-preview-settings-section.tsxfrontend/app/settings/_components/settings-nav.tsxfrontend/components/docling-preview.tsxfrontend/components/file-chunks-panel.tsxfrontend/components/ingest-preview-auto-open-control.tsxfrontend/components/ingest-review.tsxfrontend/components/knowledge-dropdown.tsxfrontend/components/knowledge-search-input.tsxfrontend/hooks/use-ingest-preview-settings.tsfrontend/lib/file-chunks.tsfrontend/lib/ingest-preview.tsfrontend/lib/upload-utils.tsfrontend/package.jsonfrontend/types/docling-components.d.tssrc/api/ingest_preview.pysrc/app/container.pysrc/app/routes/internal.pysrc/models/processors.pysrc/services/docling_service.pysrc/services/ingest_preview_service.pysrc/services/langflow_file_service.pysrc/services/task_service.pytests/unit/api/test_ingest_preview.pytests/unit/services/test_ingest_preview_service.py
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/components/docling-preview.tsx`:
- Around line 351-382: Reset fallbackIndex to zero before each of the texts,
tables, and pictures fallback extraction loops in the relevant document
extraction logic. Keep each generated id indexed from zero within its own
collection, while preserving the existing limit checks and result accumulation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e6ba4821-a5bc-4de4-8070-25edb9a3a6dc
📒 Files selected for processing (3)
frontend/components/docling-preview.tsxfrontend/components/ingest-review.tsxfrontend/lib/ingest-preview.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- frontend/lib/ingest-preview.ts
- frontend/components/ingest-review.tsx
dca2fa3 to
ebdcc80
Compare
Summary
Add the ingest review dialog: Docling document view (or DocPage skeleton while loading), index pipeline steps, file-scoped searchable chunks, expand fill layout, and header search / auto-open footer.
Add Ingest preview settings (auto-open Every / First run / Never, chunk/pipeline toggles, sample ingest) gated by OSS/SaaS run mode, with prefs shared via useIngestPreviewSettings.
Reuse FileChunksPanel + controlled search on /knowledge/chunks and in review so paste search filters locally after a file-scoped load.
Wire preview=true uploads from knowledge; extend preview backend for Docling page images / index-proof and related tests.
Test plan
--follow onboarding steps, upload a doc--
and/or
Summary by CodeRabbit