use serde::{Deserialize, Serialize}; /// The type of file stored in the knowledge base. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum FileKind { /// PDF document Pdf, /// Plain text or markdown file Text, /// Spreadsheet (csv, xlsx) Spreadsheet, /// Source code file Code, /// Image file Image, } impl FileKind { /// Returns the display label for a file kind. pub fn label(&self) -> &'static str { match self { Self::Pdf => "PDF", Self::Text => "Text", Self::Spreadsheet => "Spreadsheet", Self::Code => "Code", Self::Image => "Image", } } /// Returns an icon identifier for rendering. pub fn icon(&self) -> &'static str { match self { Self::Pdf => "file-pdf", Self::Text => "file-text", Self::Spreadsheet => "file-spreadsheet", Self::Code => "file-code", Self::Image => "file-image", } } } /// A file stored in the knowledge base for RAG retrieval. /// /// # Fields /// /// * `id` - Unique file identifier /// * `name` - Original filename /// * `kind` - Type classification of the file /// * `size_bytes` - File size in bytes /// * `uploaded_at` - ISO 8601 upload timestamp /// * `chunk_count` - Number of vector chunks created from this file #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct KnowledgeFile { pub id: String, pub name: String, pub kind: FileKind, pub size_bytes: u64, pub uploaded_at: String, pub chunk_count: u32, }