feat(lightspeed): creating a new notebook and upload the documents#2704
feat(lightspeed): creating a new notebook and upload the documents#2704its-mitesh-kumar wants to merge 6 commits intoredhat-developer:mainfrom
Conversation
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
Review Summary by QodoImplement notebook creation and document upload functionality
WalkthroughsDescription• Add notebook creation and document upload flow • Implement document management API methods and hooks • Add file validation and upload utilities with constraints • Extend UI with notebook view, sidebar, and upload modal • Add multilingual translations for notebook features Diagramflowchart LR
A["User Creates Notebook"] -->|createSession| B["NotebooksApiClient"]
B -->|API Call| C["Backend Session"]
C -->|SessionResponse| B
B -->|NotebookSession| D["NotebookView Component"]
E["User Uploads Document"] -->|uploadDocument| B
B -->|FormData| F["Backend Upload"]
F -->|UploadDocumentResponse| B
B -->|Poll Status| G["Document Status"]
G -->|DocumentStatus| H["UI Updates"]
D -->|Display| H
File Changes1. workspaces/lightspeed/plugins/lightspeed/src/api/NotebooksApiClient.ts
|
Code Review by Qodo
|
| export const NOTEBOOK_MAX_FILES = 10; | ||
| export const NOTEBOOK_MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024; // 25 MB | ||
| export const UNTITLED_NOTEBOOK_NAME = 'Untitled Notebook'; | ||
|
|
||
| export const NOTEBOOK_ALLOWED_EXTENSIONS: Record<string, string[]> = { | ||
| 'text/plain': ['.txt', '.log'], | ||
| 'text/markdown': ['.md'], | ||
| 'application/pdf': ['.pdf'], | ||
| 'application/json': ['.json'], | ||
| 'application/x-yaml': ['.yaml', '.yml'], | ||
| 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [ | ||
| '.docx', | ||
| ], | ||
| 'application/vnd.oasis.opendocument.text': ['.odt'], | ||
| }; | ||
|
|
||
| export const NOTEBOOK_EXTENSION_TO_FILE_TYPE: Record<string, string> = { | ||
| '.txt': 'txt', | ||
| '.md': 'md', | ||
| '.pdf': 'pdf', | ||
| '.json': 'json', | ||
| '.yaml': 'yaml', | ||
| '.yml': 'yaml', | ||
| '.log': 'log', | ||
| '.docx': 'txt', | ||
| '.odt': 'txt', | ||
| }; |
There was a problem hiding this comment.
1. Upload limits/type mismatch 🐞 Bug ≡ Correctness
Notebook upload validation allows .docx/.odt and 25MB files, but the backend only supports md/txt/pdf/json/yaml/yml/log/url and enforces a 20MB multipart limit; this will cause confusing client-side acceptance followed by server-side failures or ingestion of binary files as UTF-8 text. This is user-facing breakage for common formats and makes the displayed error/help text incorrect.
Agent Prompt
### Issue description
The frontend notebook uploader allows file types and sizes that the backend will not accept/handle correctly (docx/odt allowed + 25MB limit), leading to failed uploads or garbled document content.
### Issue Context
Backend upload limit is 20MB and backend-supported notebook file types exclude docx/odt.
### Fix Focus Areas
- workspaces/lightspeed/plugins/lightspeed/src/const.ts[36-62]
- workspaces/lightspeed/plugins/lightspeed/src/utils/notebook-upload-utils.ts[17-94]
- workspaces/lightspeed/plugins/lightspeed/src/translations/ref.ts[71-82] (and other locales)
### What to change
- Remove `.docx`/`.odt` from `NOTEBOOK_ALLOWED_EXTENSIONS` and from `NOTEBOOK_EXTENSION_TO_FILE_TYPE` (or, if docx/odt support is desired, add real backend support + extend backend `SupportedFileType` and parsing).
- Change `NOTEBOOK_MAX_FILE_SIZE_BYTES` to match backend (20 * 1024 * 1024), or fetch the limit from config/server and use that consistently.
- Update upload modal info text and `notebook.upload.error.fileTooLarge` translations to match the real enforced limit.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
@JslYoon We will be supporting .docx/.odt and 25MB files in the backend too. Please do make required changes.
workspaces/lightspeed/plugins/lightspeed/src/components/notebooks/NotebookView.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
|
@JslYoon While making the Screen.Recording.2026-04-08.at.6.59.09.PM.mov |
|
@aprilma419 watch the recordings and let me the concerns you have on it. Except the documents count on the notebook list. |
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
This is not a bug and known problem. this happens when you reload/restart rhdh-plugins when you upload the file. So the metadata isn't updated but the file is updated because llama-stack processes that. So it should be fine |
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
|
|
LGTM! The only concern I have is whether we need to show the successful alerts for each source uploaded. Maybe getting rid of the alerts is fine. If a source is failing to upload, the inline alert in the modal would tell. |



Description
Adds notebook creation and document upload functionality to the Lightspeed plugin. Users can create new notebook sessions, upload documents with file type/size validation and drag-and-drop support, and track upload progress via real-time status polling. The notebook detail view includes a collapsible document sidebar displaying uploaded and in-progress documents. An overwrite confirmation modal handles duplicate file uploads.
Fixed
UI after changes
Screen.Recording.2026-04-08.at.7.20.14.PM.mov
Screen.Recording.2026-04-08.at.7.23.28.PM.mov
Steps to Test
1. Set up Lightspeed Stack
In the lightspeed-stack repo, open
lightspeed-stack.yaml:http://localhost:83212. Clone the Llama Stack Distribution
3. Update Distribution Config
Replace the contents of distribution/config.yaml with the project-specific configuration.
4. Add Environment File
Create a .env file at the root of the cloned repository with the required environment variables.
5. Run Llama Distribution
6. Start the Plugin
In the rhdh-plugins repo, ensure the following is present in workspaces/lightspeed/app-config.yaml:
Then start the application:
✔️ Checklist