RAG UI refactor - #857
Merged
Merged
Conversation
- Introduced tests for resolved-configuration and index-status endpoints to ensure proper rendering and functionality. - Enhanced session validation tests to check for missing required parameters and defaulted parameters. - Added tests for chunking presets to verify correct responses and localization. - Improved document extractor API tests to ensure proper rejection messages for unsupported file types. - Updated task metadata tests to include entry points for various tasks.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
There are a few correctness/UX issues in the new/updated flows (notably ambiguous prompt_id handling, undercounted prompt budget math, and an avoidable redirecting sessions API call) that should be addressed before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors RAG (Retrieval-Augmented Generation) backend + frontend integration so the backend returns fully resolved, localized configuration/preset data and the frontend treats RAG as a standalone “entry point” with its own scoped session list and routes.
Changes:
- Added unified backend localization (
localize) and expanded RAG backend APIs (presets, session defaults, resolved configuration, index status). - Updated RAG session validation to apply backend defaults (and generation-model schema defaults) prior to download/dependency checks, and improved unsupported document-type errors.
- Frontend refactor to make RAG a standalone entry point (new pages/routes/providers), consume resolved configuration from the backend, and improve upload/session UX.
File summaries
| File | Description |
|---|---|
| tests/back/tasks/test_tasks.py | Updates task metadata expectations to include entry_point. |
| tests/back/RAG/test_RAG_strict_validation.py | Adjusts strict validation to allow generation-model param defaulting and asserts defaults are applied. |
| tests/back/RAG/test_RAG_session_validation.py | Updates session validation expectations for defaulted vs required parameter keys. |
| tests/back/RAG/test_RAG_session_configuration_api.py | Adds tests for resolved configuration + index-status endpoints. |
| tests/back/RAG/test_document_extractor_api.py | Adds coverage for improved unsupported-upload error details and no-extension rejection. |
| tests/back/RAG/test_chunking_presets.py | Adds tests for chunking presets, localization, and session-default behavior. |
| DashAI/front/src/utils/apiError.js | Adds helper to extract user-facing error messages from API failures. |
| DashAI/front/src/types/retrieverPreset.ts | Extends retriever preset typing with backend-provided display_name. |
| DashAI/front/src/types/ragConfiguration.ts | Adds types for resolved RAG configuration, presets, defaults, and index status. |
| DashAI/front/src/pages/generative/SessionRouter.jsx | Redirects RAG sessions to canonical standalone route and localizes “not found”. |
| DashAI/front/src/pages/generative/RAGSession/sections/PromptSection.jsx | Removes legacy prompt section implementation (backend-resolved config flow). |
| DashAI/front/src/pages/generative/RAGSession/sections/GeneratorSection.jsx | Removes legacy generator section implementation (backend-resolved config flow). |
| DashAI/front/src/pages/generative/RAGSession/sections/ChunkingSection.jsx | Removes legacy chunking section implementation (preset-driven backend flow). |
| DashAI/front/src/pages/generative/RAGSession/components/SectionCard.jsx | Removes legacy section wrapper component. |
| DashAI/front/src/pages/generative/RAGSession/components/RAGCard.jsx | Removes legacy accordion card component. |
| DashAI/front/src/pages/generative/RAGSession/components/PresetCard.jsx | Removes legacy preset-card component. |
| DashAI/front/src/pages/generative/RAGSession/components/GeneratorBody.jsx | Removes legacy generator UI body component. |
| DashAI/front/src/pages/generative/RAGSession/components/AdvancedConfigCard.jsx | Removes legacy “advanced config applied” indicator card. |
| DashAI/front/src/pages/generative/RAG/RAGHomePage.jsx | Adds standalone RAG home entry point page. |
| DashAI/front/src/pages/generative/RAG/RAGCreatePage.jsx | Adds standalone minimal RAG session creation page (name + docs + model). |
| DashAI/front/src/hooks/generative/useTaskDisplayName.js | Adds hook to show backend-localized task names in the UI. |
| DashAI/front/src/hooks/generative/useSessions.js | Adds backend-driven session filtering (e.g., by task_name). |
| DashAI/front/src/components/threeSectionLayout/GroupedCollapsibleList.jsx | Flattens rendering for single-group lists and refactors item rendering helper. |
| DashAI/front/src/components/generative/standaloneEntryPoints.js | Adds frontend map for standalone tasks (routes + icons). |
| DashAI/front/src/components/generative/SessionBar.jsx | Routes session clicks to standalone task routes and supports custom title. |
| DashAI/front/src/components/generative/RAG/RAGDocumentsPanel.jsx | Passes task name constant and index status into documents UI. |
| DashAI/front/src/components/generative/RAG/RAGBreadcrumbs.jsx | Normalizes RAG routes (lowercase) and updates task selection behavior. |
| DashAI/front/src/components/generative/RAG/PromptParamsCard.jsx | Updates prompts navigation route casing to canonical /rag/.... |
| DashAI/front/src/components/generative/RAG/GeneratorPicker.jsx | Adds unified generator model picker with download/credential gating. |
| DashAI/front/src/components/generative/RAG/DocumentTable.jsx | Improves upload error reporting via snackbar and extracted API messages. |
| DashAI/front/src/components/generative/RAG/DocumentSelector.jsx | Improves upload error reporting via snackbar and extracted API messages. |
| DashAI/front/src/components/generative/RAG/DocumentsBar.jsx | Canonicalizes routes, adds per-document index badge support, improves upload error messaging. |
| DashAI/front/src/components/generative/RAG/DocumentListItem.jsx | Adds indexed/not-indexed chip with chunk counts. |
| DashAI/front/src/components/generative/RAG/DocumentList.jsx | Threads index-state map through to list items. |
| DashAI/front/src/components/generative/GenerativeContext.jsx | Adds provider-level session filtering and fixes fetch effect dependencies. |
| DashAI/front/src/components/generative/GenerativeChat.jsx | Adds indexing-in-progress hint when RAG is not yet indexed. |
| DashAI/front/src/components/generative/CreateSessionRight.jsx | Removes RAG-specific info bar from generic session creation flow. |
| DashAI/front/src/components/generative/CreateSessionLanding.jsx | Adds standalone task tiles alongside “create session” on landing. |
| DashAI/front/src/components/generative/CreateSessionContext.jsx | Excludes standalone tasks from the shared model gallery. |
| DashAI/front/src/components/generative/CreateSessionCenter.jsx | Removes embedded RAG setup from generic creation flow. |
| DashAI/front/src/App.jsx | Adds canonical standalone RAG routes and scopes them via a filtered provider. |
| DashAI/front/src/api/session.ts | Adds optional server-side filtering to sessions API call. |
| DashAI/front/src/api/rag.ts | Adds RAG constants and new APIs for presets/defaults/config/index status. |
| DashAI/front/src/api/job.ts | Removes dedicated RAG job enqueue call (likely superseded by generic job flow). |
| DashAI/back/tasks/RAG_task.py | Marks RAG task as ENTRY_POINT = "standalone". |
| DashAI/back/tasks/base_generative_task.py | Introduces ENTRY_POINT and returns it via task metadata. |
| DashAI/back/services/RAG/session_validation_service.py | Applies backend defaults, resolves generation-model defaults, and reorders download checks. |
| DashAI/back/services/RAG/session_defaults_service.py | New service to construct backend-resolved default RAG parameters. |
| DashAI/back/services/RAG/session_configuration_service.py | New service to return UI-ready resolved configuration + context budget. |
| DashAI/back/services/RAG/retriever_presets.py | Refactors preset resolution, adds localized names, adds matching + top_k helpers. |
| DashAI/back/services/RAG/index_status_service.py | New service to report indexed/stale/not-indexed state without mutating. |
| DashAI/back/services/RAG/chunking_service.py | Exposes chunk-set signature builder publicly for read-only callers. |
| DashAI/back/services/RAG/chunking_presets.py | New localized backend-owned chunking preset recipes. |
| DashAI/back/models/RAG/RAG_pipeline.py | Changes default retriever placeholder to BM25. |
| DashAI/back/models/RAG/documents/file_type.py | Adds supported_extensions() helper for clearer error messages. |
| DashAI/back/models/RAG/chunking_models/token_chunk_model.py | Adds localized aliases/descriptions plus CHUNK_UNIT="tokens" and model metadata. |
| DashAI/back/models/RAG/chunking_models/character_chunk_model.py | Updates placeholders + adds localized aliases/descriptions and model metadata. |
| DashAI/back/models/RAG/chunking_models/base_chunking_model.py | Adds CHUNK_UNIT to identify chunk-size unit. |
| DashAI/back/core/utils.py | Adds localize() utility to collapse MultilingualString in responses. |
| DashAI/back/core/schema_fields/defaults.py | Adds resolve_component_defaults() for schema placeholder resolution. |
| DashAI/back/core/schema_fields/init.py | Exports resolve_component_defaults from schema_fields package. |
| DashAI/back/api/api_v1/endpoints/rag.py | Expands RAG endpoints and ensures responses are localized + resolved. |
| DashAI/back/api/api_v1/endpoints/generative_session.py | Adds task_name filtering, localizes task display_name, and reorders RAG validation vs download checks. |
| DashAI/back/api/api_v1/endpoints/documents.py | Improves unsupported-type error detail with supported extension list. |
| DashAI/back/api/api_v1/endpoints/components.py | Replaces ad-hoc language filtering with localize(). |
Review details
- Files reviewed: 78/78 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
i18next resolves a key called with `count` through its plural suffixes, so a flat `chunkCount` is invisible both to it and to `i18next-cli status`, which is what turns check-translations red and blocks the merge. Each locale gets the forms its own plural rule defines; Chinese has only `other`. This also fixes the English reading "1 chunks".
`getComponentCredentialState` already joins the required platforms into a string, so calling `.join` on it again raises "requiredPlatforms.join is not a function" while rendering, and the whole configuration panel goes down with it. Every other caller in the codebase interpolates the value as the string it is. The path is an ordinary one: pick a generation model whose required credential has not been configured yet, which is precisely the case the warning exists to explain.
On mount the picker answers the availability question from an empty list, so `selected` is null and it reports "unavailable" before it can possibly know. The panel that listens uses that answer to gate its save button, and keeps it after the picker unmounts with its section collapsed. Opening and closing the model section before the fetch returns therefore leaves the save button dead, with the one component that would explain why no longer on screen. Waiting for the list first removes the premature answer; a model that really is unavailable still reports so.
Both call sites handed `detail` straight to the snackbar. FastAPI sends an object for its richer errors and a list for a validation failure, and React renders neither, so the one moment the user needs to read what went wrong is the moment the view can break instead. `getApiErrorMessage` already covers all three shapes and is what the document components use; these were the two places left out.
cristian-tamblay
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the backend, focusing on localization, configuration resolution, and API enhancements for RAG (Retrieval-Augmented Generation) workflows. The most significant changes include the introduction of a unified localization utility, new endpoints for RAG session configuration and status, and a utility for resolving component schema defaults. Additionally, API responses are now consistently localized, and error messages for unsupported document types have been improved.
Localization improvements:
localizefunction incore/utils.pythat recursively replaces everyMultilingualStringwith its localized string based on theAccept-Languageheader, ensuring all API responses are language-specific and never expose raw language objects. Existing ad-hoc localization logic was replaced with this utility throughout the API endpoints. [1] [2] [3] [4] [5] [6] [7] [8] [9]RAG API and configuration enhancements:
Expanded the
rag.pyendpoints to include chunking presets, session defaults, resolved session configuration, and session index status. All responses are now pre-localized and fully resolved, allowing the frontend to render data directly without additional processing.Added filtering by
task_nameto the generative session listing endpoint, allowing clients to query sessions for a specific task or all tasks. [1] [2]Component schema defaults resolution:
resolve_component_defaultsincore/schema_fields/defaults.py, a utility to resolve component schema placeholders into complete parameter dictionaries, including nested components. This ensures the backend can generate ready-to-use configurations for components. [1] [2]Error handling improvements:
RAG session creation logic:
These changes collectively improve the robustness, internationalization, and usability of the backend APIs, especially for RAG workflows.