added classes for vectorization, similarity search and summarization
This commit is contained in:
@@ -50,7 +50,7 @@ Package-by-feature layout. Server context path is `/api`. Main endpoints:
|
||||
- `DELETE /api/connections/{serviceType}` — removes a service from the session; invalidates the session if no connections remain
|
||||
- `POST /api/search` — paged search against the requested service; returns 401 if no active session
|
||||
|
||||
Five packages:
|
||||
Six packages:
|
||||
|
||||
**`shared/`** — cross-cutting types used by more than one feature package
|
||||
|
||||
@@ -72,12 +72,24 @@ Five packages:
|
||||
- Entity (`ConnectionEntity`) uses **Single Table Inheritance** — one `connections` table with app-specific nullable columns
|
||||
- `HomeboxConnectionProvider` / `HomeboxEntity`: Homebox-specific implementation
|
||||
|
||||
**`search/`** — querying connected services
|
||||
**`ai/`** — shared AI infrastructure used by multiple features (search, future image analysis)
|
||||
|
||||
- `EmbeddingService`: wraps Spring AI's `EmbeddingModel`; reused by any feature that needs to generate vectors
|
||||
- `VectorStoreConfig`: Spring bean configuration for `PgVectorStore` (pgvector-backed `VectorStore`)
|
||||
- All classes here are provider-agnostic — the OpenAI starter is pointed at LiteLLM, so the underlying model is configurable without code changes
|
||||
|
||||
**`search/`** — querying connected services (keyword and AI)
|
||||
|
||||
- `SearchProvider` interface: extends `ServiceProvider`; each integrated app implements `getSearchResults()`
|
||||
- `SearchService`: auto-discovers providers via Spring injection, dispatches by `ServiceType`
|
||||
- `SearchService`: maintains two provider maps — keyword providers and AI providers; routes based on `SearchRequest.aiSearch` flag
|
||||
- `SearchController`: guards with session check before delegating to `SearchService`
|
||||
- `HomeboxSearchProvider`: Homebox-specific search implementation using bearer token from session
|
||||
- `SearchRequest`: includes `aiSearch: boolean` — when true, routes to AI provider instead of keyword provider
|
||||
- `PagedSearchResponse`: includes nullable `summary` field — populated only for AI search results; null for keyword search
|
||||
- `HomeboxSearchProvider`: keyword search via Homebox API; unchanged from original implementation
|
||||
- `HomeboxAiSearchProvider`: AI search via pgvector similarity; returns ranked items + generated summary
|
||||
- `HomeboxSyncService`: fetches all Homebox items page by page, embeds them via `EmbeddingService`, stores in `VectorStore`; triggered on connection login (background sync)
|
||||
|
||||
**AI search flow:** on login → background sync indexes all Homebox items into pgvector. On AI search → embed query → pgvector similarity search → top N results passed to `ChatClient` for summary generation → return list + summary. Sync is idempotent (delete-then-reindex per connection).
|
||||
|
||||
**`exception/`** — `GlobalExceptionHandler` via `@ControllerAdvice`
|
||||
|
||||
@@ -97,7 +109,9 @@ React 19 + TypeScript + SCSS, Vite 6 build. Package-by-feature under `components
|
||||
### Data & AI
|
||||
|
||||
- PostgreSQL + pgvector (semantic search via embeddings); also used as the Spring Session store (JDBC)
|
||||
- LiteLLM as a unified AI proxy; Spring AI OpenAI starter wired to it
|
||||
- LiteLLM as a unified AI proxy; Spring AI OpenAI starter wired to it — `OPENAI_BASE_URL` points to LiteLLM, not OpenAI directly, keeping the underlying model provider configurable
|
||||
- `spring-ai-starter-vector-store-pgvector` provides `PgVectorStore`; configured in `ai/VectorStoreConfig`
|
||||
- Embedding dimensions must stay consistent with the configured LiteLLM embedding model — changing models requires re-syncing all indexed items
|
||||
- Processing pipeline (Phase 2): stage in DB → LLM inference → refine via UI → export to target app
|
||||
|
||||
### Testing Strategy
|
||||
|
||||
Reference in New Issue
Block a user