Commit graph

12 commits

Author SHA1 Message Date
Brandon Wolfgang
da134a1689 feat: implement semantic document search
- Generate query embeddings using Ollama and normalize search input
- Retrieve the most similar chunks from completed documents using pgvector cosine distance
- Support configurable result limits from 1 to 20, defaulting to 5
- Add tests for query validation, vector search, result limits, and embedding errors
- Inject embedding and database query dependencies for isolated testing
2026-10-22 11:10:10 -05:00
Brandon Wolfgang
05f6583870 test: add document ingestion endpoint coverage
- Add tests for successful document ingestion and response payloads
- Verify invalid document input returns HTTP 400 without invoking ingestion
- Verify ingestion failures return sanitized HTTP 503 responses
- Inject the ingestion function through buildApp for isolated testing
- Increase the maximum document source length to 2,000 characters
2026-10-22 10:43:35 -05:00
Brandon Wolfgang
4515897acd feat: add document ingestion endpoint
- Implement document ingestion with text chunking, embedding generation, and database persistence
- Validate document titles, sources, and content before processing
- Add POST /documents returning the document ID and chunk count on success
- Return sanitized validation and ingestion errors
- Log ingestion failures for server-side diagnostics
2026-10-22 10:30:37 -05:00
Brandon Wolfgang
61978acb02 feat: add PostgreSQL document persistence
- Configure a shared PostgreSQL connection pool with connection and idle timeouts
- Add repository functions to create documents and store embedded chunks
- Persist chunks and mark documents as completed within a transaction
- Roll back failed chunk storage operations while preserving the original error
- Load environment variables from .env in development and production commands
2026-10-22 10:20:32 -05:00
Brandon Wolfgang
dae610d2b2 feat: add configurable text chunking with overlap
- Implement chunkText with configurable chunk size and overlap defaults
- Normalize input text and return no chunks for empty or whitespace-only content
- Assign sequential indices to chunks while preserving configured overlap
- Validate chunk size and overlap constraints
- Add tests for empty input, chunk boundaries, overlap, indexing, and invalid sizes
2026-10-22 10:01:12 -05:00
Brandon Wolfgang
8038ff35fc feat: add document schema and embedding generation
- Create documents and document_chunks tables with status tracking, cascading deletes, and chunk uniqueness constraints
- Enable pgvector and store 768-dimensional document embeddings
- Add an initial source metadata migration placeholder
- Add node-pg-migrate for database migration management
- Implement Ollama embedding generation using nomic-embed-text with timeout and response validation
2026-10-22 09:45:35 -05:00
Brandon Wolfgang
faf3d8ce1d feat: add PostgreSQL with pgvector infrastructure
- Add Docker Compose configuration for PostgreSQL 17 with pgvector
- Configure database credentials through a required POSTGRES_PASSWORD environment variable
- Bind the database port to localhost and persist data in a named volume
- Add a database health check using pg_isready
- Add the pg client and TypeScript definitions
2026-10-21 22:20:10 -05:00
Brandon Wolfgang
f5840d4ecc Merge branch 'feat/phase-2-local-inference' 2026-10-21 21:44:34 -05:00
Brandon Wolfgang
c70a16af15 feat: integrate local Ollama inference and update API documentation
- Add an Ollama client for Qwen3 8B generation with request timeouts and HTTP error handling
- Implement POST /generate with request validation and sanitized failure responses
- Update GET /ready to report Ollama availability and return HTTP 503 when unavailable
- Add unit and integration tests for generation, dependency health, and failure handling
- Document implemented API endpoints, setup instructions, scripts, and remaining planned capabilities in README
2026-10-21 21:43:46 -05:00
Brandon Wolfgang
1f354e8b5c Merge branch 'feat/phase-1-api-foundation' 2026-10-21 21:36:16 -05:00
Brandon Wolfgang
66dc2b2065 feat: implement Phase 1 API foundation and testing
- Configure the Node.js test runner with tsx
- Add endpoint tests for health, readiness, and echo request validation
- Cover input length boundaries, invalid message types, unknown routes, and unexpected errors
- Extract the Fastify app factory to support isolated testing without starting the server
- Add centralized error handling and consistent 404 responses
- Guard server startup to prevent listeners from opening when the module is imported
2026-10-21 21:32:40 -05:00
Brandon Wolfgang
ed9259d35e Initialize local AI platform project 2026-10-21 16:57:52 -05:00