The Library is the user's personal file surface for general AI chats. It collects files that come from non project chats, including uploaded attachments, long pasted text saved as files, and generated images.
Project source files stay inside their project workspace instead. This keeps project context separate from the user's general chat library.
What It Includes
- Library dashboard page.
- Grid and list oriented loading states.
- Image preview dialog.
- File downloads.
- Single item delete.
- Multi select actions.
- Bulk download and bulk delete support.
- Generated images from AI tools.
- Uploaded chat attachments.
- Private file access through app controlled routes.
Main Files
| Area | File |
|---|---|
| Dashboard page | src/app/(app)/dashboard/library/page.tsx |
| Main UI | src/features/library/components/dashboard-library.tsx |
| Item rendering | src/features/library/components/dashboard-library-items.tsx |
| Grid card | src/features/library/components/library-grid-card.tsx |
| Item menu | src/features/library/components/library-item-menu.tsx |
| Image preview | src/features/library/components/library-image-preview-dialog.tsx |
| API client | src/features/library/api/library.api.ts |
| Repository | src/features/library/repositories/library.repository.ts |
| Types | src/features/library/types/library.types.ts |
Library UI state is owned by src/features/library/hooks/use-dashboard-library-state.ts.
Data Flow
The Library API client has two primary operations:
listLibraryItemsApideleteLibraryItemApi
The route constants live in ApiRoutes.library, and the feature client calls apiRequest so errors are handled consistently.
The repository reads user owned library items and deletes selected items. When a library item is deleted, related message source cleanup keeps old chat messages from pointing at files that no longer exist.
Library And Projects
The split between Library and Project Sources is intentional.
Use Library for files created in general chats. Use Project Sources for files that should stay scoped to one project and feed that project's AI context.
Generated images are added to the Library because they are user owned outputs from the assistant. Project source files are added from the project workspace because they are reusable context for that project.
Where To Customize
src/features/library/componentsfor Library UI.src/features/library/hooks/use-dashboard-library-state.tsfor selection and view state.src/features/library/api/library.api.tsfor client API calls.src/features/library/repositories/library.repository.tsfor database behavior.src/features/library/utilsfor formatting and download helpers.src/components/ui/icons/library.icon.tsxfor the local Library icon.
When adding new file actions, keep storage permissions, Library state, and chat source cleanup in sync.