Skip to content

Faculty Knowledge Base

The Knowledge Base is where trainers upload reference material and browse it across two scopes, institutional and personal. It is the curated corpus the AI tutor reads from via RAG retrieval. School admins manage institutional documents.

How it works

Trainers upload local files or import from Google Drive. Each document moves through an async pipeline (pending → processing → completed) that OCRs, chunks, and embeds the content so it becomes retrievable by the AI tutor.

The page has a search box above a subject / type / status filter row, so a trainer with 30+ documents can find one by typing instead of scrolling:

  • A <SearchInput> from @kwilo/ui sits above the filters.
  • Input is debounced (SEARCH_DEBOUNCE_MS) and only sent once it clears MIN_SEARCH_QUERY_LENGTH (both from @/constants/timing); below that, q is omitted.
  • Search is server-side: the debounced value goes to the list endpoint as the q query param (title / filename substring match), alongside subject_name, document_type, status, scope, and pagination. It is not client-side filtering.
  • q counts toward the active-filters state, so a non-empty search participates in "clear filters".

Scope: there is no inline document reader, no folders or collections, and no semantic/vector search from this page. The q param is substring match only; semantic retrieval is the separate backend RAG pipeline. Learners have no access to the Knowledge Base, and it is web-only.

Where it lives

Route: /knowledge-base.

  • apps/web/src/pages/shared/KnowledgeBasePage/index.tsx: list page; SearchInput, useDebounce, server-side q
  • apps/web/src/services/knowledge-base/index.ts: API surface (listDocuments, uploadDocument, importFromGDrive)
  • apps/web/src/components/knowledge-base/UploadModal.tsx, GDriveImportModal.tsx: upload entry points
  • apps/web/src/constants/timing.ts: SEARCH_DEBOUNCE_MS, MIN_SEARCH_QUERY_LENGTH