Reference
TypeScript Types
Complete reference for all TypeScript types and interfaces used throughout the NotebookLLM frontend.
Overview
TypeScript types are organized across several modules:
frontend/lib/types.tsGeneral application types
frontend/lib/types-gdrive.tsGoogle Drive integration types
frontend/lib/api/types.tsAPI request/response types
Core Application Types
Source Types
// Source type for documents
type SourceType = "pdf" | "doc" | "image" | "video" | "audio" | "link" | "text" | "file"
// Document processing status
type SourceStatus = "pending" | "processing" | "completed" | "failed"
// Source/document interface
interface Source {
id: string
name: string
type: SourceType
status?: SourceStatus
chunkCount?: number
mimeType?: string
errorMessage?: string | null
preview?: string | null
}Notebook Types
// RAG settings for a notebook
interface NotebookRAGSettings {
chunk_size?: number
chunk_overlap?: number
top_k_results?: number
enable_query_fusion?: boolean
fusion_num_queries?: number
use_hyde?: boolean
enable_reranking?: boolean
reranker_top_n?: number
default_alpha?: number
use_sentence_window?: boolean
sentence_window_size?: number
response_mode?: "compact" | "tree_summarize" | "refine"
streaming?: boolean
prompt_style?: "citation" | "conversational" | "neutral"
}
// Notebook interface
interface Notebook {
id: string
user_id: string
title: string
settings: NotebookRAGSettings
created_at: string
updated_at: string
source_count?: number
}
// Request types
interface CreateNotebookRequest {
title: string
settings?: NotebookRAGSettings
}
interface UpdateNotebookRequest {
title?: string
settings?: NotebookRAGSettings
}Document Types
// Document processing status
type DocumentStatus = "pending" | "processing" | "completed" | "failed"
// Document in a notebook
interface Document {
id: string
notebook_id: string
filename: string
file_path: string
mime_type: string
status: DocumentStatus
error_message: string | null
chunk_count: number
preview?: string | null
created_at: string
}
// Upload response
interface UploadDocumentResponse {
status: string
document_id: string
notebook_id: string
filename: string
file_path: string
mime_type: string
processing_status: DocumentStatus
chunk_count: number
created_at: string
}
// URL for document preview
interface DocumentUrlResponse {
url: string
expires_in: number
}Chat Types
Messages & Citations
// Citation from document
interface Citation {
id: string
message_id: string
document_id: string
filename?: string
text_preview: string
score: number
page_number: number | null
}
// Chat message
interface ChatMessage {
id: string
notebook_id: string
role: "user" | "assistant"
content: string
created_at: string
citations: Citation[]
}
// Request/response
interface SendMessageRequest {
message: string
stream?: boolean
}
interface ChatResponse {
role: "assistant"
content: string
citations: Citation[]
}Suggested Questions
// AI-generated question
interface SuggestedQuestion {
id: string
text: string
context: string | null
}
// Suggestions response
interface SuggestionsResponse {
questions: SuggestedQuestion[]
generated_at: string
document_count: number
}
// Conversation-based suggestions
interface ConversationSuggestionsResponse {
questions: string[]
}Content Generation Types
Content Types
// Available content types
type ContentType = "podcast" | "quiz" | "flashcard" | "mindmap" | "note"
// Generation request
interface GenerateContentRequest {
content_type: ContentType
document_ids?: string[] | null
}
// Async generation response
interface AsyncGenerationResponse {
status: "queued"
task_id: number
content_id: string
message: string
}
// Generated content status
type GeneratedContentStatus = "queued" | "processing" | "completed" | "failed"Content Structures
// Flashcard content
interface FlashcardContent {
id: string
question: string
answer: string
}
interface FlashcardDeckContent {
title: string
flashcards: FlashcardContent[]
}
// Quiz content
interface QuizQuestion {
question: string
options: string[]
correct_answer: number
explanation: string
}
interface QuizContent {
title: string
questions: QuizQuestion[]
}
// Mind map content
interface MindmapNode {
id: string
label: string
children: MindmapNode[]
}
interface MindmapContent {
title: string
nodes: MindmapNode[]
}
// Podcast content
interface PodcastDialogue {
speaker: string
text: string
}
interface PodcastContent {
title: string
dialogue: PodcastDialogue[]
}
// Complete generated content
interface GeneratedContent {
id: string
notebook_id: string
content_type: ContentType
status: GeneratedContentStatus
content: PodcastContent | QuizContent | FlashcardDeckContent | MindmapContent | null
audio_url?: string
created_at: string
}Task Queue Types
// Task status
type TaskStatus = "todo" | "doing" | "succeeded" | "failed" | "aborted"
// Task status response
interface TaskStatusResponse {
job_id: number
status: TaskStatus
queue_name: string
task_name: string
attempts: number
scheduled_at: string
error: string | null
result: unknown | null
}
// Task progress
interface TaskProgressResponse {
job_id: number
status: TaskStatus
progress: number
message: string
started_at: string
updated_at: string
}Health Check Types
interface HealthResponse {
status: "healthy" | "unhealthy"
timestamp: string
response_time_ms: number
services: {
database: { status: string; details?: string }
vector_database: { status: string; details?: string; vectors_count?: number }
storage: { status: string; details?: string; provider?: string }
llm_provider: { status: string; provider?: string; model?: string }
}
environment: string
version: string
}Feedback Types
// Content types that can be rated
type FeedbackContentType =
| "chat_response"
| "podcast"
| "quiz"
| "flashcard"
| "mindmap"
| "note"
// Rating values
type FeedbackRating = "thumbs_up" | "thumbs_down"
// Feedback request
interface FeedbackCreateRequest {
content_type: FeedbackContentType
content_id: string
rating: FeedbackRating
comment?: string
}
// Feedback response
interface FeedbackResponse {
id: string
user_id: string
content_type: FeedbackContentType
content_id: string
rating: FeedbackRating
comment: string | null
created_at: string
updated_at: string
}
// Feedback status
interface FeedbackStatusResponse {
has_feedback: boolean
feedback: FeedbackResponse | null
}Google Drive Types
// Google Drive file types
type GoogleDriveFileType =
| "folder"
| "pdf"
| "doc"
| "sheet"
| "slide"
| "image"
| "video"
| "audio"
| "text"
| "file"
// Google Drive file
interface GoogleDriveFile {
id: string
name: string
mimeType: string
type: GoogleDriveFileType
size?: string | number
sizeBytes?: number
thumbnailUrl?: string | null
webViewUrl?: string
createdTime?: string
modifiedTime?: string
parents?: string[]
owner?: { displayName?: string; email?: string }
indexed?: boolean
status?: "idle" | "indexing" | "indexed" | "error"
errorMessage?: string | null
}
// Folder with breadcrumb path
interface GoogleDriveFolder {
id: string
name: string
path: string
}
// Auth status
interface GoogleDriveAuthStatus {
configured: boolean
connected: boolean
email: string | null
}
// Import progress
interface GoogleDriveImportProgress {
fileId: string
fileName: string
status: "pending" | "importing" | "completed" | "failed"
progress: number
error?: string
}Pagination Types
// Cursor-based pagination
interface CursorPage<T> {
items: T[]
next_cursor: string | null
previous_cursor: string | null
total_count: number
has_more: boolean
}