mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 11:17:56 +01:00
- Add Transformers.js for local embeddings generation - Create document upload API with Supabase Storage - Create document processing pipeline (parse, chunk, embed) - Create semantic search API using pgvector - Create RAG chat API combining search + LLM - Add documents page UI with upload, process, and chat - Add database migration for document status columns - Configure Next.js to externalize ONNX packages Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
68 lines
1.3 KiB
TypeScript
68 lines
1.3 KiB
TypeScript
/**
|
|
* Document types for the RAG system
|
|
*/
|
|
|
|
export interface Document {
|
|
id: string;
|
|
user_id: string;
|
|
name: string;
|
|
type: string;
|
|
size_bytes: number;
|
|
storage_path: string;
|
|
status: 'pending' | 'processing' | 'ready' | 'error';
|
|
error_message?: string;
|
|
chunk_count?: number;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface DocumentChunk {
|
|
id: string;
|
|
document_id: string;
|
|
user_id: string;
|
|
content: string;
|
|
embedding: number[];
|
|
metadata: {
|
|
chunk_index: number;
|
|
start_char?: number;
|
|
end_char?: number;
|
|
};
|
|
created_at: string;
|
|
}
|
|
|
|
export interface DocumentUploadResponse {
|
|
success: boolean;
|
|
document?: Document;
|
|
error?: string;
|
|
}
|
|
|
|
export interface DocumentListResponse {
|
|
success: boolean;
|
|
documents?: Document[];
|
|
error?: string;
|
|
}
|
|
|
|
export interface DocumentSearchResult {
|
|
chunk_id: string;
|
|
document_id: string;
|
|
document_name: string;
|
|
content: string;
|
|
similarity: number;
|
|
}
|
|
|
|
export interface SearchResponse {
|
|
success: boolean;
|
|
results?: DocumentSearchResult[];
|
|
error?: string;
|
|
}
|
|
|
|
export type SupportedFileType = 'text/plain' | 'text/markdown' | 'application/pdf';
|
|
|
|
export const SUPPORTED_FILE_TYPES: SupportedFileType[] = [
|
|
'text/plain',
|
|
'text/markdown',
|
|
'application/pdf',
|
|
];
|
|
|
|
export const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
|