Knowledge base manager
A React block (a whole screen) in Beamline's AI workspace app.
What your assistant knows and whether it is fresh: sources with live sync status (syncing with progress, out of date, failed with the reason and Retry), the chunks each source became, and a test bench where you ask a question and see the cited answer beside the chunks it was built from.
Use it for
- The admin screen behind an AI assistant: connect sources, watch them sync, fix failures, and test what the assistant answers from them.
- Any retrieval system whose owners need to see its sources, their freshness and what a question retrieves.
Not for
- The conversation itself (support-chat, agent-workspace).
- Showing what one answer retrieved inside a chat (context-cards).
- A file browser (tree-view, data-grid).
Anatomy
- header: title, totals (sources, chunks rolling as they grow, last sync) and the one primary action, Add source
- sources: a filter (all / needs attention), then one row per source: kind icon, name, where it lives, chunk count, and its state in words with a glyph (synced and when, syncing with a progress bar, queued, out of date with Sync now, failed with the reason and Retry); a row menu syncs or removes
- test bench (tab): a question field and Ask; the answer streams with numbered citations, and the chunks it retrieved sit beside it, scored, the ones the answer used checked
- gaps (on an idle bench): this week's questions with no good answer and how often each was asked, each with Test
- chunks (tab): the selected source's chunks with a search that marks the words
Variants
- 0: room: one column under 48rem (sources, then the bench); sources and bench side by side from 48rem; chunks in a grid from 64rem
States
- loading (skeleton rows)
- no sources yet (what goes here, Add source)
- every source synced / some need attention (the filter counts them)
- source syncing (progress, or a moving bar when the total is unknown), queued, out of date, failed
- chunk count unknown (—)
- test: idle (suggested questions), searching, answering, answered, nothing relevant found (says so and which sources were searched), error with Retry
Keyboard
- Sources are a list of buttons: Tab or arrows reach each, Enter selects it for the Chunks tab
- Each row's menu: Enter or Space opens; Sync now and Remove
- Question field: Enter asks
- Tabs: arrows move between Test and Chunks
Motion
A syncing source fills its bar and its chunk count rolls up; when it finishes the spinner closes into a check and the words morph (Syncing → Synced just now). A new answer flows in at reading pace, then its sources list arrives. Rows that change state never move. Idle: nothing runs.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
sources (required) | KnowledgeSource[] | — | Sources managed by the knowledge index, with their sync state and chunk counts. Required. |
chunks | ContextChunk[] | null | — | Chunks of the selected source; null while they load. |
test | KnowledgeTest | — | Current test question, streamed answer and retrieval results; defaults to null before a test. |
suggestions | string[] | — | Questions to try on an empty bench. |
gaps | { question: string; count: number }[] | — | Questions customers asked that found no good answer, most asked first: the gaps to fill. |
loading | boolean | — | Shows the loading state while data or an operation is pending. Defaults to false. |
onAsk | (question: string) => void | — | Runs the request using the entered question; no handler by default. |
onSync | (id: string) => void | — | Sync one source now (also Retry for a failed one). |
onRemove | (id: string) => void | — | Runs the remove action for the chosen item; no handler by default. |
onAddSource | () => void | — | Starts adding a knowledge source; no handler by default. |
className / classNames / style / ref | string / KnowledgeBaseClassNames / CSSProperties / Ref<HTMLElement> | — | className: Classes on the documented visual root; no override by default. classNames: Classes for the named visual parts; no part overrides by default. style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default. |
selected | string[] (legacy: string) | — | Stable selected row IDs. Legacy scalar selected opens a record; use openSource for that. |
defaultSelected | string[] (legacy: string) | — | Initial selected row IDs; defaults to an empty list. |
onSelectedChange | ((ids: string[]) => void) | — | Reports selected row IDs; opening a record uses onOpenSourceChange. |
title | string | — | Title over the screen. Default "Knowledge base". |
className | string | — | Classes on the documented visual root; no override by default. |
classNames | Partial<Record<"root" | "header" | "title" | "filter" | "answer" | "source" | "grid" | … | — | Classes for the named visual parts; no part overrides by default. |
style | CSSProperties | — | Inline styles on the documented visual root; no inline overrides by default. |
ref | Ref<HTMLElement> | — | Receives the documented root element; no ref by default. |
sort | ListSort | — | |
manual | boolean | — | Server owns ordering, filters, search and page slicing. Default false. |
total | number | null | — | Deprecated: Use rowCount. Canonical rowCount wins, including null. |
error | ReactNode | Error | — | Errors retain the last completed rows. Error objects are rendered by their message. |
onQueryChange | ((query: string) => void) | — | |
page | number | — | One-based requested page. Default 1. |
filters | ListFilters | — | |
query | string | — | |
onRetry | (() => void | Promise<unknown>) | — | |
defaultSort | ListSort | — | |
onSortChange | ((sort: ListSort) => void) | — | |
defaultFilters | ListFilters | — | |
onFiltersChange | ((filters: ListFilters) => void) | — | |
defaultQuery | string | — | |
selectable | boolean | — | |
emptyLabel | string | — | |
allowSelectAllMatching | boolean | — | |
onSelectAllMatching | ((scope: { rowCount: number; query: string; filters: ListFilters; }) => void) | — | |
pagination | boolean | — | Enable page controls explicitly. Page-related props also enable them, unless onEndReached is supplied. |
defaultPage | number | — | |
onPageChange | ((page: number) => void) | — | |
pageSize | number | — | Positive rows per page. Default 25. |
defaultPageSize | number | — | |
onPageSizeChange | ((pageSize: number) => void) | — | |
rowCount | number | null | — | Total matching rows on the server. null means unknown. Local grids calculate it before slicing. |
onEndReached | (() => void | Promise<unknown>) | — | Append mode: fetch another batch. The app appends it to the supplied rows. |
hasMore | boolean | — | Whether another batch exists; defaults to true with onEndReached. False stops requests. |
loadingMore | boolean | — | An append request is pending; retain every loaded row. |
openSource | string | null | — | |
defaultOpenSource | string | null | — | |
onOpenSourceChange | ((id: string | null) => void) | — |
Built from
- item
- badge
- progress
- spinner
- text-morph
- chip-group
- tabs
- search-field
- input
- button
- dropdown-menu
- citations
- context-cards
- text-shimmer
- empty-state
- skeleton
- slot-text
Dependencies
lucide-react
Import
import { KnowledgeBase } from "@beamline/knowledge-base";
Get it
Knowledge base manager is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent
More in AI workspace
- AI agent workspace: Threads, a conversation that opens on the thread's earlier turns (each with its trace, the tools the agent called, a cited answer and any table it…
- Agent runs monitor: Every run of your agents in one place: success rate, run time, tokens and spend; the last runs as a strip of status blocks; a live table where running…
- Agent monitor: Agents in production and on test. Monitor shows every agent or one over 24 hours, 7 or 14 days: runs, tokens, estimated cost and average run time counted…
- Conversation history: Past conversations with an assistant, ready to pick up again: the list by day with bookmarks and unsent drafts, a search through every message that…
- Reading library: A read-it-later library: saved views that are live filters (a query with every unreadable part named, the number that matches now, saved with a name; a…
- Artifact workbench: Where the things an assistant makes are checked before they leave: every document, piece of code, small app and data result from a conversation, each…
- AI image studio: Write a prompt, pick a shape, a style and how many, and watch the variations generate side by side; each one opens full screen and can be upscaled or…
- Voice agent: A voice agent in three layouts on one session: a workspace with the agent's orb large on a stage (the line being said shows under it, questions to ask…
- Model playground: Try one prompt on up to three models side by side: pick each model with its price and speed in view, set the system prompt, temperature and length once…
- Model inspector: A design model's objects without needing the 3D view: the model tree, where objects with the same name are told apart by id and path; the selected…
- Model issues: Issues pinned to the objects of a design model. The queue says the scope beside every count (open in the project, on the loaded models, on this version)…
- Agent builder: An agent's configuration beside an assistant that proposes tools. Ask for what the agent should do and the assistant's proposal lists each tool with why…
- Workflow composer: A workflow drafted from a sentence and finished by hand. The prompt drafts steps that arrive one by one on the graph (a draft cut short keeps what came…
- Data binding: Bind an object's properties to a view model. Each property says whether it is bound, incomplete or mismatched. A binding takes its source from the…